Commit bee58229 authored by Mike Danese's avatar Mike Danese

Merge pull request #19010 from wojtek-t/debug_watcher_test

Fix etcdWatcher test
parents b174fc9c 8cd50dd0
...@@ -266,8 +266,15 @@ func TestWatch(t *testing.T) { ...@@ -266,8 +266,15 @@ func TestWatch(t *testing.T) {
watching.Stop() watching.Stop()
if _, open := <-watching.ResultChan(); open { // There is a race in etcdWatcher so that after calling Stop() one of
t.Errorf("An injected error did not cause a graceful shutdown") // 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)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment