diff options
author | Ali Mir <ali.mir@mongodb.com> | 2020-11-04 17:25:32 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-01-28 04:26:57 +0000 |
commit | 35a6a97338930d75a7f5cfd89671ae9af65aaf85 (patch) | |
tree | d0f026c6f06c0a38795fa4eaa56040d145034679 /src/mongo/db/repl/repl_set_config_test.cpp | |
parent | 5a5a75e4149faae8f1b6e95d60b84cc7f33d4e2b (diff) | |
download | mongo-35a6a97338930d75a7f5cfd89671ae9af65aaf85.tar.gz |
SERVER-50423 Change memberConfig's slaveDelay field to secondaryDelaySecs
Diffstat (limited to 'src/mongo/db/repl/repl_set_config_test.cpp')
-rw-r--r-- | src/mongo/db/repl/repl_set_config_test.cpp | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/src/mongo/db/repl/repl_set_config_test.cpp b/src/mongo/db/repl/repl_set_config_test.cpp index 16618f56cbf..2606bd06c42 100644 --- a/src/mongo/db/repl/repl_set_config_test.cpp +++ b/src/mongo/db/repl/repl_set_config_test.cpp @@ -820,6 +820,23 @@ TEST(ReplSetConfig, ValidateFailsWithDuplicateMemberId) { ASSERT_EQUALS(ErrorCodes::BadValue, status); } +TEST(ReplSetConfig, ValidateFailsWithBothDelaySecsFieldNames) { + ReplSetConfig config(ReplSetConfig::parse( + BSON("_id" + << "rs0" + << "protocolVersion" << 1 << "version" << 1 << "configsvr" << true << "members" + << BSON_ARRAY(BSON("_id" << 0 << "host" + << "localhost:12345") + << BSON("_id" << 1 << "host" + << "localhost:54321" + << "priority" << 0 << "secondaryDelaySecs" << 10 + << "slaveDelay" << 10))))); + Status status = config.validate(); + ASSERT_EQUALS(ErrorCodes::BadValue, status); + ASSERT_STRING_CONTAINS(status.reason(), + "Cannot specify both secondaryDelaySecs and slaveDelay"); +} + TEST(ReplSetConfig, InitializeFailsWithInvalidMember) { ReplSetConfig config; ASSERT_THROWS(ReplSetConfig::parse(BSON("_id" @@ -1255,7 +1272,7 @@ bool operator==(const MemberConfig& a, const MemberConfig& b) { } } return a.getId() == b.getId() && a.getHostAndPort() == b.getHostAndPort() && - a.getPriority() == b.getPriority() && a.getSlaveDelay() == b.getSlaveDelay() && + a.getPriority() == b.getPriority() && a.getSecondaryDelay() == b.getSecondaryDelay() && a.isVoter() == b.isVoter() && a.isArbiter() == b.isArbiter() && a.isNewlyAdded() == b.isNewlyAdded() && a.isHidden() == b.isHidden() && a.shouldBuildIndexes() == b.shouldBuildIndexes() && a.getNumTags() == b.getNumTags() && @@ -1365,8 +1382,8 @@ TEST(ReplSetConfig, toBSONRoundTripAbilityLarge) { << BSON("_id" << 3 << "host" << "localhost:3828" << "arbiterOnly" << false << "hidden" << true << "buildIndexes" - << false << "priority" << 0 << "slaveDelay" << 17 << "votes" - << 0 << "newlyAdded" << true << "tags" + << false << "priority" << 0 << "secondaryDelaySecs" << 17 + << "votes" << 0 << "newlyAdded" << true << "tags" << BSON("coast" << "east" << "ssd" @@ -1558,21 +1575,20 @@ TEST(ReplSetConfig, CheckConfigServerMustBuildIndexes) { ASSERT_STRING_CONTAINS(status.reason(), "must build indexes"); } -TEST(ReplSetConfig, CheckConfigServerCantHaveSlaveDelay) { +TEST(ReplSetConfig, CheckConfigServerCantHaveSecondaryDelaySecs) { ReplSetConfig configA; - configA = ReplSetConfig::parse(BSON("_id" - << "rs0" - << "protocolVersion" << 1 << "version" << 1 << "configsvr" - << true << "members" - << BSON_ARRAY(BSON("_id" << 0 << "host" - << "localhost:12345") - << BSON("_id" << 1 << "host" - << "localhost:54321" - << "priority" << 0 - << "slaveDelay" << 3)))); + configA = ReplSetConfig::parse( + BSON("_id" + << "rs0" + << "protocolVersion" << 1 << "version" << 1 << "configsvr" << true << "members" + << BSON_ARRAY(BSON("_id" << 0 << "host" + << "localhost:12345") + << BSON("_id" << 1 << "host" + << "localhost:54321" + << "priority" << 0 << "secondaryDelaySecs" << 3)))); Status status = configA.validate(); ASSERT_EQUALS(ErrorCodes::BadValue, status); - ASSERT_STRING_CONTAINS(status.reason(), "cannot have a non-zero slaveDelay"); + ASSERT_STRING_CONTAINS(status.reason(), "cannot have a non-zero secondaryDelaySecs"); } TEST(ReplSetConfig, CheckConfigServerMustHaveTrueForWriteConcernMajorityJournalDefault) { |