mirror of https://github.com/milvus-io/milvus.git
fix: Assertion all async invocations in test case (#29737)
Resolves: #29736 Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>pull/29740/head
parent
5be909982d
commit
b5f039a221
|
@ -124,15 +124,23 @@ func (suite *CheckerControllerSuite) TestBasic() {
|
||||||
suite.scheduler.EXPECT().GetSegmentTaskNum().Return(0).Maybe()
|
suite.scheduler.EXPECT().GetSegmentTaskNum().Return(0).Maybe()
|
||||||
suite.scheduler.EXPECT().GetChannelTaskNum().Return(0).Maybe()
|
suite.scheduler.EXPECT().GetChannelTaskNum().Return(0).Maybe()
|
||||||
|
|
||||||
suite.balancer.EXPECT().AssignSegment(mock.Anything, mock.Anything, mock.Anything).Return(nil)
|
assignSegCounter := atomic.NewInt32(0)
|
||||||
suite.balancer.EXPECT().AssignChannel(mock.Anything, mock.Anything).Return(nil)
|
assingChanCounter := atomic.NewInt32(0)
|
||||||
|
suite.balancer.EXPECT().AssignSegment(mock.Anything, mock.Anything, mock.Anything).RunAndReturn(func(i1 int64, s []*meta.Segment, i2 []int64) []balance.SegmentAssignPlan {
|
||||||
|
assignSegCounter.Inc()
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
suite.balancer.EXPECT().AssignChannel(mock.Anything, mock.Anything).RunAndReturn(func(dc []*meta.DmChannel, i []int64) []balance.ChannelAssignPlan {
|
||||||
|
assingChanCounter.Inc()
|
||||||
|
return nil
|
||||||
|
})
|
||||||
suite.controller.Start()
|
suite.controller.Start()
|
||||||
defer suite.controller.Stop()
|
defer suite.controller.Stop()
|
||||||
|
|
||||||
suite.Eventually(func() bool {
|
suite.Eventually(func() bool {
|
||||||
suite.controller.Check()
|
suite.controller.Check()
|
||||||
return counter.Load() > 0
|
return counter.Load() > 0 && assignSegCounter.Load() > 0 && assingChanCounter.Load() > 0
|
||||||
}, 5*time.Second, 1*time.Second)
|
}, 5*time.Second, 1*time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCheckControllerSuite(t *testing.T) {
|
func TestCheckControllerSuite(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue