test(endpoints): deflake TestWatchHTTPTimeout

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

Kubernetes-commit: 50e8287e6df67428ab5871af530fb10f6eee19de
This commit is contained in:
knight42 2020-08-12 01:58:07 +08:00 committed by Kubernetes Publisher
parent fe7e3b0680
commit 5c23eb937e
1 changed files with 10 additions and 1 deletions

View File

@ -844,7 +844,16 @@ func TestWatchHTTPTimeout(t *testing.T) {
close(timeoutCh) close(timeoutCh)
select { select {
case <-done: case <-done:
eventCh := watcher.ResultChan()
select {
case _, opened := <-eventCh:
if opened {
t.Errorf("Watcher received unexpected event")
}
if !watcher.IsStopped() { if !watcher.IsStopped() {
t.Errorf("Watcher is not stopped")
}
case <-time.After(wait.ForeverTestTimeout):
t.Errorf("Leaked watch on timeout") t.Errorf("Leaked watch on timeout")
} }
case <-time.After(wait.ForeverTestTimeout): case <-time.After(wait.ForeverTestTimeout):