Skip to content

Commit

Permalink
Fix flakiness in TraceUtilTest.getTaskIds (facebookincubator#11394)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebookincubator#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
  • Loading branch information
Bikramjeet Vig authored and facebook-github-bot committed Oct 31, 2024
1 parent 5cbba09 commit 1e7a82f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions velox/exec/tests/TraceUtilTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> 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) {
Expand Down

0 comments on commit 1e7a82f

Please sign in to comment.