From 881d0af1fc0ac2aaea047a733adf24b1db455cd2 Mon Sep 17 00:00:00 2001 From: congqixia Date: Fri, 20 Aug 2021 17:48:13 +0800 Subject: [PATCH] Add sync logic in TestWatchChannel (#7188) Signed-off-by: Congqi Xia --- internal/datanode/data_node_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/datanode/data_node_test.go b/internal/datanode/data_node_test.go index 9d5e99ad9c..81399294d6 100644 --- a/internal/datanode/data_node_test.go +++ b/internal/datanode/data_node_test.go @@ -340,6 +340,7 @@ func TestWatchChannel(t *testing.T) { c := make(chan struct{}) go func() { ec := kv.WatchWithPrefix(fmt.Sprintf("channel/%d", node.NodeID)) + c <- struct{}{} cnt := 0 for { evt := <-ec @@ -354,6 +355,8 @@ func TestWatchChannel(t *testing.T) { } c <- struct{}{} }() + // wait for check goroutine start Watch + <-c vchan := &datapb.VchannelInfo{ CollectionID: 1, @@ -369,6 +372,7 @@ func TestWatchChannel(t *testing.T) { err = kv.Save(path, string(val)) assert.Nil(t, err) + // wait for check goroutine received 2 events <-c node.chanMut.RLock() _, has := node.vchan2SyncService[ch]