From 76bb33781fb7a512587d4bdd1a671e4f79b7d712 Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Thu, 1 Dec 2016 15:08:18 -0800 Subject: [PATCH] integration: cancel Watch when TestV3WatchWithPrevKV exits Missing ctx cancel was causing goroutine leaks for the proxy tests. --- integration/v3_watch_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/integration/v3_watch_test.go b/integration/v3_watch_test.go index 61b9b7e82..b7762f3fb 100644 --- a/integration/v3_watch_test.go +++ b/integration/v3_watch_test.go @@ -1128,9 +1128,13 @@ func TestV3WatchWithFilter(t *testing.T) { } func TestV3WatchWithPrevKV(t *testing.T) { + defer testutil.AfterTest(t) clus := NewClusterV3(t, &ClusterConfig{Size: 1}) defer clus.Terminate(t) + wctx, wcancel := context.WithCancel(context.Background()) + defer wcancel() + tests := []struct { key string end string @@ -1150,7 +1154,7 @@ func TestV3WatchWithPrevKV(t *testing.T) { t.Fatal(err) } - ws, werr := toGRPC(clus.RandClient()).Watch.Watch(context.TODO()) + ws, werr := toGRPC(clus.RandClient()).Watch.Watch(wctx) if werr != nil { t.Fatal(werr) }