Skip to content

TestTrackingCache_createTeardownInformers unit test is flakey #505

Description

@erdii

Discovered in: #504 (comment)

On #504 unit test failed in CI:

❌ TestTrackingCache_createTeardownInformers (10ms)
      trackingcache.go:307: TrackingCache: "level"=0 "msg"="waiting for new informer to sync" "gvk"="/v1, Kind=ConfigMap"
      trackingcache.go:310: TrackingCache: "level"=0 "msg"="informer synced successfully" "gvk"="/v1, Kind=ConfigMap"
      trackingcache.go:429: TrackingCache: "level"=0 "msg"="stopping informer" "gvk"="/v1, Kind=ConfigMap"
      trackingcache_test.go:117: FAIL:	Start(string)
          		at: [/home/runner/work/boxcutter/boxcutter/managedcache/trackingcache_test.go:74]
      trackingcache_test.go:117: FAIL: 3 out of 4 expectation(s) were met.
          	The code you are testing needs to make 1 more call(s).
          	at: [/home/runner/work/boxcutter/boxcutter/managedcache/trackingcache_test.go:117]

The test fails unreliably - most of the time it passes.
To reproduce I had to run the tests for managedcache in a loop:

# `-count 1` to sidestep go's test caching
while go test -test.fullpath=true -count 1 -timeout 30s pkg.package-operator.run/boxcutter/managedcache; do; done                                                 
ok      pkg.package-operator.run/boxcutter/managedcache 0.008s
ok      pkg.package-operator.run/boxcutter/managedcache 0.007s
ok      pkg.package-operator.run/boxcutter/managedcache 0.008s
ok      pkg.package-operator.run/boxcutter/managedcache 0.008s
ok      pkg.package-operator.run/boxcutter/managedcache 0.008s
ok      pkg.package-operator.run/boxcutter/managedcache 0.008s
ok      pkg.package-operator.run/boxcutter/managedcache 0.008s
ok      pkg.package-operator.run/boxcutter/managedcache 0.008s
ok      pkg.package-operator.run/boxcutter/managedcache 0.008s
ok      pkg.package-operator.run/boxcutter/managedcache 0.009s
ok      pkg.package-operator.run/boxcutter/managedcache 0.008s
ok      pkg.package-operator.run/boxcutter/managedcache 0.008s
ok      pkg.package-operator.run/boxcutter/managedcache 0.008s
ok      pkg.package-operator.run/boxcutter/managedcache 0.008s
ok      pkg.package-operator.run/boxcutter/managedcache 0.008s
ok      pkg.package-operator.run/boxcutter/managedcache 0.008s
ok      pkg.package-operator.run/boxcutter/managedcache 0.008s
--- FAIL: TestTrackingCache_createTeardownInformers (0.00s)
    /home/erdii/projects/redhat/github.com/package-operator/boxcutter/managedcache/trackingcache.go:307: TrackingCache: "level"=0 "msg"="waiting for new informer to sync" "gvk"="/v1, Kind=ConfigMap"
    /home/erdii/projects/redhat/github.com/package-operator/boxcutter/managedcache/trackingcache.go:310: TrackingCache: "level"=0 "msg"="informer synced successfully" "gvk"="/v1, Kind=ConfigMap"
    /home/erdii/projects/redhat/github.com/package-operator/boxcutter/managedcache/trackingcache.go:429: TrackingCache: "level"=0 "msg"="stopping informer" "gvk"="/v1, Kind=ConfigMap"
    /home/erdii/projects/redhat/github.com/package-operator/boxcutter/managedcache/trackingcache_test.go:117: FAIL:     Start(string)
                        at: [/home/erdii/projects/redhat/github.com/package-operator/boxcutter/managedcache/trackingcache_test.go:74]
    /home/erdii/projects/redhat/github.com/package-operator/boxcutter/managedcache/trackingcache_test.go:117: FAIL: 3 out of 4 expectation(s) were met.
                The code you are testing needs to make 1 more call(s).
                at: [/home/erdii/projects/redhat/github.com/package-operator/boxcutter/managedcache/trackingcache_test.go:117]
FAIL
FAIL    pkg.package-operator.run/boxcutter/managedcache 0.009s
FAIL

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions