From 1e7a82f0379da727412002d8192758ef90de95b8 Mon Sep 17 00:00:00 2001 From: Bikramjeet Vig Date: Wed, 30 Oct 2024 18:38:03 -0700 Subject: [PATCH] Fix flakiness in TraceUtilTest.getTaskIds (#11394) Summary: Pull Request resolved: https://github.com/facebookincubator/velox/pull/11394 Currently the test verifies the contents of a vector that fetches filenames from a directory. However, the filesystem call to fetch the contents of a directory might not always be in a sorted order which can fail the verification step of this test. Therefore, this change ensures the contents are sorted before verification. Reviewed By: xiaoxmeng Differential Revision: D65244642 fbshipit-source-id: 46ce3f59cd08bb18f4e21618e81551dd1aed5721 --- velox/exec/tests/TraceUtilTest.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/velox/exec/tests/TraceUtilTest.cpp b/velox/exec/tests/TraceUtilTest.cpp index 5dbbdae535cb..3afae1b9db42 100644 --- a/velox/exec/tests/TraceUtilTest.cpp +++ b/velox/exec/tests/TraceUtilTest.cpp @@ -139,9 +139,9 @@ TEST_F(TraceUtilTest, getTaskIds) { fs->mkdir(trace::getTaskTraceDirectory(rootPath, queryId, taskId2)); auto taskIds = getTaskIds(rootPath, queryId, fs); ASSERT_EQ(taskIds.size(), 2); - std::set taskIdSet({taskId1, taskId2}); - ASSERT_EQ(*taskIds.begin(), taskId1); - ASSERT_EQ(*taskIds.rbegin(), taskId2); + std::sort(taskIds.begin(), taskIds.end()); + ASSERT_EQ(taskIds[0], taskId1); + ASSERT_EQ(taskIds[1], taskId2); } TEST_F(TraceUtilTest, getDriverIds) {