Add sync logic in TestWatchChannel (#7188)

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
congqixia 2021-08-20 17:48:13 +08:00 committed by GitHub
parent 9e71daa759
commit 881d0af1fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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]