Skip to content

Commit 2ab26dd

Browse files
authored
fix: disable WatchListClient for envtest-based tests (#3756)
1 parent ec75dd9 commit 2ab26dd

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

pkg/controller/operators/openshift/suite_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package openshift
22

33
import (
44
"context"
5+
"os"
56
"path/filepath"
67
"testing"
78
"time"
@@ -20,6 +21,15 @@ import (
2021
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
2122
)
2223

24+
// TestMain disables WatchListClient feature for all tests in this package.
25+
// This is required because envtest doesn't fully support WatchList semantics in K8s 1.35.
26+
// See: https://github.com/kubernetes/kubernetes/issues/135895
27+
func TestMain(m *testing.M) {
28+
// Disable WatchListClient feature gate
29+
os.Setenv("KUBE_FEATURE_WatchListClient", "false")
30+
os.Exit(m.Run())
31+
}
32+
2333
func TestControllers(t *testing.T) {
2434
RegisterFailHandler(Fail)
2535

pkg/controller/operators/suite_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package operators
33
import (
44
"context"
55
"fmt"
6+
"os"
67
"testing"
78
"time"
89

@@ -72,6 +73,15 @@ var (
7273
)
7374
)
7475

76+
// TestMain disables WatchListClient feature for all tests in this package.
77+
// This is required because envtest doesn't fully support WatchList semantics in K8s 1.35.
78+
// See: https://github.com/kubernetes/kubernetes/issues/135895
79+
func TestMain(m *testing.M) {
80+
// Disable WatchListClient feature gate
81+
os.Setenv("KUBE_FEATURE_WatchListClient", "false")
82+
os.Exit(m.Run())
83+
}
84+
7585
func TestAPIs(t *testing.T) {
7686
RegisterFailHandler(Fail)
7787

0 commit comments

Comments
 (0)