Skip to content

Commit 8257639

Browse files
authored
Merge pull request kubernetes#93895 from knight42/fix/TestWatchHTTPTimeout
test(endpoints): deflake TestWatchHTTPTimeout
2 parents 4750523 + 50e8287 commit 8257639

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

staging/src/k8s.io/apiserver/pkg/endpoints/watch_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,16 @@ func TestWatchHTTPTimeout(t *testing.T) {
844844
close(timeoutCh)
845845
select {
846846
case <-done:
847-
if !watcher.IsStopped() {
847+
eventCh := watcher.ResultChan()
848+
select {
849+
case _, opened := <-eventCh:
850+
if opened {
851+
t.Errorf("Watcher received unexpected event")
852+
}
853+
if !watcher.IsStopped() {
854+
t.Errorf("Watcher is not stopped")
855+
}
856+
case <-time.After(wait.ForeverTestTimeout):
848857
t.Errorf("Leaked watch on timeout")
849858
}
850859
case <-time.After(wait.ForeverTestTimeout):

0 commit comments

Comments
 (0)