mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #19131 from wojtek-t/fix_close_channel
Auto commit by PR queue bot
This commit is contained in:
commit
5cf0659502
@ -462,8 +462,15 @@ func TestWatchPurposefulShutdown(t *testing.T) {
|
|||||||
watching.Stop()
|
watching.Stop()
|
||||||
rt.Gosched()
|
rt.Gosched()
|
||||||
|
|
||||||
if _, open := <-watching.ResultChan(); open {
|
// There is a race in etcdWatcher so that after calling Stop() one of
|
||||||
t.Errorf("Channel should be closed")
|
// two things can happen:
|
||||||
|
// - ResultChan() may be closed (triggered by closing userStop channel)
|
||||||
|
// - an Error "context cancelled" may be emitted (triggered by cancelling request
|
||||||
|
// to etcd and putting that error to etcdError channel)
|
||||||
|
// We need to be prepared for both here.
|
||||||
|
event, open := <-watching.ResultChan()
|
||||||
|
if open && event.Type != watch.Error {
|
||||||
|
t.Errorf("Unexpected event from stopped watcher: %#v", event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user