mirror of https://github.com/milvus-io/milvus.git
Fix data race of data node test (#22221)
Signed-off-by: aoiasd <zhicheng.yue@zilliz.com>pull/22346/head
parent
c3e8ad3629
commit
27b456dd46
|
@ -111,6 +111,7 @@ func TestDataNode(t *testing.T) {
|
|||
node.chunkManager = storage.NewLocalChunkManager(storage.RootPath("/tmp/milvus_test/datanode"))
|
||||
paramtable.SetNodeID(1)
|
||||
|
||||
defer cancel()
|
||||
t.Run("Test SetRootCoord", func(t *testing.T) {
|
||||
emptyDN := &DataNode{}
|
||||
tests := []struct {
|
||||
|
@ -196,19 +197,22 @@ func TestDataNode(t *testing.T) {
|
|||
}{
|
||||
{"fake-by-dev-rootcoord-dml-backgroundgc-1"},
|
||||
{"fake-by-dev-rootcoord-dml-backgroundgc-2"},
|
||||
{"fake-by-dev-rootcoord-dml-backgroundgc-3"},
|
||||
{""},
|
||||
{""},
|
||||
}
|
||||
|
||||
for i, test := range testDataSyncs {
|
||||
if i <= 2 {
|
||||
err = node.flowgraphManager.addAndStart(node, &datapb.VchannelInfo{CollectionID: 1, ChannelName: test.dmChannelName}, nil, genTestTickler())
|
||||
assert.Nil(t, err)
|
||||
vchanNameCh <- test.dmChannelName
|
||||
}
|
||||
for _, test := range testDataSyncs {
|
||||
err = node.flowgraphManager.addAndStart(node, &datapb.VchannelInfo{CollectionID: 1, ChannelName: test.dmChannelName}, nil, genTestTickler())
|
||||
assert.Nil(t, err)
|
||||
vchanNameCh <- test.dmChannelName
|
||||
}
|
||||
cancel()
|
||||
|
||||
assert.Eventually(t, func() bool {
|
||||
for _, test := range testDataSyncs {
|
||||
if node.flowgraphManager.exist(test.dmChannelName) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}, 2*time.Second, 10*time.Millisecond)
|
||||
})
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue