diff --git a/pkg/controller/operators/openshift/suite_test.go b/pkg/controller/operators/openshift/suite_test.go index 23a54c493a..d0d563ecf5 100644 --- a/pkg/controller/operators/openshift/suite_test.go +++ b/pkg/controller/operators/openshift/suite_test.go @@ -2,6 +2,7 @@ package openshift import ( "context" + "os" "path/filepath" "testing" "time" @@ -20,6 +21,15 @@ import ( metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" ) +// TestMain disables WatchListClient feature for all tests in this package. +// This is required because envtest doesn't fully support WatchList semantics in K8s 1.35. +// See: https://github.com/kubernetes/kubernetes/issues/135895 +func TestMain(m *testing.M) { + // Disable WatchListClient feature gate + os.Setenv("KUBE_FEATURE_WatchListClient", "false") + os.Exit(m.Run()) +} + func TestControllers(t *testing.T) { RegisterFailHandler(Fail) diff --git a/pkg/controller/operators/suite_test.go b/pkg/controller/operators/suite_test.go index 876cf06fc2..257a45ae03 100644 --- a/pkg/controller/operators/suite_test.go +++ b/pkg/controller/operators/suite_test.go @@ -3,6 +3,7 @@ package operators import ( "context" "fmt" + "os" "testing" "time" @@ -72,6 +73,15 @@ var ( ) ) +// TestMain disables WatchListClient feature for all tests in this package. +// This is required because envtest doesn't fully support WatchList semantics in K8s 1.35. +// See: https://github.com/kubernetes/kubernetes/issues/135895 +func TestMain(m *testing.M) { + // Disable WatchListClient feature gate + os.Setenv("KUBE_FEATURE_WatchListClient", "false") + os.Exit(m.Run()) +} + func TestAPIs(t *testing.T) { RegisterFailHandler(Fail)