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:
wei liu 2025-12-09 17:57:14 +08:00 committed by GitHub
parent 765768b0e4
commit 046693eaf7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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) {