stop watcher when error occurs

Kubernetes-commit: da3e7e3781650024e4cc7cb65082908c531e8efa
This commit is contained in:
Msk233 2023-04-26 09:04:33 +08:00 committed by Kubernetes Publisher
parent 68394bf465
commit 5d5619d392

View File

@ -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 {