diff --git a/velox/exec/tests/MultiFragmentTest.cpp b/velox/exec/tests/MultiFragmentTest.cpp index 69d4e97838a1..b8d3fd0aaaba 100644 --- a/velox/exec/tests/MultiFragmentTest.cpp +++ b/velox/exec/tests/MultiFragmentTest.cpp @@ -512,6 +512,10 @@ TEST_P(MultiFragmentTest, abortMergeExchange) { // Ensure that the threads in the executor can gracefully join executor.join(); + /* sleep override */ + // Wait till all the terminations, closures and destructions are done. + std::this_thread::sleep_for(std::chrono::seconds(1)); + // The references to mergeTask should be two, one for the local variable // itself and one reference inside tasks variable. EXPECT_EQ(mergeTask.use_count(), 2);