From da3e7e3781650024e4cc7cb65082908c531e8efa Mon Sep 17 00:00:00 2001 From: Msk233 <118117161+Mskxn@users.noreply.github.com> Date: Wed, 26 Apr 2023 09:04:33 +0800 Subject: [PATCH] stop watcher when error occurs --- .../src/k8s.io/client-go/tools/watch/informerwatcher_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/staging/src/k8s.io/client-go/tools/watch/informerwatcher_test.go b/staging/src/k8s.io/client-go/tools/watch/informerwatcher_test.go index ce029b464d1..a284b809568 100644 --- a/staging/src/k8s.io/client-go/tools/watch/informerwatcher_test.go +++ b/staging/src/k8s.io/client-go/tools/watch/informerwatcher_test.go @@ -302,7 +302,7 @@ func TestInformerWatcherDeletedFinalStateUnknown(t *testing.T) { return retval, nil }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - w := watch.NewFake() + w := watch.NewRaceFreeFake() if options.ResourceVersion == "1" { go func() { // Close with a "Gone" error when trying to start a watch from the first list @@ -315,6 +315,7 @@ func TestInformerWatcherDeletedFinalStateUnknown(t *testing.T) { }, } _, _, w, done := NewIndexerInformerWatcher(lw, &corev1.Secret{}) + defer w.Stop() // Expect secret add select {