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.
This commit is contained in:
Anthony Romano 2016-01-19 12:30:49 -08:00
parent 9ca3c8e581
commit 7e0a5b8ed7

View File

@ -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()