diff options
author | Ian Boros <ian.boros@10gen.com> | 2018-09-25 18:44:15 -0400 |
---|---|---|
committer | Ian Boros <ian.boros@10gen.com> | 2018-10-04 16:32:33 -0400 |
commit | e175f95a689b5ba63dbcf2af88ff6e0cfcde1a98 (patch) | |
tree | f6c2a75d4553d99397106adc626fc74e5498100d /src/mongo/db/query/query_planner_geo_test.cpp | |
parent | bfadbd1d340278e056547c9b94160e51410cfced (diff) | |
download | mongo-e175f95a689b5ba63dbcf2af88ff6e0cfcde1a98.tar.gz |
SERVER-36946 Tighter checks on bounds in query planner unit tests
Diffstat (limited to 'src/mongo/db/query/query_planner_geo_test.cpp')
-rw-r--r-- | src/mongo/db/query/query_planner_geo_test.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/mongo/db/query/query_planner_geo_test.cpp b/src/mongo/db/query/query_planner_geo_test.cpp index c4b883ca580..6059eb6b817 100644 --- a/src/mongo/db/query/query_planner_geo_test.cpp +++ b/src/mongo/db/query/query_planner_geo_test.cpp @@ -95,6 +95,10 @@ TEST_F(QueryPlannerTest, Basic2DCompound) { fromjson("{ loc: { $geoWithin: { $box : [[0, 0],[10, 10]] } }," "a: 'mouse' }")); assertNumSolutions(2U); + + // This query will generate complex bounds, so we relax the checks to make the test readable. + relaxBoundsCheckingToSubsetOnly(); + assertSolutionExists("{cscan: {dir: 1}}"); assertSolutionExists( "{fetch: {node: {ixscan: {pattern: {loc : '2d', a: 1}," @@ -1713,6 +1717,10 @@ TEST_F(QueryPlannerTest, 2dsphereNonNearWithInternalExprEqOverLeadingField) { runQuery( fromjson("{a: {$_internalExprEq: 0}, b: {$geoWithin: {$centerSphere: [[0, 0], 10]}}}")); + + // This query will generate complex bounds, so we relax the checks to make the test readable. + relaxBoundsCheckingToSubsetOnly(); + assertNumSolutions(1U); assertSolutionExists( "{fetch: {filter: {b: {$geoWithin: {$centerSphere: [[0, 0], 10]}}}, node: " @@ -1741,11 +1749,16 @@ TEST_F(QueryPlannerTest, 2dsphereNonNearWithInternalExprEqOverTrailingField) { runQuery( fromjson("{b: {$_internalExprEq: 0}, a: {$geoWithin: {$centerSphere: [[0, 0], 10]}}}")); + + // This query will generate complex bounds, so we relax the checks to make the test readable. + relaxBoundsCheckingToSubsetOnly(); + assertNumSolutions(1U); assertSolutionExists( "{fetch: {filter: {a: {$geoWithin: {$centerSphere: [[0, 0], 10]}}}, node: " "{ixscan: {pattern: {a : '2dsphere', b: 1}, filter: null, bounds:" - "{a: [], b: [[0,0,true,true]]}}}}}"); + "{a: []," // Complex, so leaving empty. + "b: [[0,0,true,true]]}}}}}"); } TEST_F(QueryPlannerTest, 2dsphereNonNearWithInternalExprEqOverTrailingFieldMultikey) { @@ -1759,11 +1772,16 @@ TEST_F(QueryPlannerTest, 2dsphereNonNearWithInternalExprEqOverTrailingFieldMulti runQuery( fromjson("{a: {$geoWithin: {$centerSphere: [[0, 0], 10]}}, b: {$_internalExprEq: 0}}")); + + // This query will generate complex bounds, so we relax the checks to make the test readable. + relaxBoundsCheckingToSubsetOnly(); + assertNumSolutions(1U); assertSolutionExists( "{fetch: {filter: {a: {$geoWithin: {$centerSphere: [[0,0],10]}}, b: {$_internalExprEq: 0}}," "node: {ixscan: {pattern: {a : '2dsphere', b: 1}, filter: null, bounds:" - "{a: [], b: [['MinKey','MaxKey',true,true]]}}}}}"); + "{a: []," // Complex, so leaving empty. + "b: [['MinKey','MaxKey',true,true]]}}}}}"); } TEST_F(QueryPlannerTest, 2dWithinPredicateOverTrailingFieldElemMatchMultikey) { |