summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/query_planner_test_fixture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/query/query_planner_test_fixture.cpp')
-rw-r--r--src/mongo/db/query/query_planner_test_fixture.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/mongo/db/query/query_planner_test_fixture.cpp b/src/mongo/db/query/query_planner_test_fixture.cpp
index b9e25876ad6..ac32e0d262c 100644
--- a/src/mongo/db/query/query_planner_test_fixture.cpp
+++ b/src/mongo/db/query/query_planner_test_fixture.cpp
@@ -517,7 +517,8 @@ void QueryPlannerTest::assertNumSolutions(size_t expectSolutions) const {
}
str::stream ss;
ss << "expected " << expectSolutions << " solutions but got " << getNumSolutions()
- << " instead. solutions generated: " << '\n';
+ << " instead. Run with --verbose=vv to see reasons for mismatch. Solutions generated: "
+ << '\n';
dumpSolutions(ss);
FAIL(ss);
}
@@ -526,8 +527,15 @@ size_t QueryPlannerTest::numSolutionMatches(const std::string& solnJson) const {
BSONObj testSoln = fromjson(solnJson);
size_t matches = 0;
for (auto&& soln : solns) {
- if (QueryPlannerTestLib::solutionMatches(testSoln, soln->root(), relaxBoundsCheck)) {
+ auto matchStatus =
+ QueryPlannerTestLib::solutionMatches(testSoln, soln->root(), relaxBoundsCheck);
+ if (matchStatus.isOK()) {
++matches;
+ } else {
+ LOGV2_DEBUG(51551101,
+ 2,
+ "Mismatching solution: {reason}",
+ "reason"_attr = matchStatus.reason());
}
}
return matches;
@@ -540,7 +548,9 @@ void QueryPlannerTest::assertSolutionExists(const std::string& solnJson, size_t
}
str::stream ss;
ss << "expected " << numMatches << " matches for solution " << solnJson << " but got "
- << matches << " instead. all solutions generated: " << '\n';
+ << matches
+ << " instead. Run with --verbose=vv to see reasons for mismatch. All solutions generated: "
+ << '\n';
dumpSolutions(ss);
FAIL(ss);
}
@@ -558,7 +568,9 @@ void QueryPlannerTest::assertHasOneSolutionOf(const std::vector<std::string>& so
}
str::stream ss;
ss << "assertHasOneSolutionOf expected one matching solution"
- << " but got " << matches << " instead. all solutions generated: " << '\n';
+ << " but got " << matches
+ << " instead. Run with --verbose=vv to see reasons for mismatch. All solutions generated: "
+ << '\n';
dumpSolutions(ss);
FAIL(ss);
}