Skip to content

Commit

Permalink
Fix test flakiness for descriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinTF committed Feb 17, 2025
1 parent da4e1e2 commit 33efc65
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion test/MultiColumnJoinTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Chair of Algorithms and Data Structures.
// Author: Florian Kramer ([email protected])

#include <absl/strings/str_split.h>
#include <gtest/gtest.h>

#include <array>
Expand Down Expand Up @@ -88,7 +89,22 @@ TEST(MultiColumnJoin, clone) {
ASSERT_TRUE(clone);
const auto& cloneReference = *clone;
EXPECT_EQ(typeid(join), typeid(cloneReference));
EXPECT_EQ(cloneReference.getDescriptor(), join.getDescriptor());

std::string_view prefix = "MultiColumnJoin on ";
EXPECT_THAT(join.getDescriptor(), ::testing::StartsWith(prefix));
EXPECT_THAT(cloneReference.getDescriptor(), ::testing::StartsWith(prefix));
// Order of join columns is not deterministic.
auto getVars = [prefix](std::string_view string) {
string.remove_prefix(prefix.length());
std::vector<std::string> vars;
for (const auto& split : absl::StrSplit(string, ' ', absl::SkipEmpty())) {
vars.emplace_back(split);
}
ql::ranges::sort(vars);
return vars;
};
EXPECT_EQ(getVars(cloneReference.getDescriptor()),
getVars(join.getDescriptor()));

EXPECT_NE(join.getChildren().at(0), cloneReference.getChildren().at(0));
EXPECT_NE(join.getChildren().at(1), cloneReference.getChildren().at(1));
Expand Down

0 comments on commit 33efc65

Please sign in to comment.