diff options
author | David Storch <david.storch@10gen.com> | 2016-08-12 15:58:56 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2016-08-18 11:14:17 -0400 |
commit | 26543060c852aac22f26143a04bf7789ec8fec53 (patch) | |
tree | df3ae49e5c4745058be29b7ec8a8e4b528b50a9a /src/mongo/s/query | |
parent | 13fa28982d008568f7620d73ddec0c61fad7cbc8 (diff) | |
download | mongo-26543060c852aac22f26143a04bf7789ec8fec53.tar.gz |
SERVER-24508 BSONObj::ComparatorInterface
BSONObj instances should now be compared via the comparator
interface's evaluate() method. This preferred over using
BSONObj::woCompare() directly. If the comparison doesn't
require any database semantics (e.g. there is no collation),
there is a global instance of the SimpleBSONObjComparator
which should be used for BSONObj comparisons. If the
comparison requires special semantics, then callers must
instantiate their own comparator object.
Diffstat (limited to 'src/mongo/s/query')
-rw-r--r-- | src/mongo/s/query/async_results_merger_test.cpp | 196 | ||||
-rw-r--r-- | src/mongo/s/query/cluster_client_cursor_impl_test.cpp | 16 | ||||
-rw-r--r-- | src/mongo/s/query/cluster_cursor_manager_test.cpp | 6 | ||||
-rw-r--r-- | src/mongo/s/query/router_stage_limit_test.cpp | 18 | ||||
-rw-r--r-- | src/mongo/s/query/router_stage_remove_sortkey_test.cpp | 22 | ||||
-rw-r--r-- | src/mongo/s/query/router_stage_skip_test.cpp | 24 | ||||
-rw-r--r-- | src/mongo/s/query/store_possible_cursor_test.cpp | 6 |
7 files changed, 149 insertions, 139 deletions
diff --git a/src/mongo/s/query/async_results_merger_test.cpp b/src/mongo/s/query/async_results_merger_test.cpp index e4d609cc88d..a0a8af6c1de 100644 --- a/src/mongo/s/query/async_results_merger_test.cpp +++ b/src/mongo/s/query/async_results_merger_test.cpp @@ -256,17 +256,17 @@ TEST_F(AsyncResultsMergerTest, ClusterFind) { ASSERT_TRUE(arm->remotesExhausted()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 3}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 3}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 4}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 4}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 5}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 5}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 6}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 6}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); ASSERT_TRUE(unittest::assertGet(arm->nextReady()).isEOF()); } @@ -291,17 +291,17 @@ TEST_F(AsyncResultsMergerTest, ClusterFindAndGetMore) { ASSERT_FALSE(arm->remotesExhausted()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 3}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 3}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 4}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 4}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 5}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 5}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 6}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 6}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_FALSE(arm->ready()); readyEvent = unittest::assertGet(arm->nextEvent()); @@ -321,13 +321,13 @@ TEST_F(AsyncResultsMergerTest, ClusterFindAndGetMore) { ASSERT_FALSE(arm->remotesExhausted()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 10}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 10}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 7}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 7}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 8}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 8}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 9}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 9}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_FALSE(arm->ready()); readyEvent = unittest::assertGet(arm->nextEvent()); @@ -343,7 +343,7 @@ TEST_F(AsyncResultsMergerTest, ClusterFindAndGetMore) { ASSERT_TRUE(arm->remotesExhausted()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 11}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 11}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); ASSERT_TRUE(unittest::assertGet(arm->nextReady()).isEOF()); } @@ -370,23 +370,23 @@ TEST_F(AsyncResultsMergerTest, ClusterFindSorted) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 3, $sortKey: {'': 3}}"), - *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 3, $sortKey: {'': 3}}"), + *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 4, $sortKey: {'': 4}}"), - *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 4, $sortKey: {'': 4}}"), + *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 5, $sortKey: {'': 5}}"), - *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 5, $sortKey: {'': 5}}"), + *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 6, $sortKey: {'': 6}}"), - *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 6, $sortKey: {'': 6}}"), + *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 8, $sortKey: {'': 8}}"), - *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 8, $sortKey: {'': 8}}"), + *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 9, $sortKey: {'': 9}}"), - *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 9, $sortKey: {'': 9}}"), + *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); ASSERT_TRUE(unittest::assertGet(arm->nextReady()).isEOF()); } @@ -413,13 +413,17 @@ TEST_F(AsyncResultsMergerTest, ClusterFindAndGetMoreSorted) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{$sortKey: {'': 3}}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{$sortKey: {'': 3}}"), + *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{$sortKey: {'': 4}}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{$sortKey: {'': 4}}"), + *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{$sortKey: {'': 5}}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{$sortKey: {'': 5}}"), + *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{$sortKey: {'': 6}}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{$sortKey: {'': 6}}"), + *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_FALSE(arm->ready()); readyEvent = unittest::assertGet(arm->nextEvent()); @@ -434,11 +438,14 @@ TEST_F(AsyncResultsMergerTest, ClusterFindAndGetMoreSorted) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{$sortKey: {'': 7}}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{$sortKey: {'': 7}}"), + *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{$sortKey: {'': 7}}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{$sortKey: {'': 7}}"), + *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{$sortKey: {'': 8}}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{$sortKey: {'': 8}}"), + *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_FALSE(arm->ready()); readyEvent = unittest::assertGet(arm->nextEvent()); @@ -453,11 +460,14 @@ TEST_F(AsyncResultsMergerTest, ClusterFindAndGetMoreSorted) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{$sortKey: {'': 9}}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{$sortKey: {'': 9}}"), + *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{$sortKey: {'': 10}}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{$sortKey: {'': 10}}"), + *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{$sortKey: {'': 10}}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{$sortKey: {'': 10}}"), + *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); ASSERT_TRUE(unittest::assertGet(arm->nextReady()).isEOF()); } @@ -484,23 +494,23 @@ TEST_F(AsyncResultsMergerTest, ClusterFindCompoundSortKey) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{$sortKey: {'': 10, '': 11}}"), - *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{$sortKey: {'': 10, '': 11}}"), + *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{$sortKey: {'': 10, '': 12}}"), - *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{$sortKey: {'': 10, '': 12}}"), + *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{$sortKey: {'': 5, '': 9}}"), - *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{$sortKey: {'': 5, '': 9}}"), + *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{$sortKey: {'': 5, '': 9}}"), - *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{$sortKey: {'': 5, '': 9}}"), + *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{$sortKey: {'': 4, '': 4}}"), - *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{$sortKey: {'': 4, '': 4}}"), + *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{$sortKey: {'': 4, '': 20}}"), - *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{$sortKey: {'': 4, '': 20}}"), + *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); ASSERT_TRUE(unittest::assertGet(arm->nextReady()).isEOF()); } @@ -561,7 +571,7 @@ TEST_F(AsyncResultsMergerTest, ClusterFindInitialBatchSizeIsZero) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_FALSE(arm->ready()); readyEvent = unittest::assertGet(arm->nextEvent()); @@ -584,7 +594,7 @@ TEST_F(AsyncResultsMergerTest, ClusterFindInitialBatchSizeIsZero) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); ASSERT_TRUE(unittest::assertGet(arm->nextReady()).isEOF()); } @@ -613,7 +623,7 @@ TEST_F(AsyncResultsMergerTest, ReceivedViewDefinitionFromShard) { auto outputPipeline = (*viewDef)["pipeline"]; ASSERT(!outputPipeline.eoo()); - ASSERT_EQ(fromjson(inputPipeline), outputPipeline.Obj()); + ASSERT_BSONOBJ_EQ(fromjson(inputPipeline), outputPipeline.Obj()); auto outputNs = (*viewDef)["ns"]; ASSERT(!outputNs.eoo()); @@ -637,13 +647,13 @@ TEST_F(AsyncResultsMergerTest, ExistingCursors) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 3}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 3}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 4}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 4}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); ASSERT(unittest::assertGet(arm->nextReady()).isEOF()); } @@ -667,13 +677,13 @@ TEST_F(AsyncResultsMergerTest, StreamResultsFromOneShardIfOtherDoesntRespond) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 3}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 3}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 4}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 4}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_FALSE(arm->ready()); readyEvent = unittest::assertGet(arm->nextEvent()); @@ -690,9 +700,9 @@ TEST_F(AsyncResultsMergerTest, StreamResultsFromOneShardIfOtherDoesntRespond) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 5}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 5}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 6}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 6}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_FALSE(arm->ready()); readyEvent = unittest::assertGet(arm->nextEvent()); @@ -707,9 +717,9 @@ TEST_F(AsyncResultsMergerTest, StreamResultsFromOneShardIfOtherDoesntRespond) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 7}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 7}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 8}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 8}"), *unittest::assertGet(arm->nextReady()).getResult()); // Kill cursor before deleting it, as the second remote cursor has not been exhausted. We don't // wait on 'killEvent' here, as the blackholed request's callback will only run on shutdown of @@ -734,11 +744,11 @@ TEST_F(AsyncResultsMergerTest, ErrorOnMismatchedCursorIds) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 3}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 3}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_FALSE(arm->ready()); readyEvent = unittest::assertGet(arm->nextEvent()); @@ -833,9 +843,9 @@ TEST_F(AsyncResultsMergerTest, ErrorCantScheduleEventBeforeLastSignaled) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); ASSERT_TRUE(unittest::assertGet(arm->nextReady()).isEOF()); @@ -940,7 +950,7 @@ TEST_F(AsyncResultsMergerTest, KillTwoOutstandingBatches) { << "testcoll" << "cursors" << BSON_ARRAY(CursorId(123))); - ASSERT_EQ(getFirstPendingRequest().cmdObj, expectedCmdObj); + ASSERT_BSONOBJ_EQ(getFirstPendingRequest().cmdObj, expectedCmdObj); // Ensure that we properly signal both those waiting for the kill, and those waiting for more // results to be ready. @@ -963,9 +973,9 @@ TEST_F(AsyncResultsMergerTest, KillOutstandingGetMore) { // First batch received. ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); // This will schedule a getMore on cursor id 123. ASSERT_FALSE(arm->ready()); @@ -987,7 +997,7 @@ TEST_F(AsyncResultsMergerTest, KillOutstandingGetMore) { << "testcoll" << "cursors" << BSON_ARRAY(CursorId(123))); - ASSERT_EQ(getFirstPendingRequest().cmdObj, expectedCmdObj); + ASSERT_BSONOBJ_EQ(getFirstPendingRequest().cmdObj, expectedCmdObj); // Ensure that we properly signal both those waiting for the kill, and those waiting for more // results to be ready. @@ -1042,9 +1052,9 @@ TEST_F(AsyncResultsMergerTest, TailableBasic) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); // In the tailable case, we expect EOF after every batch. ASSERT_TRUE(arm->ready()); @@ -1064,7 +1074,7 @@ TEST_F(AsyncResultsMergerTest, TailableBasic) { ASSERT_TRUE(arm->ready()); ASSERT_FALSE(arm->remotesExhausted()); - ASSERT_EQ(fromjson("{_id: 3}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 3}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); ASSERT_TRUE(unittest::assertGet(arm->nextReady()).isEOF()); ASSERT_FALSE(arm->remotesExhausted()); @@ -1136,9 +1146,9 @@ TEST_F(AsyncResultsMergerTest, GetMoreBatchSizes) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_FALSE(arm->ready()); responses.clear(); @@ -1157,7 +1167,7 @@ TEST_F(AsyncResultsMergerTest, GetMoreBatchSizes) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 3}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 3}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); ASSERT_TRUE(unittest::assertGet(arm->nextReady()).isEOF()); } @@ -1172,7 +1182,7 @@ TEST_F(AsyncResultsMergerTest, SendsSecondaryOkAsMetadata) { ASSERT_FALSE(arm->ready()); BSONObj cmdRequestMetadata = getFirstPendingRequest().metadata; - ASSERT_EQ(cmdRequestMetadata, rpc::ServerSelectionMetadata(true, boost::none).toBSON()); + ASSERT_BSONOBJ_EQ(cmdRequestMetadata, rpc::ServerSelectionMetadata(true, boost::none).toBSON()); std::vector<CursorResponse> responses; std::vector<BSONObj> batch1 = {fromjson("{_id: 1}")}; @@ -1181,7 +1191,7 @@ TEST_F(AsyncResultsMergerTest, SendsSecondaryOkAsMetadata) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); ASSERT_TRUE(unittest::assertGet(arm->nextReady()).isEOF()); } @@ -1209,9 +1219,9 @@ TEST_F(AsyncResultsMergerTest, AllowPartialResults) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_FALSE(arm->ready()); readyEvent = unittest::assertGet(arm->nextEvent()); @@ -1230,7 +1240,7 @@ TEST_F(AsyncResultsMergerTest, AllowPartialResults) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 3}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 3}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_FALSE(arm->ready()); readyEvent = unittest::assertGet(arm->nextEvent()); @@ -1263,9 +1273,9 @@ TEST_F(AsyncResultsMergerTest, AllowPartialResultsSingleNode) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_FALSE(arm->ready()); readyEvent = unittest::assertGet(arm->nextEvent()); @@ -1301,7 +1311,7 @@ TEST_F(AsyncResultsMergerTest, RetryOnNotMasterNoSlaveOkSingleNode) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->remotesExhausted()); ASSERT_TRUE(arm->ready()); @@ -1364,7 +1374,7 @@ TEST_F(AsyncResultsMergerTest, RetryOnHostUnreachableAllowPartialResults) { ASSERT_TRUE(arm->ready()); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->remotesExhausted()); ASSERT_TRUE(arm->ready()); @@ -1385,7 +1395,7 @@ TEST_F(AsyncResultsMergerTest, GetMoreRequestIncludesMaxTimeMS) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 1}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); ASSERT_TRUE(unittest::assertGet(arm->nextReady()).isEOF()); @@ -1400,7 +1410,7 @@ TEST_F(AsyncResultsMergerTest, GetMoreRequestIncludesMaxTimeMS) { << "testcoll" << "maxTimeMS" << 789); - ASSERT_EQ(getFirstPendingRequest().cmdObj, expectedCmdObj); + ASSERT_BSONOBJ_EQ(getFirstPendingRequest().cmdObj, expectedCmdObj); responses.clear(); std::vector<BSONObj> batch2 = {fromjson("{_id: 2}")}; @@ -1410,7 +1420,7 @@ TEST_F(AsyncResultsMergerTest, GetMoreRequestIncludesMaxTimeMS) { executor()->waitForEvent(readyEvent); ASSERT_TRUE(arm->ready()); - ASSERT_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 2}"), *unittest::assertGet(arm->nextReady()).getResult()); ASSERT_TRUE(arm->ready()); ASSERT_TRUE(unittest::assertGet(arm->nextReady()).isEOF()); } diff --git a/src/mongo/s/query/cluster_client_cursor_impl_test.cpp b/src/mongo/s/query/cluster_client_cursor_impl_test.cpp index 06a193f3298..0b87488e651 100644 --- a/src/mongo/s/query/cluster_client_cursor_impl_test.cpp +++ b/src/mongo/s/query/cluster_client_cursor_impl_test.cpp @@ -53,7 +53,7 @@ TEST(ClusterClientCursorImpl, NumReturnedSoFar) { for (int i = 1; i < 10; ++i) { auto result = cursor.next(); ASSERT(result.isOK()); - ASSERT_EQ(*result.getValue().getResult(), BSON("a" << i)); + ASSERT_BSONOBJ_EQ(*result.getValue().getResult(), BSON("a" << i)); ASSERT_EQ(cursor.getNumReturnedSoFar(), i); } // Now check that if nothing is fetched the getNumReturnedSoFar stays the same. @@ -73,7 +73,7 @@ TEST(ClusterClientCursorImpl, QueueResult) { auto firstResult = cursor.next(); ASSERT_OK(firstResult.getStatus()); ASSERT(firstResult.getValue().getResult()); - ASSERT_EQ(*firstResult.getValue().getResult(), BSON("a" << 1)); + ASSERT_BSONOBJ_EQ(*firstResult.getValue().getResult(), BSON("a" << 1)); cursor.queueResult(BSON("a" << 2)); cursor.queueResult(BSON("a" << 3)); @@ -81,17 +81,17 @@ TEST(ClusterClientCursorImpl, QueueResult) { auto secondResult = cursor.next(); ASSERT_OK(secondResult.getStatus()); ASSERT(secondResult.getValue().getResult()); - ASSERT_EQ(*secondResult.getValue().getResult(), BSON("a" << 2)); + ASSERT_BSONOBJ_EQ(*secondResult.getValue().getResult(), BSON("a" << 2)); auto thirdResult = cursor.next(); ASSERT_OK(thirdResult.getStatus()); ASSERT(thirdResult.getValue().getResult()); - ASSERT_EQ(*thirdResult.getValue().getResult(), BSON("a" << 3)); + ASSERT_BSONOBJ_EQ(*thirdResult.getValue().getResult(), BSON("a" << 3)); auto fourthResult = cursor.next(); ASSERT_OK(fourthResult.getStatus()); ASSERT(fourthResult.getValue().getResult()); - ASSERT_EQ(*fourthResult.getValue().getResult(), BSON("a" << 4)); + ASSERT_BSONOBJ_EQ(*fourthResult.getValue().getResult(), BSON("a" << 4)); auto fifthResult = cursor.next(); ASSERT_OK(fifthResult.getStatus()); @@ -118,7 +118,7 @@ TEST(ClusterClientCursorImpl, CursorPropagatesViewDefinition) { ASSERT_OK(result.getStatus()); ASSERT(!result.getValue().getResult()); ASSERT(result.getValue().getViewDefinition()); - ASSERT_EQ(*result.getValue().getViewDefinition(), viewDef); + ASSERT_BSONOBJ_EQ(*result.getValue().getViewDefinition(), viewDef); } TEST(ClusterClientCursorImpl, RemotesExhausted) { @@ -133,13 +133,13 @@ TEST(ClusterClientCursorImpl, RemotesExhausted) { auto firstResult = cursor.next(); ASSERT_OK(firstResult.getStatus()); ASSERT(firstResult.getValue().getResult()); - ASSERT_EQ(*firstResult.getValue().getResult(), BSON("a" << 1)); + ASSERT_BSONOBJ_EQ(*firstResult.getValue().getResult(), BSON("a" << 1)); ASSERT_TRUE(cursor.remotesExhausted()); auto secondResult = cursor.next(); ASSERT_OK(secondResult.getStatus()); ASSERT(secondResult.getValue().getResult()); - ASSERT_EQ(*secondResult.getValue().getResult(), BSON("a" << 2)); + ASSERT_BSONOBJ_EQ(*secondResult.getValue().getResult(), BSON("a" << 2)); ASSERT_TRUE(cursor.remotesExhausted()); auto thirdResult = cursor.next(); diff --git a/src/mongo/s/query/cluster_cursor_manager_test.cpp b/src/mongo/s/query/cluster_cursor_manager_test.cpp index 3cb88e9a813..b12b332375b 100644 --- a/src/mongo/s/query/cluster_cursor_manager_test.cpp +++ b/src/mongo/s/query/cluster_cursor_manager_test.cpp @@ -118,7 +118,7 @@ TEST_F(ClusterCursorManagerTest, RegisterCursor) { auto nextResult = pinnedCursor.getValue().next(); ASSERT_OK(nextResult.getStatus()); ASSERT(nextResult.getValue().getResult()); - ASSERT_EQ(BSON("a" << 1), *nextResult.getValue().getResult()); + ASSERT_BSONOBJ_EQ(BSON("a" << 1), *nextResult.getValue().getResult()); nextResult = pinnedCursor.getValue().next(); ASSERT_OK(nextResult.getStatus()); ASSERT_TRUE(nextResult.getValue().isEOF()); @@ -149,7 +149,7 @@ TEST_F(ClusterCursorManagerTest, CheckOutCursorBasic) { auto nextResult = checkedOutCursor.getValue().next(); ASSERT_OK(nextResult.getStatus()); ASSERT(nextResult.getValue().getResult()); - ASSERT_EQ(BSON("a" << 1), *nextResult.getValue().getResult()); + ASSERT_BSONOBJ_EQ(BSON("a" << 1), *nextResult.getValue().getResult()); nextResult = checkedOutCursor.getValue().next(); ASSERT_OK(nextResult.getStatus()); ASSERT_TRUE(nextResult.getValue().isEOF()); @@ -175,7 +175,7 @@ TEST_F(ClusterCursorManagerTest, CheckOutCursorMultipleCursors) { auto nextResult = pinnedCursor.getValue().next(); ASSERT_OK(nextResult.getStatus()); ASSERT(nextResult.getValue().getResult()); - ASSERT_EQ(BSON("a" << i), *nextResult.getValue().getResult()); + ASSERT_BSONOBJ_EQ(BSON("a" << i), *nextResult.getValue().getResult()); nextResult = pinnedCursor.getValue().next(); ASSERT_OK(nextResult.getStatus()); ASSERT_TRUE(nextResult.getValue().isEOF()); diff --git a/src/mongo/s/query/router_stage_limit_test.cpp b/src/mongo/s/query/router_stage_limit_test.cpp index 658b6b4d48d..11c245f67ec 100644 --- a/src/mongo/s/query/router_stage_limit_test.cpp +++ b/src/mongo/s/query/router_stage_limit_test.cpp @@ -51,7 +51,7 @@ TEST(RouterStageLimitTest, LimitIsOne) { auto firstResult = limitStage->next(); ASSERT_OK(firstResult.getStatus()); ASSERT(firstResult.getValue().getResult()); - ASSERT_EQ(*firstResult.getValue().getResult(), BSON("a" << 1)); + ASSERT_BSONOBJ_EQ(*firstResult.getValue().getResult(), BSON("a" << 1)); auto secondResult = limitStage->next(); ASSERT_OK(secondResult.getStatus()); @@ -74,12 +74,12 @@ TEST(RouterStageLimitTest, LimitIsTwo) { auto firstResult = limitStage->next(); ASSERT_OK(firstResult.getStatus()); ASSERT(firstResult.getValue().getResult()); - ASSERT_EQ(*firstResult.getValue().getResult(), BSON("a" << 1)); + ASSERT_BSONOBJ_EQ(*firstResult.getValue().getResult(), BSON("a" << 1)); auto secondResult = limitStage->next(); ASSERT_OK(secondResult.getStatus()); ASSERT(firstResult.getValue().getResult()); - ASSERT_EQ(*secondResult.getValue().getResult(), BSON("a" << 2)); + ASSERT_BSONOBJ_EQ(*secondResult.getValue().getResult(), BSON("a" << 2)); auto thirdResult = limitStage->next(); ASSERT_OK(thirdResult.getStatus()); @@ -98,7 +98,7 @@ TEST(RouterStageLimitTest, LimitStagePropagatesError) { auto firstResult = limitStage->next(); ASSERT_OK(firstResult.getStatus()); ASSERT(firstResult.getValue().getResult()); - ASSERT_EQ(*firstResult.getValue().getResult(), BSON("a" << 1)); + ASSERT_BSONOBJ_EQ(*firstResult.getValue().getResult(), BSON("a" << 1)); auto secondResult = limitStage->next(); ASSERT_NOT_OK(secondResult.getStatus()); @@ -124,7 +124,7 @@ TEST(RouterStageLimitTest, LimitStagePropagatesViewDefinition) { ASSERT_OK(result.getStatus()); ASSERT(!result.getValue().getResult()); ASSERT(result.getValue().getViewDefinition()); - ASSERT_EQ(*result.getValue().getViewDefinition(), viewDef); + ASSERT_BSONOBJ_EQ(*result.getValue().getViewDefinition(), viewDef); } TEST(RouterStageLimitTest, LimitStageToleratesMidStreamEOF) { @@ -142,7 +142,7 @@ TEST(RouterStageLimitTest, LimitStageToleratesMidStreamEOF) { auto firstResult = limitStage->next(); ASSERT_OK(firstResult.getStatus()); ASSERT(firstResult.getValue().getResult()); - ASSERT_EQ(*firstResult.getValue().getResult(), BSON("a" << 1)); + ASSERT_BSONOBJ_EQ(*firstResult.getValue().getResult(), BSON("a" << 1)); auto secondResult = limitStage->next(); ASSERT_OK(secondResult.getStatus()); @@ -151,7 +151,7 @@ TEST(RouterStageLimitTest, LimitStageToleratesMidStreamEOF) { auto thirdResult = limitStage->next(); ASSERT_OK(thirdResult.getStatus()); ASSERT(thirdResult.getValue().getResult()); - ASSERT_EQ(*thirdResult.getValue().getResult(), BSON("a" << 2)); + ASSERT_BSONOBJ_EQ(*thirdResult.getValue().getResult(), BSON("a" << 2)); auto fourthResult = limitStage->next(); ASSERT_OK(fourthResult.getStatus()); @@ -170,13 +170,13 @@ TEST(RouterStageLimitTest, LimitStageRemotesExhausted) { auto firstResult = limitStage->next(); ASSERT_OK(firstResult.getStatus()); ASSERT(firstResult.getValue().getResult()); - ASSERT_EQ(*firstResult.getValue().getResult(), BSON("a" << 1)); + ASSERT_BSONOBJ_EQ(*firstResult.getValue().getResult(), BSON("a" << 1)); ASSERT_TRUE(limitStage->remotesExhausted()); auto secondResult = limitStage->next(); ASSERT_OK(secondResult.getStatus()); ASSERT(secondResult.getValue().getResult()); - ASSERT_EQ(*secondResult.getValue().getResult(), BSON("a" << 2)); + ASSERT_BSONOBJ_EQ(*secondResult.getValue().getResult(), BSON("a" << 2)); ASSERT_TRUE(limitStage->remotesExhausted()); auto thirdResult = limitStage->next(); diff --git a/src/mongo/s/query/router_stage_remove_sortkey_test.cpp b/src/mongo/s/query/router_stage_remove_sortkey_test.cpp index ad6ee3f55a2..d8e1f51605d 100644 --- a/src/mongo/s/query/router_stage_remove_sortkey_test.cpp +++ b/src/mongo/s/query/router_stage_remove_sortkey_test.cpp @@ -53,24 +53,24 @@ TEST(RouterStageRemoveSortKeyTest, RemovesSortKey) { auto firstResult = sortKeyStage->next(); ASSERT_OK(firstResult.getStatus()); ASSERT(firstResult.getValue().getResult()); - ASSERT_EQ(*firstResult.getValue().getResult(), BSON("a" << 4 << "b" << 3)); + ASSERT_BSONOBJ_EQ(*firstResult.getValue().getResult(), BSON("a" << 4 << "b" << 3)); auto secondResult = sortKeyStage->next(); ASSERT_OK(secondResult.getStatus()); ASSERT(secondResult.getValue().getResult()); - ASSERT_EQ(*secondResult.getValue().getResult(), - BSON("c" << BSON("d" - << "foo"))); + ASSERT_BSONOBJ_EQ(*secondResult.getValue().getResult(), + BSON("c" << BSON("d" + << "foo"))); auto thirdResult = sortKeyStage->next(); ASSERT_OK(thirdResult.getStatus()); ASSERT(thirdResult.getValue().getResult()); - ASSERT_EQ(*thirdResult.getValue().getResult(), BSON("a" << 3)); + ASSERT_BSONOBJ_EQ(*thirdResult.getValue().getResult(), BSON("a" << 3)); auto fourthResult = sortKeyStage->next(); ASSERT_OK(fourthResult.getStatus()); ASSERT(fourthResult.getValue().getResult()); - ASSERT_EQ(*fourthResult.getValue().getResult(), BSONObj()); + ASSERT_BSONOBJ_EQ(*fourthResult.getValue().getResult(), BSONObj()); auto fifthResult = sortKeyStage->next(); ASSERT_OK(fifthResult.getStatus()); @@ -87,7 +87,7 @@ TEST(RouterStageRemoveSortKeyTest, PropagatesError) { auto firstResult = sortKeyStage->next(); ASSERT_OK(firstResult.getStatus()); ASSERT(firstResult.getValue().getResult()); - ASSERT_EQ(*firstResult.getValue().getResult(), BSONObj()); + ASSERT_BSONOBJ_EQ(*firstResult.getValue().getResult(), BSONObj()); auto secondResult = sortKeyStage->next(); ASSERT_NOT_OK(secondResult.getStatus()); @@ -106,7 +106,7 @@ TEST(RouterStageRemoveSortKeyTest, ToleratesMidStreamEOF) { auto firstResult = sortKeyStage->next(); ASSERT_OK(firstResult.getStatus()); ASSERT(firstResult.getValue().getResult()); - ASSERT_EQ(*firstResult.getValue().getResult(), BSON("a" << 1 << "b" << 1)); + ASSERT_BSONOBJ_EQ(*firstResult.getValue().getResult(), BSON("a" << 1 << "b" << 1)); auto secondResult = sortKeyStage->next(); ASSERT_OK(secondResult.getStatus()); @@ -115,7 +115,7 @@ TEST(RouterStageRemoveSortKeyTest, ToleratesMidStreamEOF) { auto thirdResult = sortKeyStage->next(); ASSERT_OK(thirdResult.getStatus()); ASSERT(thirdResult.getValue().getResult()); - ASSERT_EQ(*thirdResult.getValue().getResult(), BSON("a" << 2 << "b" << 2)); + ASSERT_BSONOBJ_EQ(*thirdResult.getValue().getResult(), BSON("a" << 2 << "b" << 2)); auto fourthResult = sortKeyStage->next(); ASSERT_OK(fourthResult.getStatus()); @@ -134,13 +134,13 @@ TEST(RouterStageRemoveSortKeyTest, RemotesExhausted) { auto firstResult = sortKeyStage->next(); ASSERT_OK(firstResult.getStatus()); ASSERT(firstResult.getValue().getResult()); - ASSERT_EQ(*firstResult.getValue().getResult(), BSON("a" << 1 << "b" << 1)); + ASSERT_BSONOBJ_EQ(*firstResult.getValue().getResult(), BSON("a" << 1 << "b" << 1)); ASSERT_TRUE(sortKeyStage->remotesExhausted()); auto secondResult = sortKeyStage->next(); ASSERT_OK(secondResult.getStatus()); ASSERT(secondResult.getValue().getResult()); - ASSERT_EQ(*secondResult.getValue().getResult(), BSON("a" << 2 << "b" << 2)); + ASSERT_BSONOBJ_EQ(*secondResult.getValue().getResult(), BSON("a" << 2 << "b" << 2)); ASSERT_TRUE(sortKeyStage->remotesExhausted()); auto thirdResult = sortKeyStage->next(); diff --git a/src/mongo/s/query/router_stage_skip_test.cpp b/src/mongo/s/query/router_stage_skip_test.cpp index efd57eaf111..242a032375a 100644 --- a/src/mongo/s/query/router_stage_skip_test.cpp +++ b/src/mongo/s/query/router_stage_skip_test.cpp @@ -51,12 +51,12 @@ TEST(RouterStageSkipTest, SkipIsOne) { auto firstResult = skipStage->next(); ASSERT_OK(firstResult.getStatus()); ASSERT(firstResult.getValue().getResult()); - ASSERT_EQ(*firstResult.getValue().getResult(), BSON("a" << 2)); + ASSERT_BSONOBJ_EQ(*firstResult.getValue().getResult(), BSON("a" << 2)); auto secondResult = skipStage->next(); ASSERT_OK(secondResult.getStatus()); ASSERT(secondResult.getValue().getResult()); - ASSERT_EQ(*secondResult.getValue().getResult(), BSON("a" << 3)); + ASSERT_BSONOBJ_EQ(*secondResult.getValue().getResult(), BSON("a" << 3)); // Once end-of-stream is reached, the skip stage should keep returning boost::none. auto thirdResult = skipStage->next(); @@ -80,7 +80,7 @@ TEST(RouterStageSkipTest, SkipIsThree) { auto firstResult = skipStage->next(); ASSERT_OK(firstResult.getStatus()); ASSERT(firstResult.getValue().getResult()); - ASSERT_EQ(*firstResult.getValue().getResult(), BSON("a" << 4)); + ASSERT_BSONOBJ_EQ(*firstResult.getValue().getResult(), BSON("a" << 4)); auto secondResult = skipStage->next(); ASSERT_OK(secondResult.getStatus()); @@ -140,7 +140,7 @@ TEST(RouterStageSkipTest, ErrorAfterSkippingResults) { auto firstResult = skipStage->next(); ASSERT_OK(firstResult.getStatus()); ASSERT(firstResult.getValue().getResult()); - ASSERT_EQ(*firstResult.getValue().getResult(), BSON("a" << 3)); + ASSERT_BSONOBJ_EQ(*firstResult.getValue().getResult(), BSON("a" << 3)); auto secondResult = skipStage->next(); ASSERT_NOT_OK(secondResult.getStatus()); @@ -164,11 +164,11 @@ TEST(RouterStageSkipTest, SkipStagePropagatesViewDefinition) { ASSERT_OK(result.getStatus()); ASSERT(!result.getValue().getResult()); ASSERT(result.getValue().getViewDefinition()); - ASSERT_EQ(*result.getValue().getViewDefinition(), - BSON("ns" - << "view_ns" - << "pipeline" - << BSON_ARRAY(BSON("$match" << BSONNULL)))); + ASSERT_BSONOBJ_EQ(*result.getValue().getViewDefinition(), + BSON("ns" + << "view_ns" + << "pipeline" + << BSON_ARRAY(BSON("$match" << BSONNULL)))); } TEST(RouterStageSkipTest, SkipStageToleratesMidStreamEOF) { @@ -188,7 +188,7 @@ TEST(RouterStageSkipTest, SkipStageToleratesMidStreamEOF) { auto secondResult = skipStage->next(); ASSERT_OK(secondResult.getStatus()); ASSERT(secondResult.getValue().getResult()); - ASSERT_EQ(*secondResult.getValue().getResult(), BSON("a" << 3)); + ASSERT_BSONOBJ_EQ(*secondResult.getValue().getResult(), BSON("a" << 3)); auto thirdResult = skipStage->next(); ASSERT_OK(thirdResult.getStatus()); @@ -208,13 +208,13 @@ TEST(RouterStageSkipTest, SkipStageRemotesExhausted) { auto firstResult = skipStage->next(); ASSERT_OK(firstResult.getStatus()); ASSERT(firstResult.getValue().getResult()); - ASSERT_EQ(*firstResult.getValue().getResult(), BSON("a" << 2)); + ASSERT_BSONOBJ_EQ(*firstResult.getValue().getResult(), BSON("a" << 2)); ASSERT_TRUE(skipStage->remotesExhausted()); auto secondResult = skipStage->next(); ASSERT_OK(secondResult.getStatus()); ASSERT(secondResult.getValue().getResult()); - ASSERT_EQ(*secondResult.getValue().getResult(), BSON("a" << 3)); + ASSERT_BSONOBJ_EQ(*secondResult.getValue().getResult(), BSON("a" << 3)); ASSERT_TRUE(skipStage->remotesExhausted()); auto thirdResult = skipStage->next(); diff --git a/src/mongo/s/query/store_possible_cursor_test.cpp b/src/mongo/s/query/store_possible_cursor_test.cpp index 23a56a3e5f8..8591c500097 100644 --- a/src/mongo/s/query/store_possible_cursor_test.cpp +++ b/src/mongo/s/query/store_possible_cursor_test.cpp @@ -73,8 +73,8 @@ TEST_F(StorePossibleCursorTest, ReturnsValidCursorResponse) { ASSERT_EQ(nss.toString(), parsedOutgoingResponse.getValue().getNSS().toString()); ASSERT_EQ(0U, parsedOutgoingResponse.getValue().getCursorId()); ASSERT_EQ(2U, parsedOutgoingResponse.getValue().getBatch().size()); - ASSERT_EQ(fromjson("{_id: 1}"), parsedOutgoingResponse.getValue().getBatch()[0]); - ASSERT_EQ(fromjson("{_id: 2}"), parsedOutgoingResponse.getValue().getBatch()[1]); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 1}"), parsedOutgoingResponse.getValue().getBatch()[0]); + ASSERT_BSONOBJ_EQ(fromjson("{_id: 2}"), parsedOutgoingResponse.getValue().getBatch()[1]); } // Test that storePossibleCursor() propagates an error if it cannot parse the cursor response. @@ -97,7 +97,7 @@ TEST_F(StorePossibleCursorTest, PassesUpCommandResultIfItDoesNotDescribeACursor) nullptr, // TaskExecutor getManager()); ASSERT_OK(outgoingCursorResponse.getStatus()); - ASSERT_EQ(notACursorObj, outgoingCursorResponse.getValue()); + ASSERT_BSONOBJ_EQ(notACursorObj, outgoingCursorResponse.getValue()); } } // namespace |