From 49bfbb1e1d483cd14e8b77c523ad382d72dc4748 Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Fri, 1 Jun 2018 16:09:20 -0700 Subject: [PATCH] integration: fix "TestV3WatchMultipleStreams" Signed-off-by: Gyuho Lee --- integration/v3_watch_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/integration/v3_watch_test.go b/integration/v3_watch_test.go index c91f4df65036..00ba6ad3887d 100644 --- a/integration/v3_watch_test.go +++ b/integration/v3_watch_test.go @@ -921,6 +921,7 @@ func testV3WatchMultipleStreams(t *testing.T, startRev int64) { Kv: &mvccpb.KeyValue{Key: []byte("foo"), Value: []byte("bar"), CreateRevision: 2, ModRevision: 2, Version: 1}, }, } + ids := make(map[int64]struct{}) for i := range streams { go func(i int) { defer wg.Done() @@ -929,9 +930,10 @@ func testV3WatchMultipleStreams(t *testing.T, startRev int64) { if err != nil { t.Fatalf("wStream.Recv error: %v", err) } - if wresp.WatchId != 0 { - t.Errorf("watchId got = %d, want = 0", wresp.WatchId) + if _, ok := ids[wresp.WatchId]; ok { + t.Fatalf("duplicate watch ID found %d", wresp.WatchId) } + ids[wresp.WatchId] = struct{}{} if !reflect.DeepEqual(wresp.Events, wevents) { t.Errorf("wresp.Events got = %+v, want = %+v", wresp.Events, wevents) }