diff options
-rw-r--r-- | src/mongo/db/repl/abstract_oplog_fetcher_test_fixture.cpp | 39 | ||||
-rw-r--r-- | src/mongo/db/repl/initial_syncer_test.cpp | 21 | ||||
-rw-r--r-- | src/mongo/db/repl/multiapplier_test.cpp | 17 | ||||
-rw-r--r-- | src/mongo/db/repl/sync_source_resolver_test.cpp | 16 |
4 files changed, 79 insertions, 14 deletions
diff --git a/src/mongo/db/repl/abstract_oplog_fetcher_test_fixture.cpp b/src/mongo/db/repl/abstract_oplog_fetcher_test_fixture.cpp index ab818341712..6d729dd7857 100644 --- a/src/mongo/db/repl/abstract_oplog_fetcher_test_fixture.cpp +++ b/src/mongo/db/repl/abstract_oplog_fetcher_test_fixture.cpp @@ -37,6 +37,35 @@ namespace mongo { namespace repl { +namespace { + +/** + * Creates an OplogEntry using given field values. + */ +repl::OplogEntry makeOplogEntry(repl::OpTime opTime, + long long hash, + repl::OpTypeEnum opType, + NamespaceString nss, + BSONObj object) { + return repl::OplogEntry(opTime, // optime + hash, // hash + opType, // opType + nss, // namespace + boost::none, // uuid + boost::none, // fromMigrate + repl::OplogEntry::kOplogVersion, // version + object, // o + boost::none, // o2 + {}, // sessionInfo + boost::none, // wall clock time + boost::none, // statement id + boost::none, // optime of previous write within same transaction + boost::none, // pre-image optime + boost::none); // post-image optime +} + +} // namespace + ShutdownState::ShutdownState() = default; Status ShutdownState::getStatus() const { @@ -48,11 +77,11 @@ void ShutdownState::operator()(const Status& status) { } BSONObj AbstractOplogFetcherTest::makeNoopOplogEntry(OpTimeWithHash opTimeWithHash) { - return OplogEntry(opTimeWithHash.opTime, - opTimeWithHash.value, - OpTypeEnum::kNoop, - NamespaceString("test.t"), - BSONObj()) + return makeOplogEntry(opTimeWithHash.opTime, + opTimeWithHash.value, + OpTypeEnum::kNoop, + NamespaceString("test.t"), + BSONObj()) .toBSON(); } diff --git a/src/mongo/db/repl/initial_syncer_test.cpp b/src/mongo/db/repl/initial_syncer_test.cpp index 28a7954019c..9df6094127b 100644 --- a/src/mongo/db/repl/initial_syncer_test.cpp +++ b/src/mongo/db/repl/initial_syncer_test.cpp @@ -564,12 +564,21 @@ OplogEntry makeOplogEntry(int t, oField = BSON("dropIndexes" << "a_1"); } - return OplogEntry(OpTime(Timestamp(t, 1), 1), - static_cast<long long>(t), - opType, - NamespaceString("a.a"), - version, - oField); + return OplogEntry(OpTime(Timestamp(t, 1), 1), // optime + static_cast<long long>(t), // hash + opType, // op type + NamespaceString("a.a"), // namespace + boost::none, // uuid + boost::none, // fromMigrate + version, // version + oField, // o + boost::none, // o2 + {}, // sessionInfo + boost::none, // wall clock time + boost::none, // statement id + boost::none, // optime of previous write within same transaction + boost::none, // pre-image optime + boost::none); // post-image optime } BSONObj makeOplogEntryObj(int t, diff --git a/src/mongo/db/repl/multiapplier_test.cpp b/src/mongo/db/repl/multiapplier_test.cpp index 95e737bac0e..792f77be583 100644 --- a/src/mongo/db/repl/multiapplier_test.cpp +++ b/src/mongo/db/repl/multiapplier_test.cpp @@ -67,8 +67,21 @@ Status applyOperation(MultiApplier::OperationPtrs*) { * Generates oplog entries with the given number used for the timestamp. */ OplogEntry makeOplogEntry(int ts) { - return OplogEntry( - OpTime(Timestamp(ts, 1), 1), 1LL, OpTypeEnum::kNoop, NamespaceString("a.a"), BSONObj()); + return OplogEntry(OpTime(Timestamp(ts, 1), 1), // optime + 1LL, // hash + OpTypeEnum::kNoop, // op type + NamespaceString("a.a"), // namespace + boost::none, // uuid + boost::none, // fromMigrate + OplogEntry::kOplogVersion, // version + BSONObj(), // o + boost::none, // o2 + {}, // sessionInfo + boost::none, // wall clock time + boost::none, // statement id + boost::none, // optime of previous write within same transaction + boost::none, // pre-image optime + boost::none); // post-image optime } TEST_F(MultiApplierTest, InvalidConstruction) { diff --git a/src/mongo/db/repl/sync_source_resolver_test.cpp b/src/mongo/db/repl/sync_source_resolver_test.cpp index 77154e62ae6..c85aa6c832c 100644 --- a/src/mongo/db/repl/sync_source_resolver_test.cpp +++ b/src/mongo/db/repl/sync_source_resolver_test.cpp @@ -297,7 +297,21 @@ void _scheduleFirstOplogEntryFetcherResponse(executor::NetworkInterfaceMock* net * Generates oplog entries with the given optime. */ BSONObj _makeOplogEntry(Timestamp ts, long long term) { - return OplogEntry(OpTime(ts, term), 1LL, OpTypeEnum::kNoop, NamespaceString("a.a"), BSONObj()) + return OplogEntry(OpTime(ts, term), // optime + 1LL, // hash + OpTypeEnum::kNoop, // op type + NamespaceString("a.a"), // namespace + boost::none, // uuid + boost::none, // fromMigrate + repl::OplogEntry::kOplogVersion, // version + BSONObj(), // o + boost::none, // o2 + {}, // sessionInfo + boost::none, // wall clock time + boost::none, // statement id + boost::none, // optime of previous write within same transaction + boost::none, // pre-image optime + boost::none) // post-image optime .toBSON(); } |