mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-28 14:35:27 +08:00
test: [skip e2e] fix race condition in TestQueryNodePipeline/TestBasic (#46218)
issue: #46217 The test was failing intermittently because it didn't wait for the pipeline to finish processing messages before exiting. The test sent a message to the pipeline and immediately returned, causing the deferred Close() to execute before ProcessInsert, ProcessDelete, and UpdateTSafe could be called. Fix by: - Moving message construction before mock expectations setup - Adding a done channel to synchronize on UpdateTSafe completion - Waiting for the signal before test exits Signed-off-by: Wei Liu <wei.liu@zilliz.com>
This commit is contained in:
parent
765768b0e4
commit
046693eaf7
@ -139,6 +139,15 @@ func (suite *PipelineTestSuite) TestBasic() {
|
||||
}
|
||||
})
|
||||
|
||||
// build input msg ahead of time to set up expectations
|
||||
in := suite.buildMsgPack(schema)
|
||||
|
||||
// use a channel to signal when UpdateTSafe is called (last operation in pipeline)
|
||||
done := make(chan struct{})
|
||||
suite.delegator.EXPECT().UpdateTSafe(in.EndTs).Run(func(ts uint64) {
|
||||
close(done)
|
||||
}).Return()
|
||||
|
||||
// build pipleine
|
||||
manager := &segments.Manager{
|
||||
Collection: suite.collectionManager,
|
||||
@ -155,10 +164,11 @@ func (suite *PipelineTestSuite) TestBasic() {
|
||||
suite.NoError(err)
|
||||
defer pipelineObj.Close()
|
||||
|
||||
// build input msg
|
||||
in := suite.buildMsgPack(schema)
|
||||
suite.delegator.EXPECT().UpdateTSafe(in.EndTs).Return()
|
||||
// send message to pipeline
|
||||
suite.msgChan <- in
|
||||
|
||||
// wait for pipeline to process the message
|
||||
<-done
|
||||
}
|
||||
|
||||
func TestQueryNodePipeline(t *testing.T) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user