From ca0afaf2909313477c93c085bf95332c2873bd6a Mon Sep 17 00:00:00 2001 From: Joyce Ma Date: Sat, 9 Dec 2023 02:54:50 +0000 Subject: [PATCH] Set nil cache for NoCacheClientFunc --- operator/pkg/preflight/upgrade_test.go | 5 ----- pkg/controller/kccmanager/nocache/clientbuilder.go | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/operator/pkg/preflight/upgrade_test.go b/operator/pkg/preflight/upgrade_test.go index 5406dcaaf2..0f9fea8e04 100644 --- a/operator/pkg/preflight/upgrade_test.go +++ b/operator/pkg/preflight/upgrade_test.go @@ -218,11 +218,6 @@ func TestUpgradeChecker_Preflight(t *testing.T) { repo := FakeRepo{ channel: tc.channel, } - // Adding the wait to avoid the error "the cache is not started, can - // not read objects". - if !mgr.GetCache().WaitForCacheSync(ctx) { - t.Fatalf("the cache in the test manager did not sync") - } u := NewUpgradeChecker(client, &repo) err := u.Preflight(ctx, tc.cc) asserts.AssertErrorIsExpected(t, err, tc.err) diff --git a/pkg/controller/kccmanager/nocache/clientbuilder.go b/pkg/controller/kccmanager/nocache/clientbuilder.go index e853e8e69e..c0dcbc9d10 100644 --- a/pkg/controller/kccmanager/nocache/clientbuilder.go +++ b/pkg/controller/kccmanager/nocache/clientbuilder.go @@ -20,5 +20,6 @@ import ( ) var NoCacheClientFunc = func(config *rest.Config, options client.Options) (client.Client, error) { + options.Cache = nil return client.New(config, options) }