Browse Source

Merge pull request #6473 from heyitsanthony/watchreconn-putretry

integration: l-read before Put in TestWatchReconnRequest
Anthony Romano 9 years ago
parent
commit
69c7ea0b4a
1 changed files with 8 additions and 0 deletions
  1. 8 0
      clientv3/integration/watch_test.go

+ 8 - 0
clientv3/integration/watch_test.go

@@ -211,6 +211,14 @@ func testWatchReconnRequest(t *testing.T, wctx *watchctx) {
 	stopc <- struct{}{}
 	stopc <- struct{}{}
 	<-donec
 	<-donec
 
 
+	// spinning on dropping connections may trigger a leader election
+	// due to resource starvation; l-read to ensure the cluster is stable
+	ctx, cancel := context.WithTimeout(context.TODO(), 30*time.Second)
+	if _, err := wctx.kv.Get(ctx, "_"); err != nil {
+		t.Fatal(err)
+	}
+	cancel()
+
 	// ensure watcher works
 	// ensure watcher works
 	putAndWatch(t, wctx, "a", "a")
 	putAndWatch(t, wctx, "a", "a")
 }
 }