Fix flaky unit test (#20006)

Signed-off-by: xiaofan-luan <xiaofan.luan@zilliz.com>

Signed-off-by: xiaofan-luan <xiaofan.luan@zilliz.com>
pull/19995/head
Xiaofan 2022-10-24 11:51:29 +08:00 committed by GitHub
parent eaae3aa49e
commit 868bdd504d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -124,6 +124,8 @@ func TestGarbageCollectorCtx_ReDropCollection(t *testing.T) {
dropCollectionIndexChan <- struct{}{}
return nil
}
dropMetaChan := make(chan struct{}, 1)
meta := mockrootcoord.NewIMetaTable(t)
meta.On("ListAliasesByID",
mock.AnythingOfType("int64")).
@ -132,6 +134,9 @@ func TestGarbageCollectorCtx_ReDropCollection(t *testing.T) {
mock.Anything, // context.Context
mock.AnythingOfType("int64"),
mock.AnythingOfType("uint64")).
Run(func(args mock.Arguments) {
dropMetaChan <- struct{}{}
}).
Return(errors.New("error mock RemoveCollection"))
ticker := newTickerWithMockNormalStream()
tsoAllocator := newMockTsoAllocator()
@ -151,6 +156,7 @@ func TestGarbageCollectorCtx_ReDropCollection(t *testing.T) {
assert.True(t, releaseCollectionCalled)
<-dropCollectionIndexChan
assert.True(t, dropCollectionIndexCalled)
<-dropMetaChan
})
t.Run("normal case", func(t *testing.T) {