summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/roll_back_local_operations_test.cpp
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2016-08-12 15:58:56 -0400
committerDavid Storch <david.storch@10gen.com>2016-08-18 11:14:17 -0400
commit26543060c852aac22f26143a04bf7789ec8fec53 (patch)
treedf3ae49e5c4745058be29b7ec8a8e4b528b50a9a /src/mongo/db/repl/roll_back_local_operations_test.cpp
parent13fa28982d008568f7620d73ddec0c61fad7cbc8 (diff)
downloadmongo-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/db/repl/roll_back_local_operations_test.cpp')
-rw-r--r--src/mongo/db/repl/roll_back_local_operations_test.cpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/mongo/db/repl/roll_back_local_operations_test.cpp b/src/mongo/db/repl/roll_back_local_operations_test.cpp
index 87e888a62d0..03abb00dfb2 100644
--- a/src/mongo/db/repl/roll_back_local_operations_test.cpp
+++ b/src/mongo/db/repl/roll_back_local_operations_test.cpp
@@ -100,7 +100,7 @@ TEST(RollBackLocalOperationsTest, RollbackMultipleLocalOperations) {
OplogInterfaceMock localOplog(localOperations);
auto i = localOperations.cbegin();
auto rollbackOperation = [&](const BSONObj& operation) {
- ASSERT_EQUALS(i->first, operation);
+ ASSERT_BSONOBJ_EQ(i->first, operation);
i++;
return Status::OK();
};
@@ -110,7 +110,7 @@ TEST(RollBackLocalOperationsTest, RollbackMultipleLocalOperations) {
ASSERT_EQUALS(commonOperation.first["ts"].timestamp(), result.getValue().first);
ASSERT_EQUALS(commonOperation.second, result.getValue().second);
ASSERT_FALSE(i == localOperations.cend());
- ASSERT_EQUALS(commonOperation.first, i->first);
+ ASSERT_BSONOBJ_EQ(commonOperation.first, i->first);
i++;
ASSERT_TRUE(i == localOperations.cend());
}
@@ -148,7 +148,7 @@ TEST(RollBackLocalOperationsTest, SkipRemoteOperations) {
OplogInterfaceMock localOplog(localOperations);
auto i = localOperations.cbegin();
auto rollbackOperation = [&](const BSONObj& operation) {
- ASSERT_EQUALS(i->first, operation);
+ ASSERT_BSONOBJ_EQ(i->first, operation);
i++;
return Status::OK();
};
@@ -168,7 +168,7 @@ TEST(RollBackLocalOperationsTest, SkipRemoteOperations) {
ASSERT_EQUALS(commonOperation.first["ts"].timestamp(), result.getValue().first);
ASSERT_EQUALS(commonOperation.second, result.getValue().second);
ASSERT_FALSE(i == localOperations.cend());
- ASSERT_EQUALS(commonOperation.first, i->first);
+ ASSERT_BSONOBJ_EQ(commonOperation.first, i->first);
i++;
ASSERT_TRUE(i == localOperations.cend());
}
@@ -181,7 +181,7 @@ TEST(RollBackLocalOperationsTest, SameTimestampDifferentHashess) {
OplogInterfaceMock localOplog(localOperations);
auto i = localOperations.cbegin();
auto rollbackOperation = [&](const BSONObj& operation) {
- ASSERT_EQUALS(i->first, operation);
+ ASSERT_BSONOBJ_EQ(i->first, operation);
i++;
return Status::OK();
};
@@ -201,7 +201,7 @@ TEST(RollBackLocalOperationsTest, SameTimestampDifferentHashess) {
ASSERT_EQUALS(commonOperation.first["ts"].timestamp(), result.getValue().first);
ASSERT_EQUALS(commonOperation.second, result.getValue().second);
ASSERT_FALSE(i == localOperations.cend());
- ASSERT_EQUALS(commonOperation.first, i->first);
+ ASSERT_BSONOBJ_EQ(commonOperation.first, i->first);
i++;
ASSERT_TRUE(i == localOperations.cend());
}
@@ -266,7 +266,7 @@ TEST(SyncRollBackLocalOperationsTest, RollbackTwoOperations) {
auto result = syncRollBackLocalOperations(OplogInterfaceMock(localOperations),
OplogInterfaceMock({commonOperation}),
[&](const BSONObj& operation) {
- ASSERT_EQUALS(i->first, operation);
+ ASSERT_BSONOBJ_EQ(i->first, operation);
i++;
return Status::OK();
});
@@ -274,7 +274,7 @@ TEST(SyncRollBackLocalOperationsTest, RollbackTwoOperations) {
ASSERT_EQUALS(commonOperation.first["ts"].timestamp(), result.getValue().first);
ASSERT_EQUALS(commonOperation.second, result.getValue().second);
ASSERT_FALSE(i == localOperations.cend());
- ASSERT_EQUALS(commonOperation.first, i->first);
+ ASSERT_BSONOBJ_EQ(commonOperation.first, i->first);
i++;
ASSERT_TRUE(i == localOperations.cend());
}
@@ -303,7 +303,7 @@ TEST(SyncRollBackLocalOperationsTest, SameTimestampDifferentHashes) {
syncRollBackLocalOperations(OplogInterfaceMock({localOperation, commonOperation}),
OplogInterfaceMock({remoteOperation, commonOperation}),
[&](const BSONObj& operation) {
- ASSERT_EQUALS(localOperation.first, operation);
+ ASSERT_BSONOBJ_EQ(localOperation.first, operation);
called = true;
return Status::OK();
});
@@ -322,7 +322,7 @@ TEST(SyncRollBackLocalOperationsTest, SameTimestampEndOfLocalOplog) {
syncRollBackLocalOperations(OplogInterfaceMock({localOperation}),
OplogInterfaceMock({remoteOperation, commonOperation}),
[&](const BSONObj& operation) {
- ASSERT_EQUALS(localOperation.first, operation);
+ ASSERT_BSONOBJ_EQ(localOperation.first, operation);
called = true;
return Status::OK();
});
@@ -348,13 +348,14 @@ TEST(SyncRollBackLocalOperationsTest, SameTimestampEndOfRemoteOplog) {
auto localOperation = makeOpAndRecordId(1, 2);
auto remoteOperation = makeOpAndRecordId(1, 3);
bool called = false;
- auto result = syncRollBackLocalOperations(OplogInterfaceMock({localOperation, commonOperation}),
- OplogInterfaceMock({remoteOperation}),
- [&](const BSONObj& operation) {
- ASSERT_EQUALS(localOperation.first, operation);
- called = true;
- return Status::OK();
- });
+ auto result =
+ syncRollBackLocalOperations(OplogInterfaceMock({localOperation, commonOperation}),
+ OplogInterfaceMock({remoteOperation}),
+ [&](const BSONObj& operation) {
+ ASSERT_BSONOBJ_EQ(localOperation.first, operation);
+ called = true;
+ return Status::OK();
+ });
ASSERT_EQUALS(ErrorCodes::NoMatchingDocument, result.getStatus().code());
ASSERT_STRING_CONTAINS(result.getStatus().reason(), "RS100 reached beginning of remote oplog");
ASSERT_TRUE(called);
@@ -369,7 +370,7 @@ TEST(SyncRollBackLocalOperationsTest, DifferentTimestampEndOfLocalOplog) {
syncRollBackLocalOperations(OplogInterfaceMock({localOperation}),
OplogInterfaceMock({remoteOperation, commonOperation}),
[&](const BSONObj& operation) {
- ASSERT_EQUALS(localOperation.first, operation);
+ ASSERT_BSONOBJ_EQ(localOperation.first, operation);
called = true;
return Status::OK();
});