Skip to content

Commit 03b8ed5

Browse files
martin-suchajul-stas
authored andcommitted
Display the query plans in case of failed test
The out was not helpful for understanding the failure of a test. Printing the query plans will help.
1 parent f90ab76 commit 03b8ed5

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

tests/src/unit/tests/test_load_balancing.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,21 @@ void populate_hosts(size_t count, const String& rack, const String& dc, HostMap*
7272
}
7373

7474
void verify_sequence(QueryPlan* qp, const Vector<size_t>& sequence) {
75+
Vector<Address> actual;
7576
Address received;
77+
size_t limit = 100;
78+
while (qp->compute_next(&received) && limit > 0) {
79+
limit--;
80+
actual.emplace_back(received);
81+
}
82+
if (limit == 0) {
83+
FAIL() << "Iteration limit exceeded";
84+
}
85+
Vector<Address> expected;
7686
for (Vector<size_t>::const_iterator it = sequence.begin(); it != sequence.end(); ++it) {
77-
ASSERT_TRUE(qp->compute_next(&received));
78-
EXPECT_EQ(addr_for_sequence(*it), received);
87+
expected.emplace_back(addr_for_sequence(*it));
7988
}
80-
EXPECT_FALSE(qp->compute_next(&received));
89+
EXPECT_EQ(expected, actual);
8190
}
8291

8392
typedef Map<Address, int> QueryCounts;

0 commit comments

Comments
 (0)