diff options
Diffstat (limited to 'src/mongo/db/repl/replication_coordinator_test_fixture.cpp')
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_test_fixture.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_test_fixture.cpp b/src/mongo/db/repl/replication_coordinator_test_fixture.cpp index 7f0b3799217..738626eabdc 100644 --- a/src/mongo/db/repl/replication_coordinator_test_fixture.cpp +++ b/src/mongo/db/repl/replication_coordinator_test_fixture.cpp @@ -61,6 +61,18 @@ ReplicaSetConfig ReplCoordTest::assertMakeRSConfig(const BSONObj& configBson) { return config; } +ReplicaSetConfig ReplCoordTest::assertMakeRSConfigV0(const BSONObj& configBson) { + return assertMakeRSConfig(addProtocolVersion(configBson, 0)); +} + +BSONObj ReplCoordTest::addProtocolVersion(const BSONObj& configDoc, int protocolVersion) { + BSONObjBuilder builder; + builder << "protocolVersion" << protocolVersion; + builder.appendElementsUnique(configDoc); + return builder.obj(); +} + + void ReplCoordTest::setUp() { _settings.replSet = "mySet/node1:12345,node2:54321"; } @@ -149,7 +161,12 @@ void ReplCoordTest::start(const HostAndPort& selfHost) { } void ReplCoordTest::assertStartSuccess(const BSONObj& configDoc, const HostAndPort& selfHost) { - start(configDoc, selfHost); + // Set default protocol version to 1. + if (!configDoc.hasField("protocolVersion")) { + start(addProtocolVersion(configDoc, 1), selfHost); + } else { + start(configDoc, selfHost); + } ASSERT_NE(MemberState::RS_STARTUP, getReplCoord()->getMemberState().s); } |