From 2bc022aad4e954858322f182c49d60be20a66dc8 Mon Sep 17 00:00:00 2001 From: Hongchao Deng Date: Thu, 21 Apr 2016 06:40:52 +0800 Subject: [PATCH] watcher test: print more info for debugging --- pkg/storage/etcd3/watcher_test.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkg/storage/etcd3/watcher_test.go b/pkg/storage/etcd3/watcher_test.go index 315d22a0ad7..137fe96d5f3 100644 --- a/pkg/storage/etcd3/watcher_test.go +++ b/pkg/storage/etcd3/watcher_test.go @@ -199,9 +199,16 @@ func testCheckResult(t *testing.T, i int, expectEventType watch.EventType, w wat func testCheckStop(t *testing.T, i int, w watch.Interface) { select { - case _, ok := <-w.ResultChan(): + case e, ok := <-w.ResultChan(): if ok { - t.Errorf("#%d: ResultChan should have been closed", i) + var obj string + switch e.Object.(type) { + case *api.Pod: + obj = e.Object.(*api.Pod).Name + case *unversioned.Status: + obj = e.Object.(*unversioned.Status).Message + } + t.Errorf("#%d: ResultChan should have been closed. Event: %s. Object: %s", i, e.Type, obj) } case <-time.After(wait.ForeverTestTimeout): t.Errorf("#%d: time out after waiting 1s on ResultChan", i)