summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Paderin <apocarteres@gmail.com>2017-12-11 14:01:05 +0300
committerBenety Goh <benety@mongodb.com>2018-01-09 14:45:18 -0500
commit523531464b747daa2a25eea33ed42239db871622 (patch)
tree79f80172dbe590d0cd0436bb89b53a6fe462aceb
parent63f957d5a91d47bf42d4a9f2e5d89d38599ec1da (diff)
downloadmongo-523531464b747daa2a25eea33ed42239db871622.tar.gz
SERVER-32343 dbtest repl suite restores ReplicationCoordinator settings on tear down.
Closes #1193 Signed-off-by: Benety Goh <benety@mongodb.com>
-rw-r--r--src/mongo/dbtests/repltests.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp
index 302ddb28b5b..37e04a96a68 100644
--- a/src/mongo/dbtests/repltests.cpp
+++ b/src/mongo/dbtests/repltests.cpp
@@ -73,9 +73,11 @@ protected:
const ServiceContext::UniqueOperationContext _opCtxPtr = cc().makeOperationContext();
OperationContext& _opCtx = *_opCtxPtr;
mutable DBDirectClient _client;
+ ReplSettings _defaultReplSettings;
public:
- Base() : _client(&_opCtx) {
+ Base()
+ : _client(&_opCtx), _defaultReplSettings(getGlobalReplicationCoordinator()->getSettings()) {
ReplSettings replSettings;
replSettings.setOplogSizeBytes(10 * 1024 * 1024);
replSettings.setMaster(true);
@@ -107,10 +109,13 @@ public:
try {
deleteAll(ns());
deleteAll(cllNS());
- ReplSettings replSettings;
- replSettings.setOplogSizeBytes(10 * 1024 * 1024);
- setGlobalReplicationCoordinator(
- new repl::ReplicationCoordinatorMock(_opCtx.getServiceContext(), replSettings));
+ setGlobalReplicationCoordinator(new repl::ReplicationCoordinatorMock(
+ _opCtx.getServiceContext(), _defaultReplSettings));
+ repl::getGlobalReplicationCoordinator()
+ ->setFollowerMode(repl::MemberState::RS_PRIMARY)
+ .ignore();
+
+
} catch (...) {
FAIL("Exception while cleaning up test");
}