Merge pull request #127492 from p0lyn0mial/upstream-deflake-consistent-read-fallback

pkg/storage/cacher/cacher_whitebox_test: deflake TestConsistentReadFallback when ResilientWatchCacheInitialization is off
This commit is contained in:
Kubernetes Prow Robot 2024-09-20 09:37:42 +01:00 committed by GitHub
commit 65c77b7e3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -381,6 +381,11 @@ apiserver_watch_cache_consistent_read_total{fallback="true", resource="pods", su
t.Fatalf("Couldn't create cacher: %v", err)
}
defer cacher.Stop()
if !utilfeature.DefaultFeatureGate.Enabled(features.ResilientWatchCacheInitialization) {
if err := cacher.ready.wait(context.Background()); err != nil {
t.Fatalf("unexpected error waiting for the cache to be ready")
}
}
if fmt.Sprintf("%d", cacher.watchCache.resourceVersion) != tc.watchCacheRV {
t.Fatalf("Expected watch cache RV to equal watchCacheRV, got: %d, want: %s", cacher.watchCache.resourceVersion, tc.watchCacheRV)