From 0684d8c4c6d5d3955ab077630764aba7cb80531b Mon Sep 17 00:00:00 2001 From: Gyu-Ho Lee Date: Tue, 1 Nov 2016 11:13:33 -0700 Subject: [PATCH] clientv3/integration: close active connection to get ErrClientConnClosing because clientv3.Close won't trigger it any more clientv3.Close just closes watch client instead of closing grpc connection --- clientv3/integration/watch_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/clientv3/integration/watch_test.go b/clientv3/integration/watch_test.go index c3f5b4b96..a88e5fb77 100644 --- a/clientv3/integration/watch_test.go +++ b/clientv3/integration/watch_test.go @@ -614,18 +614,19 @@ func TestWatchErrConnClosed(t *testing.T) { defer clus.Terminate(t) cli := clus.Client(0) + defer cli.Close() wc := clientv3.NewWatcher(cli) donec := make(chan struct{}) go func() { defer close(donec) - wc.Watch(context.TODO(), "foo") - if err := wc.Close(); err != nil && err != grpc.ErrClientConnClosing { - t.Fatalf("expected %v, got %v", grpc.ErrClientConnClosing, err) + ch := wc.Watch(context.TODO(), "foo") + if wr := <-ch; grpc.ErrorDesc(wr.Err()) != grpc.ErrClientConnClosing.Error() { + t.Fatalf("expected %v, got %v", grpc.ErrClientConnClosing, grpc.ErrorDesc(wr.Err())) } }() - if err := cli.Close(); err != nil { + if err := cli.ActiveConnection().Close(); err != nil { t.Fatal(err) } clus.TakeClient(0)