diff --git a/test/e2e/common/node/pods.go b/test/e2e/common/node/pods.go index 6a26803644e..94cfba318b4 100644 --- a/test/e2e/common/node/pods.go +++ b/test/e2e/common/node/pods.go @@ -28,6 +28,7 @@ import ( "time" "k8s.io/client-go/util/retry" + "k8s.io/klog/v2" "golang.org/x/net/websocket" @@ -264,7 +265,7 @@ var _ = SIGDescribe("Pods", func() { return podClient.Watch(ctx, options) }, } - _, informer, w, _ := watchtools.NewIndexerInformerWatcher(lw, &v1.Pod{}) + _, informer, w, _ := watchtools.NewIndexerInformerWatcherWithLogger(klog.FromContext(ctx), lw, &v1.Pod{}) defer w.Stop() ctxUntil, cancelCtx := context.WithTimeout(ctx, wait.ForeverTestTimeout) diff --git a/test/e2e/scheduling/limit_range.go b/test/e2e/scheduling/limit_range.go index ecb0d147990..ca00c6b3078 100644 --- a/test/e2e/scheduling/limit_range.go +++ b/test/e2e/scheduling/limit_range.go @@ -40,6 +40,7 @@ import ( "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/tools/cache" watchtools "k8s.io/client-go/tools/watch" + "k8s.io/klog/v2" "k8s.io/kubernetes/test/e2e/framework" e2eservice "k8s.io/kubernetes/test/e2e/framework/service" imageutils "k8s.io/kubernetes/test/utils/image" @@ -91,7 +92,7 @@ var _ = SIGDescribe("LimitRange", func() { return f.ClientSet.CoreV1().LimitRanges(f.Namespace.Name).Watch(ctx, options) }, } - _, informer, w, _ := watchtools.NewIndexerInformerWatcher(lw, &v1.LimitRange{}) + _, informer, w, _ := watchtools.NewIndexerInformerWatcherWithLogger(klog.FromContext(ctx), lw, &v1.LimitRange{}) defer w.Stop() timeoutCtx, cancel := context.WithTimeout(ctx, wait.ForeverTestTimeout) diff --git a/test/integration/apimachinery/watch_restart_test.go b/test/integration/apimachinery/watch_restart_test.go index c2c1b2f368e..8701e97d492 100644 --- a/test/integration/apimachinery/watch_restart_test.go +++ b/test/integration/apimachinery/watch_restart_test.go @@ -35,6 +35,7 @@ import ( watchtools "k8s.io/client-go/tools/watch" kubeapiservertesting "k8s.io/kubernetes/cmd/kube-apiserver/app/testing" "k8s.io/kubernetes/test/integration/framework" + "k8s.io/kubernetes/test/utils/ktesting" ) func noopNormalization(output []string) []string { @@ -66,6 +67,8 @@ func TestWatchRestartsIfTimeoutNotReached(t *testing.T) { // Has to be longer than 5 seconds timeout := 30 * time.Second + logger, _ := ktesting.NewTestContext(t) + server := kubeapiservertesting.StartTestServerOrDie(t, nil, []string{"--min-request-timeout=7"}, framework.SharedEtcd()) defer server.TearDownFn() @@ -199,7 +202,7 @@ func TestWatchRestartsIfTimeoutNotReached(t *testing.T) { // since the watcher is driven by an informer it is crucial to start producing only after the informer has synced // otherwise we might not get all expected events since the informer LIST (or watchelist) and only then WATCHES // all events received during the initial LIST (or watchlist) will be seen as a single event (to most recent version of an obj) - _, informer, w, done := watchtools.NewIndexerInformerWatcher(lw, &corev1.Secret{}) + _, informer, w, done := watchtools.NewIndexerInformerWatcherWithLogger(logger, lw, &corev1.Secret{}) cache.WaitForCacheSync(context.TODO().Done(), informer.HasSynced) return w, nil, func() { <-done } },