test(watch-tool): deflake TestRetryWatcherToFinishWithUnreadEvents

Signed-off-by: knight42 <anonymousknight96@gmail.com>

Kubernetes-commit: 1d92314f262548b6b24e309943274e0d9d196a41
This commit is contained in:
knight42 2020-09-05 17:19:47 +08:00 committed by Kubernetes Publisher
parent 62c82f5540
commit a922620591

View File

@ -587,11 +587,12 @@ func TestRetryWatcherToFinishWithUnreadEvents(t *testing.T) {
watcher.Stop()
maxTime := time.Second
select {
case <-watcher.Done():
break
case <-time.After(10 * time.Millisecond):
t.Error("Failed to close the watcher")
case <-time.After(maxTime):
t.Errorf("The watcher failed to be closed in %s", maxTime)
}
// RetryWatcher result channel should be closed