diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/s/catalog/sharding_catalog_add_shard_test.cpp | 61 |
1 files changed, 29 insertions, 32 deletions
diff --git a/src/mongo/s/catalog/sharding_catalog_add_shard_test.cpp b/src/mongo/s/catalog/sharding_catalog_add_shard_test.cpp index 7740ba951e9..5b686282b9e 100644 --- a/src/mongo/s/catalog/sharding_catalog_add_shard_test.cpp +++ b/src/mongo/s/catalog/sharding_catalog_add_shard_test.cpp @@ -75,9 +75,6 @@ const BSONObj kReplSecondaryOkMetadata{[] { return o.obj(); }()}; -// TODO (SERVER-27029): Remove once the cause for the timeout has been figured out -const Milliseconds kInifiniteFutureTimeout(Milliseconds::max()); - class AddShardTest : public ConfigServerTestFixture { protected: /** @@ -407,7 +404,7 @@ TEST_F(AddShardTest, StandaloneBasicSuccess) { expectShardIdentityUpsertReturnSuccess(shardTarget, expectedShardName); // Wait for the addShard to complete before checking the config database - future.timed_get(kInifiniteFutureTimeout); + future.timed_get(kFutureTimeout); // Ensure that the shard document was properly added to config.shards. assertShardExists(expectedShard); @@ -486,7 +483,7 @@ TEST_F(AddShardTest, StandaloneGenerateName) { expectShardIdentityUpsertReturnSuccess(shardTarget, expectedShardName); // Wait for the addShard to complete before checking the config database - future.timed_get(kInifiniteFutureTimeout); + future.timed_get(kFutureTimeout); // Ensure that the shard document was properly added to config.shards. assertShardExists(expectedShard); @@ -512,7 +509,7 @@ TEST_F(AddShardTest, AddSCCCConnectionStringAsShard) { ASSERT_STRING_CONTAINS(status.getStatus().reason(), "Invalid connection string"); }); - future.timed_get(kInifiniteFutureTimeout); + future.timed_get(kFutureTimeout); } TEST_F(AddShardTest, EmptyShardName) { @@ -530,7 +527,7 @@ TEST_F(AddShardTest, EmptyShardName) { ASSERT_EQUALS("shard name cannot be empty", status.getStatus().reason()); }); - future.timed_get(kInifiniteFutureTimeout); + future.timed_get(kFutureTimeout); } // Host is unreachable, cannot verify host. @@ -555,7 +552,7 @@ TEST_F(AddShardTest, UnreachableHost) { Status hostUnreachableStatus = Status(ErrorCodes::HostUnreachable, "host unreachable"); expectIsMaster(shardTarget, hostUnreachableStatus); - future.timed_get(kInifiniteFutureTimeout); + future.timed_get(kFutureTimeout); } // Cannot add mongos as a shard. @@ -580,7 +577,7 @@ TEST_F(AddShardTest, AddMongosAsShard) { Status(ErrorCodes::RPCProtocolNegotiationFailed, "Unable to communicate"); expectIsMaster(shardTarget, rpcProtocolNegFailedStatus); - future.timed_get(kInifiniteFutureTimeout); + future.timed_get(kFutureTimeout); } // Attempt to add a pre-v3.4 mongod. @@ -606,7 +603,7 @@ TEST_F(AddShardTest, AddVersion32Shard) { BSON("ok" << 1 << "ismaster" << true << "maxWireVersion" << WireVersion::FIND_COMMAND); expectIsMaster(shardTarget, commandResponse); - future.timed_get(kInifiniteFutureTimeout); + future.timed_get(kFutureTimeout); } // A replica set name was found for the host but no name was provided with the host. @@ -634,7 +631,7 @@ TEST_F(AddShardTest, AddReplicaSetShardAsStandalone) { << WireVersion::COMMANDS_ACCEPT_WRITE_CONCERN); expectIsMaster(shardTarget, commandResponse); - future.timed_get(kInifiniteFutureTimeout); + future.timed_get(kFutureTimeout); } // A replica set name was provided with the host but no name was found for the host. @@ -662,7 +659,7 @@ TEST_F(AddShardTest, AddStandaloneHostShardAsReplicaSet) { << WireVersion::COMMANDS_ACCEPT_WRITE_CONCERN); expectIsMaster(shardTarget, commandResponse); - future.timed_get(kInifiniteFutureTimeout); + future.timed_get(kFutureTimeout); } // Provided replica set name does not match found replica set name. @@ -692,7 +689,7 @@ TEST_F(AddShardTest, ReplicaSetMistmatchedReplicaSetName) { << WireVersion::COMMANDS_ACCEPT_WRITE_CONCERN); expectIsMaster(shardTarget, commandResponse); - future.timed_get(kInifiniteFutureTimeout); + future.timed_get(kFutureTimeout); } // Cannot add config server as a shard. @@ -725,7 +722,7 @@ TEST_F(AddShardTest, ShardIsCSRSConfigServer) { << WireVersion::COMMANDS_ACCEPT_WRITE_CONCERN); expectIsMaster(shardTarget, commandResponse); - future.timed_get(kInifiniteFutureTimeout); + future.timed_get(kFutureTimeout); } // One of the hosts is not part of the found replica set. @@ -760,7 +757,7 @@ TEST_F(AddShardTest, ReplicaSetMissingHostsProvidedInSeedList) { << WireVersion::COMMANDS_ACCEPT_WRITE_CONCERN); expectIsMaster(shardTarget, commandResponse); - future.timed_get(kInifiniteFutureTimeout); + future.timed_get(kFutureTimeout); } // Cannot add a shard with the shard name "config". @@ -796,7 +793,7 @@ TEST_F(AddShardTest, AddShardWithNameConfigFails) { << WireVersion::COMMANDS_ACCEPT_WRITE_CONCERN); expectIsMaster(shardTarget, commandResponse); - future.timed_get(kInifiniteFutureTimeout); + future.timed_get(kFutureTimeout); } TEST_F(AddShardTest, ShardContainsExistingDatabase) { @@ -847,7 +844,7 @@ TEST_F(AddShardTest, ShardContainsExistingDatabase) { expectListDatabases(shardTarget, {BSON("name" << existingDB.getName())}); - future.timed_get(kInifiniteFutureTimeout); + future.timed_get(kFutureTimeout); } TEST_F(AddShardTest, SuccessfullyAddReplicaSet) { @@ -899,7 +896,7 @@ TEST_F(AddShardTest, SuccessfullyAddReplicaSet) { expectShardIdentityUpsertReturnSuccess(shardTarget, expectedShardName); // Wait for the addShard to complete before checking the config database - future.timed_get(kInifiniteFutureTimeout); + future.timed_get(kFutureTimeout); // Ensure that the shard document was properly added to config.shards. assertShardExists(expectedShard); @@ -961,7 +958,7 @@ TEST_F(AddShardTest, ReplicaSetExtraHostsDiscovered) { expectShardIdentityUpsertReturnSuccess(shardTarget, expectedShardName); // Wait for the addShard to complete before checking the config database - future.timed_get(kInifiniteFutureTimeout); + future.timed_get(kFutureTimeout); // Ensure that the shard document was properly added to config.shards. assertShardExists(expectedShard); @@ -1037,7 +1034,7 @@ TEST_F(AddShardTest, AddShardSucceedsEvenIfAddingDBsFromNewShardFails) { expectShardIdentityUpsertReturnSuccess(shardTarget, expectedShardName); // Wait for the addShard to complete before checking the config database - future.timed_get(kInifiniteFutureTimeout); + future.timed_get(kFutureTimeout); // Ensure that the shard document was properly added to config.shards. assertShardExists(expectedShard); @@ -1514,7 +1511,7 @@ TEST_F(AddShardTest, AddExistingShardStandalone) { ConnectionString(shardTarget), existingShard.getMaxSizeMB())); }); - future1.timed_get(kInifiniteFutureTimeout); + future1.timed_get(kFutureTimeout); // Ensure that the shard document was unchanged. assertShardExists(existingShard); @@ -1528,7 +1525,7 @@ TEST_F(AddShardTest, AddExistingShardStandalone) { ConnectionString(shardTarget), existingShard.getMaxSizeMB() + 100)); }); - future2.timed_get(kInifiniteFutureTimeout); + future2.timed_get(kFutureTimeout); // Adding the same standalone host but as part of a replica set should fail. // Ensures that even if the user changed the standalone shard to a single-node replica set, you @@ -1543,7 +1540,7 @@ TEST_F(AddShardTest, AddExistingShardStandalone) { ConnectionString::forReplicaSet("mySet", {shardTarget}), existingShard.getMaxSizeMB())); }); - future3.timed_get(kInifiniteFutureTimeout); + future3.timed_get(kFutureTimeout); // Ensure that the shard document was unchanged. assertShardExists(existingShard); @@ -1557,7 +1554,7 @@ TEST_F(AddShardTest, AddExistingShardStandalone) { existingShard.getMaxSizeMB())); ASSERT_EQUALS(existingShardName, shardName); }); - future4.timed_get(kInifiniteFutureTimeout); + future4.timed_get(kFutureTimeout); // Ensure that the shard document was unchanged. assertShardExists(existingShard); @@ -1572,7 +1569,7 @@ TEST_F(AddShardTest, AddExistingShardStandalone) { existingShard.getMaxSizeMB())); ASSERT_EQUALS(existingShardName, shardName); }); - future5.timed_get(kInifiniteFutureTimeout); + future5.timed_get(kFutureTimeout); // Ensure that the shard document was unchanged. assertShardExists(existingShard); @@ -1613,7 +1610,7 @@ TEST_F(AddShardTest, AddExistingShardReplicaSet) { catalogManager()->addShard( operationContext(), &differentName, connString, existingShard.getMaxSizeMB())); }); - future1.timed_get(kInifiniteFutureTimeout); + future1.timed_get(kFutureTimeout); // Ensure that the shard document was unchanged. assertShardExists(existingShard); @@ -1626,7 +1623,7 @@ TEST_F(AddShardTest, AddExistingShardReplicaSet) { catalogManager()->addShard( operationContext(), nullptr, connString, existingShard.getMaxSizeMB() + 100)); }); - future2.timed_get(kInifiniteFutureTimeout); + future2.timed_get(kFutureTimeout); // Ensure that the shard document was unchanged. assertShardExists(existingShard); @@ -1644,7 +1641,7 @@ TEST_F(AddShardTest, AddExistingShardReplicaSet) { ConnectionString(shardTarget), existingShard.getMaxSizeMB())); }); - future3.timed_get(kInifiniteFutureTimeout); + future3.timed_get(kFutureTimeout); // Ensure that the shard document was unchanged. assertShardExists(existingShard); @@ -1662,7 +1659,7 @@ TEST_F(AddShardTest, AddExistingShardReplicaSet) { differentSetName, connString.getServers()), existingShard.getMaxSizeMB())); }); - future4.timed_get(kInifiniteFutureTimeout); + future4.timed_get(kFutureTimeout); // Ensure that the shard document was unchanged. assertShardExists(existingShard); @@ -1674,7 +1671,7 @@ TEST_F(AddShardTest, AddExistingShardReplicaSet) { operationContext(), &existingShardName, connString, existingShard.getMaxSizeMB())); ASSERT_EQUALS(existingShardName, shardName); }); - future5.timed_get(kInifiniteFutureTimeout); + future5.timed_get(kFutureTimeout); // Adding the same host with the same options (without explicitly specifying the shard name) // should succeed. @@ -1684,7 +1681,7 @@ TEST_F(AddShardTest, AddExistingShardReplicaSet) { operationContext(), nullptr, connString, existingShard.getMaxSizeMB())); ASSERT_EQUALS(existingShardName, shardName); }); - future6.timed_get(kInifiniteFutureTimeout); + future6.timed_get(kFutureTimeout); // Ensure that the shard document was unchanged. assertShardExists(existingShard); @@ -1707,7 +1704,7 @@ TEST_F(AddShardTest, AddExistingShardReplicaSet) { operationContext(), nullptr, otherHostConnString, existingShard.getMaxSizeMB())); ASSERT_EQUALS(existingShardName, shardName); }); - future7.timed_get(kInifiniteFutureTimeout); + future7.timed_get(kFutureTimeout); // Ensure that the shard document was unchanged. assertShardExists(existingShard); |