Browse Source

integration: cancel Watch when TestV3WatchWithPrevKV exits

Missing ctx cancel was causing goroutine leaks for the proxy tests.
Anthony Romano 9 years ago
parent
commit
76bb33781f
1 changed files with 5 additions and 1 deletions
  1. 5 1
      integration/v3_watch_test.go

+ 5 - 1
integration/v3_watch_test.go

@@ -1128,9 +1128,13 @@ func TestV3WatchWithFilter(t *testing.T) {
 }
 }
 
 
 func TestV3WatchWithPrevKV(t *testing.T) {
 func TestV3WatchWithPrevKV(t *testing.T) {
+	defer testutil.AfterTest(t)
 	clus := NewClusterV3(t, &ClusterConfig{Size: 1})
 	clus := NewClusterV3(t, &ClusterConfig{Size: 1})
 	defer clus.Terminate(t)
 	defer clus.Terminate(t)
 
 
+	wctx, wcancel := context.WithCancel(context.Background())
+	defer wcancel()
+
 	tests := []struct {
 	tests := []struct {
 		key  string
 		key  string
 		end  string
 		end  string
@@ -1150,7 +1154,7 @@ func TestV3WatchWithPrevKV(t *testing.T) {
 			t.Fatal(err)
 			t.Fatal(err)
 		}
 		}
 
 
-		ws, werr := toGRPC(clus.RandClient()).Watch.Watch(context.TODO())
+		ws, werr := toGRPC(clus.RandClient()).Watch.Watch(wctx)
 		if werr != nil {
 		if werr != nil {
 			t.Fatal(werr)
 			t.Fatal(werr)
 		}
 		}