pmm icon indicating copy to clipboard operation
pmm copied to clipboard

Fix unstable TestVersionCache test

Open artemgavrilov opened this issue 2 years ago • 0 comments

Description

TestVersionCache test is unstable, if fails time to time so we need to fox it.

Expected Results

Test always passes

Actual Results

It randomly fails, restarting CI job typically helps.

Version

Steps to reproduce

I saw this problem only in CI, so I'm not sure if it's reproducible in local environments.

Here is example of failed job: https://github.com/percona/pmm/actions/runs/3264069158/jobs/5364126371

Relevant logs

panic: Log in goroutine after TestVersionCache has completed: <<< SELECT "service_software_versions"."service_id", "service_software_versions"."service_type", "service_software_versions"."software_versions", "service_software_versions"."next_check_at", "service_software_versions"."created_at", "service_software_versions"."updated_at" FROM "service_software_versions" WHERE "service_software_versions"."service_id" = $1 LIMIT 1 [`service_id_1`] 18.464168ms

goroutine 37 [running]:
testing.(*common).logDepth(0xc000804ea0, {0xc000026d00, 0x18b}, 0x3)
	/usr/local/go/src/testing/testing.go:894 +0x6d9
testing.(*common).log(...)
	/usr/local/go/src/testing/testing.go:876
testing.(*common).Logf(0xc000804ea0, {0x203677c, 0x6}, {0xc000764230, 0x1, 0x1})
	/usr/local/go/src/testing/testing.go:927 +0xa5
gopkg.in/reform%2ev1.(*PrintfLogger).After(0xc0001f82c0, {0xc0008c2d80, 0x16a}, {0xc0008cc110?, 0x1, 0xc0008cc110?}, 0x1?, {0x0, 0x0})
	/root/go/pkg/mod/gopkg.in/[email protected]/logger.go:95 +0x44c
gopkg.in/reform%2ev1.(*Querier).logAfter(...)
	/root/go/pkg/mod/gopkg.in/[email protected]/querier.go:41
gopkg.in/reform%2ev1.(*Querier).QueryRow(0xc0004ecbe0, {0xc0008c2d80, 0x16a}, {0xc0008cc110, 0x1, 0x1})
	/root/go/pkg/mod/gopkg.in/[email protected]/querier.go:139 +0x211
gopkg.in/reform%2ev1.(*Querier).SelectOneTo(0xc0004ecbe0?, {0x3156f40, 0xc0006c3780}, {0xc0008c82c0, 0x3b}, {0xc0008cc110, 0x1, 0x1})
	/root/go/pkg/mod/gopkg.in/[email protected]/querier_selects.go:56 +0xbd
gopkg.in/reform%2ev1.(*Querier).FindOneTo(0x3ddc100?, {0x3156f40, 0xc0006c3780}, {0x204aece, 0xa}, {0x1d996e0?, 0xc0008cc0e0})
	/root/go/pkg/mod/gopkg.in/[email protected]/querier_selects.go:147 +0x138
gopkg.in/reform%2ev1.(*Querier).FindByPrimaryKeyTo(0xc0006c3780?, {0x3161a80, 0xc0006c3780}, {0x1d996e0, 0xc0008cc0e0})
	/root/go/pkg/mod/gopkg.in/[email protected]/querier_selects.go:198 +0x11f
gopkg.in/reform%2ev1.(*Querier).Reload(0x4aa5ac?, {0x3161a80, 0xc0006c3780})
	/root/go/pkg/mod/gopkg.in/[email protected]/querier_selects.go:216 +0x57
github.com/percona/pmm/managed/models.FindServiceSoftwareVersionsByServiceID(0xc0006b5bf8?, {0xc0006e7fd4, 0xc})
	/root/go/src/github.com/percona/pmm/managed/models/software_version_helpers.go:156 +0x1fc
github.com/percona/pmm/managed/models.UpdateServiceSoftwareVersions(0x1188f4d3?, {0xc0006e7fd4, 0xc}, {0xc0006c6ca8, {0xc0006c3700, 0x4, 0x4}})
	/root/go/src/github.com/percona/pmm/managed/models/software_version_helpers.go:130 +0xc5
github.com/percona/pmm/managed/services/versioncache.(*Service).updateVersionsForNextService(0xc0006ee180)
	/root/go/src/github.com/percona/pmm/managed/services/versioncache/versioncache.go:198 +0xb68
github.com/percona/pmm/managed/services/versioncache.(*Service).Run(0xc0006ee180, {0x3156258, 0xc0006a8840})
	/root/go/src/github.com/percona/pmm/managed/services/versioncache/versioncache.go:238 +0x43f
github.com/percona/pmm/managed/services/versioncache.TestVersionCache.func3()
	/root/go/src/github.com/percona/pmm/managed/services/versioncache/versioncache_test.go:158 +0x4d
created by github.com/percona/pmm/managed/services/versioncache.TestVersionCache
	/root/go/src/github.com/percona/pmm/managed/services/versioncache/versioncache_test.go:157 +0x1cea
FAIL	github.com/percona/pmm/managed/services/versioncache	2.455s

Code of Conduct

  • [X] I agree to follow Percona Community Code of Conduct

artemgavrilov avatar Oct 18 '22 08:10 artemgavrilov