Merge pull request #93895 from knight42/fix/TestWatchHTTPTimeout

test(endpoints): deflake TestWatchHTTPTimeout
This commit is contained in:
Kubernetes Prow Robot 2020-08-11 15:31:59 -07:00 committed by GitHub
commit 82576393f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -844,7 +844,16 @@ func TestWatchHTTPTimeout(t *testing.T) {
close(timeoutCh) close(timeoutCh)
select { select {
case <-done: case <-done:
if !watcher.IsStopped() { eventCh := watcher.ResultChan()
select {
case _, opened := <-eventCh:
if opened {
t.Errorf("Watcher received unexpected event")
}
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):