integration: fix race in TestV3WatchMultipleEventsTxnSynced

Writes between watcher creation request and reply were being dropped.

Fixes #5789
This commit is contained in:
Anthony Romano 2016-07-20 09:55:39 -07:00
parent aba478fb8a
commit 82ddeb38b4

View File

@ -672,6 +672,9 @@ func testV3WatchMultipleEventsTxn(t *testing.T, startRev int64) {
if err := wStream.Send(wreq); err != nil {
t.Fatalf("wStream.Send error: %v", err)
}
if resp, err := wStream.Recv(); err != nil || resp.Created == false {
t.Fatalf("create response failed: resp=%v, err=%v", resp, err)
}
kvc := toGRPC(clus.RandClient()).KV
txn := pb.TxnRequest{}
@ -697,9 +700,6 @@ func testV3WatchMultipleEventsTxn(t *testing.T, startRev int64) {
if err != nil {
t.Errorf("wStream.Recv error: %v", err)
}
if resp.Created {
continue
}
events = append(events, resp.Events...)
}
sort.Sort(eventsSortByKey(events))