Browse Source

integration: fix race in WatchFromCurrentRevision

Since watching from current revision, keys should be put after the
watcher is registered or the test may time out. Shows up in CI.
Anthony Romano 10 years ago
parent
commit
7e0a5b8ed7
1 changed files with 4 additions and 4 deletions
  1. 4 4
      integration/v3_grpc_test.go

+ 4 - 4
integration/v3_grpc_test.go

@@ -369,6 +369,10 @@ func TestV3WatchFromCurrentRevision(t *testing.T) {
 			t.Fatalf("#%d: wAPI.Watch error: %v", i, err)
 		}
 
+		if err := wStream.Send(tt.watchRequest); err != nil {
+			t.Fatalf("#%d: wStream.Send error: %v", i, err)
+		}
+
 		go func() {
 			for _, k := range tt.putKeys {
 				kvc := pb.NewKVClient(clus.RandConn())
@@ -379,10 +383,6 @@ func TestV3WatchFromCurrentRevision(t *testing.T) {
 			}
 		}()
 
-		if err := wStream.Send(tt.watchRequest); err != nil {
-			t.Fatalf("#%d: wStream.Send error: %v", i, err)
-		}
-
 		var createdWatchId int64
 		for j, wresp := range tt.wresps {
 			resp, err := wStream.Recv()