diff options
author | Judah Schvimer <judah@mongodb.com> | 2017-08-07 12:04:10 -0400 |
---|---|---|
committer | Judah Schvimer <judah@mongodb.com> | 2017-08-07 12:04:10 -0400 |
commit | 8fa770baf8fac6e71a45f84b48eeb3bae96a8dab (patch) | |
tree | 1aa8c05c67c299e2459153f152c69b17457d62af /src/mongo/db/repl/replication_process_test.cpp | |
parent | b519114cb9bc72c17c60761cad369f2d8e18f472 (diff) | |
download | mongo-8fa770baf8fac6e71a45f84b48eeb3bae96a8dab.tar.gz |
SERVER-29893 Rename recovery code and make it accessible to both startup and rollback
Diffstat (limited to 'src/mongo/db/repl/replication_process_test.cpp')
-rw-r--r-- | src/mongo/db/repl/replication_process_test.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/mongo/db/repl/replication_process_test.cpp b/src/mongo/db/repl/replication_process_test.cpp index 8464b54906f..40a51312433 100644 --- a/src/mongo/db/repl/replication_process_test.cpp +++ b/src/mongo/db/repl/replication_process_test.cpp @@ -37,6 +37,7 @@ #include "mongo/db/repl/replication_coordinator.h" #include "mongo/db/repl/replication_coordinator_mock.h" #include "mongo/db/repl/replication_process.h" +#include "mongo/db/repl/replication_recovery_mock.h" #include "mongo/db/repl/storage_interface_impl.h" #include "mongo/db/repl/storage_interface_mock.h" #include "mongo/db/service_context.h" @@ -78,7 +79,8 @@ TEST_F(ReplicationProcessTest, ServiceContextDecorator) { ASSERT_FALSE(ReplicationProcess::get(serviceContext)); ReplicationProcess* replicationProcess = new ReplicationProcess( _storageInterface.get(), - stdx::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get())); + stdx::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get()), + stdx::make_unique<ReplicationRecoveryMock>()); ReplicationProcess::set(serviceContext, std::unique_ptr<ReplicationProcess>(replicationProcess)); ASSERT_TRUE(replicationProcess == ReplicationProcess::get(serviceContext)); @@ -90,7 +92,8 @@ TEST_F(ReplicationProcessTest, GetRollbackProgressReturnsNoSuchKeyIfDocumentWithIdProgressIsNotFound) { ReplicationProcess replicationProcess( _storageInterface.get(), - stdx::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get())); + stdx::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get()), + stdx::make_unique<ReplicationRecoveryMock>()); // Collection is not found. auto opCtx = makeOpCtx(); @@ -126,7 +129,8 @@ TEST_F(ReplicationProcessTest, GetRollbackProgressReturnsBadStatusIfApplyUntilFi ReplicationProcess replicationProcess( _storageInterface.get(), - stdx::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get())); + stdx::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get()), + stdx::make_unique<ReplicationRecoveryMock>()); ASSERT_EQUALS(ErrorCodes::TypeMismatch, replicationProcess.getRollbackProgress(opCtx.get())); } @@ -147,7 +151,8 @@ TEST_F(ReplicationProcessTest, ReplicationProcess replicationProcess( _storageInterface.get(), - stdx::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get())); + stdx::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get()), + stdx::make_unique<ReplicationRecoveryMock>()); ASSERT_EQUALS(ErrorCodes::TypeMismatch, replicationProcess.getRollbackProgress(opCtx.get())); } @@ -166,7 +171,8 @@ TEST_F(ReplicationProcessTest, ReplicationProcess replicationProcess( _storageInterface.get(), - stdx::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get())); + stdx::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get()), + stdx::make_unique<ReplicationRecoveryMock>()); ASSERT_EQUALS(applyUntil, unittest::assertGet(replicationProcess.getRollbackProgress(opCtx.get()))); @@ -181,7 +187,8 @@ TEST_F(ReplicationProcessTest, auto opCtx = makeOpCtx(); ReplicationProcess replicationProcess( _storageInterface.get(), - stdx::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get())); + stdx::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get()), + stdx::make_unique<ReplicationRecoveryMock>()); ASSERT_OK(replicationProcess.setRollbackProgress(opCtx.get(), applyUntil)); ASSERT_EQUALS(1U, unittest::assertGet(_storageInterface->getCollectionCount( @@ -199,7 +206,8 @@ TEST_F(ReplicationProcessTest, auto opCtx = makeOpCtx(); ReplicationProcess replicationProcess( _storageInterface.get(), - stdx::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get())); + stdx::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get()), + stdx::make_unique<ReplicationRecoveryMock>()); ASSERT_EQUALS(ErrorCodes::IllegalOperation, replicationProcess.setRollbackProgress(opCtx.get(), applyUntil)); } @@ -208,7 +216,8 @@ TEST_F(ReplicationProcessTest, ClearRollbackProgressReturnsSuccessIfCollectionDo auto opCtx = makeOpCtx(); ReplicationProcess replicationProcess( _storageInterface.get(), - stdx::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get())); + stdx::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get()), + stdx::make_unique<ReplicationRecoveryMock>()); ASSERT_OK(replicationProcess.clearRollbackProgress(opCtx.get())); } @@ -220,7 +229,8 @@ TEST_F(ReplicationProcessTest, auto opCtx = makeOpCtx(); ReplicationProcess replicationProcess( _storageInterface.get(), - stdx::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get())); + stdx::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get()), + stdx::make_unique<ReplicationRecoveryMock>()); ASSERT_EQUALS(ErrorCodes::IllegalOperation, replicationProcess.clearRollbackProgress(opCtx.get())); } |