diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2021-08-17 13:33:27 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-08-17 13:59:08 +0000 |
commit | ecb7d0f01755310c28bec2ca9d15fdd75ab1178d (patch) | |
tree | a012f9507ff3a2f9166d00cf74e5a246d454b1d4 | |
parent | 5f4859e07684580c4ecafdb8ea1682d2bb856ee9 (diff) | |
download | mongo-ecb7d0f01755310c28bec2ca9d15fdd75ab1178d.tar.gz |
SERVER-40170 Increase the sharding unit-tests async work future timeout
31 files changed, 258 insertions, 256 deletions
diff --git a/src/mongo/db/pipeline/document_source_merge_cursors_test.cpp b/src/mongo/db/pipeline/document_source_merge_cursors_test.cpp index bc030bac900..12030012793 100644 --- a/src/mongo/db/pipeline/document_source_merge_cursors_test.cpp +++ b/src/mongo/db/pipeline/document_source_merge_cursors_test.cpp @@ -334,7 +334,7 @@ TEST_F(DocumentSourceMergeCursorsTest, ShouldBeAbleToIterateCursorsUntilEOF) { return cursorResponseObj(expCtx->ns, kExhaustedCursorID, {BSON("x" << 1)}); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DocumentSourceMergeCursorsTest, ShouldNotKillCursorsIfNeverIterated) { @@ -395,7 +395,7 @@ TEST_F(DocumentSourceMergeCursorsTest, ShouldKillCursorIfPartiallyIterated) { // anything except {ok: 1}. return BSON("ok" << 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DocumentSourceMergeCursorsTest, ShouldOptimizeWithASortToEnsureCorrectOrder) { @@ -452,7 +452,7 @@ TEST_F(DocumentSourceMergeCursorsTest, ShouldOptimizeWithASortToEnsureCorrectOrd BSON("x" << 4 << "$sortKey" << BSON("" << 4))}); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DocumentSourceMergeCursorsTest, ShouldEnforceSortSpecifiedViaARMParams) { @@ -500,7 +500,7 @@ TEST_F(DocumentSourceMergeCursorsTest, ShouldEnforceSortSpecifiedViaARMParams) { BSON("x" << 4 << "$sortKey" << BSON("" << 4))}); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DocumentSourceMergeCursorsTest, ShouldNotRemoveLimitWhenOptimizingWithLeadingSort) { @@ -553,7 +553,7 @@ TEST_F(DocumentSourceMergeCursorsTest, ShouldNotRemoveLimitWhenOptimizingWithLea BSON("x" << 4 << "$sortKey" << BSON("" << 4))}); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } } // namespace diff --git a/src/mongo/db/s/balancer/migration_manager_test.cpp b/src/mongo/db/s/balancer/migration_manager_test.cpp index c9d7707cc83..9c0d459f938 100644 --- a/src/mongo/db/s/balancer/migration_manager_test.cpp +++ b/src/mongo/db/s/balancer/migration_manager_test.cpp @@ -332,7 +332,7 @@ TEST_F(MigrationManagerTest, OneCollectionTwoMigrations) { expectMoveChunkCommand(chunk2, kShardId3, Status::OK()); // Run the MigrationManager code. - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(MigrationManagerTest, TwoCollectionsTwoMigrationsEach) { @@ -397,7 +397,7 @@ TEST_F(MigrationManagerTest, TwoCollectionsTwoMigrationsEach) { expectMoveChunkCommand(chunk2coll2, kShardId3, Status::OK()); // Run the MigrationManager code. - future.timed_get(kFutureTimeout); + future.default_timed_get(); } // The MigrationManager should fail the migration if a host is not found for the source shard. @@ -450,7 +450,7 @@ TEST_F(MigrationManagerTest, SourceShardNotFound) { expectMoveChunkCommand(chunk1, kShardId1, Status::OK()); // Run the MigrationManager code. - future.timed_get(kFutureTimeout); + future.default_timed_get(); } // TODO: Delete in 3.8 @@ -493,7 +493,7 @@ TEST_F(MigrationManagerTest, JumboChunkResponseBackwardsCompatibility) { expectMoveChunkCommand(chunk1, kShardId1, BSON("ok" << 0 << "chunkTooBig" << true)); // Run the MigrationManager code. - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(MigrationManagerTest, InterruptMigration) { @@ -543,7 +543,7 @@ TEST_F(MigrationManagerTest, InterruptMigration) { network()->exitNetwork(); // Ensure that the previously scheduled migration is cancelled - future.timed_get(kFutureTimeout); + future.default_timed_get(); // Ensure that no new migrations can be scheduled ASSERT_EQ(ErrorCodes::BalancerInterrupted, @@ -619,7 +619,7 @@ TEST_F(MigrationManagerTest, RestartMigrationManager) { expectMoveChunkCommand(chunk1, kShardId1, Status::OK()); // Run the MigrationManager code. - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(MigrationManagerTest, MigrationRecovery) { @@ -675,7 +675,7 @@ TEST_F(MigrationManagerTest, MigrationRecovery) { expectMoveChunkCommand(chunk2, kShardId3, Status::OK()); // Run the MigrationManager code. - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(MigrationManagerTest, FailMigrationRecovery) { @@ -795,7 +795,7 @@ TEST_F(MigrationManagerTest, RemoteCallErrorConversionToOperationFailed) { "RemoteCallErrorConversionToOperationFailedCheck generated error.")); // Run the MigrationManager code. - future.timed_get(kFutureTimeout); + future.default_timed_get(); } } // namespace diff --git a/src/mongo/db/s/config/sharding_catalog_manager_create_collection_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_create_collection_test.cpp index a92890183e9..66cfb9513b2 100644 --- a/src/mongo/db/s/config/sharding_catalog_manager_create_collection_test.cpp +++ b/src/mongo/db/s/config/sharding_catalog_manager_create_collection_test.cpp @@ -181,7 +181,7 @@ TEST_F(CreateCollectionTest, BaseCase) { auto uuid = UUID::gen(); auto options = fromjson("{ capped: true, size: 256 }"); expectListCollection(primaryHost, testNS.db().toString(), options, uuid); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } } // namespace diff --git a/src/mongo/db/s/config/sharding_catalog_manager_create_database_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_create_database_test.cpp index b2e0fb7fd3c..e1261cf15ad 100644 --- a/src/mongo/db/s/config/sharding_catalog_manager_create_database_test.cpp +++ b/src/mongo/db/s/config/sharding_catalog_manager_create_database_test.cpp @@ -151,7 +151,7 @@ TEST_F(CreateDatabaseTest, createDatabaseSuccessWithoutCustomPrimary) { return BSON("ok" << 1 << "totalSize" << 100); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(CreateDatabaseTest, createDatabaseSuccessWithCustomPrimary) { @@ -196,7 +196,7 @@ TEST_F(CreateDatabaseTest, createDatabaseSuccessWithCustomPrimary) { ->createDatabase(opCtx.get(), dbname, ShardId(primaryShardName)); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); auto databaseDoc = assertGet(findOneOnConfigCollection( operationContext(), DatabaseType::ConfigNS, BSON("_id" << dbname))); diff --git a/src/mongo/db/s/config/sharding_catalog_manager_drop_coll_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_drop_coll_test.cpp index c413cf893f6..da30a7b98b1 100644 --- a/src/mongo/db/s/config/sharding_catalog_manager_drop_coll_test.cpp +++ b/src/mongo/db/s/config/sharding_catalog_manager_drop_coll_test.cpp @@ -208,7 +208,7 @@ TEST_F(DropColl2ShardTest, Basic) { expectSetShardVersionZero(shard2()); expectUnsetSharding(shard2()); - future.timed_get(kFutureTimeout); + future.default_timed_get(); expectCollectionDocMarkedAsDropped(); expectNoChunkDocs(); @@ -253,7 +253,7 @@ TEST_F(DropColl2ShardTest, NSNotFound) { expectSetShardVersionZero(shard2()); expectUnsetSharding(shard2()); - future.timed_get(kFutureTimeout); + future.default_timed_get(); expectCollectionDocMarkedAsDropped(); expectNoChunkDocs(); @@ -272,7 +272,7 @@ TEST_F(DropColl2ShardTest, FirstShardTargeterError) { ASSERT_FALSE(status.reason().empty()); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DropColl2ShardTest, FirstShardDropError) { @@ -287,7 +287,7 @@ TEST_F(DropColl2ShardTest, FirstShardDropError) { return BSON("ok" << 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DropColl2ShardTest, FirstShardDropCmdError) { @@ -304,7 +304,7 @@ TEST_F(DropColl2ShardTest, FirstShardDropCmdError) { expectDrop(shard2()); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DropColl2ShardTest, SecondShardTargeterError) { @@ -321,7 +321,7 @@ TEST_F(DropColl2ShardTest, SecondShardTargeterError) { expectDrop(shard1()); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DropColl2ShardTest, SecondShardDropError) { @@ -338,7 +338,7 @@ TEST_F(DropColl2ShardTest, SecondShardDropError) { return BSON("ok" << 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DropColl2ShardTest, SecondShardDropCmdError) { @@ -354,7 +354,7 @@ TEST_F(DropColl2ShardTest, SecondShardDropCmdError) { return BSON("ok" << 0 << "code" << ErrorCodes::Unauthorized); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DropColl2ShardTest, CleanupChunkError) { @@ -372,7 +372,7 @@ TEST_F(DropColl2ShardTest, CleanupChunkError) { << "bad delete"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); expectCollectionDocMarkedAsDropped(); expectNoChunkDocs(); @@ -394,7 +394,7 @@ TEST_F(DropColl2ShardTest, SSVCmdErrorOnShard1) { << "bad"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); expectCollectionDocMarkedAsDropped(); expectNoChunkDocs(); @@ -416,7 +416,7 @@ TEST_F(DropColl2ShardTest, SSVErrorOnShard1) { return BSON("ok" << 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); expectCollectionDocMarkedAsDropped(); expectNoChunkDocs(); @@ -440,7 +440,7 @@ TEST_F(DropColl2ShardTest, UnsetCmdErrorOnShard1) { << "bad"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); expectCollectionDocMarkedAsDropped(); expectNoChunkDocs(); @@ -464,7 +464,7 @@ TEST_F(DropColl2ShardTest, UnsetErrorOnShard1) { return BSON("ok" << 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); expectCollectionDocMarkedAsDropped(); expectNoChunkDocs(); @@ -489,7 +489,7 @@ TEST_F(DropColl2ShardTest, SSVCmdErrorOnShard2) { << "bad"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); expectCollectionDocMarkedAsDropped(); expectNoChunkDocs(); @@ -514,7 +514,7 @@ TEST_F(DropColl2ShardTest, SSVErrorOnShard2) { return BSON("ok" << 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); expectCollectionDocMarkedAsDropped(); expectNoChunkDocs(); @@ -541,7 +541,7 @@ TEST_F(DropColl2ShardTest, UnsetCmdErrorOnShard2) { << "bad"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); expectCollectionDocMarkedAsDropped(); expectNoChunkDocs(); @@ -568,7 +568,7 @@ TEST_F(DropColl2ShardTest, UnsetErrorOnShard2) { return BSON("ok" << 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); expectCollectionDocMarkedAsDropped(); expectNoChunkDocs(); diff --git a/src/mongo/db/s/config/sharding_catalog_manager_enable_sharding_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_enable_sharding_test.cpp index 08e5b4123a4..0cdaa39601d 100644 --- a/src/mongo/db/s/config/sharding_catalog_manager_enable_sharding_test.cpp +++ b/src/mongo/db/s/config/sharding_catalog_manager_enable_sharding_test.cpp @@ -102,7 +102,7 @@ TEST_F(EnableShardingTest, noDBExists) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EnableShardingTest, dbExistsWithDifferentCase) { diff --git a/src/mongo/db/s/config/sharding_catalog_manager_remove_shard_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_remove_shard_test.cpp index 7491c471f2a..fa4dcc65bf7 100644 --- a/src/mongo/db/s/config/sharding_catalog_manager_remove_shard_test.cpp +++ b/src/mongo/db/s/config/sharding_catalog_manager_remove_shard_test.cpp @@ -67,8 +67,6 @@ using std::string; using std::vector; using unittest::assertGet; -const Seconds kFutureTimeout{5}; - BSONObj getReplSecondaryOkMetadata() { BSONObjBuilder o; ReadPreferenceSetting(ReadPreference::Nearest).toContainingBSON(&o); diff --git a/src/mongo/db/s/config/sharding_catalog_manager_shard_collection_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_shard_collection_test.cpp index 1e1fba2a1eb..3b9645eb03a 100644 --- a/src/mongo/db/s/config/sharding_catalog_manager_shard_collection_test.cpp +++ b/src/mongo/db/s/config/sharding_catalog_manager_shard_collection_test.cpp @@ -206,7 +206,7 @@ TEST_F(ConfigServerShardCollectionTest, RangeSharding_ForMapReduce_NoInitialSpli // TODO SERVER-29451: add hooks to the mock storage engine to expect reads and writes. expectSetShardVersion(shardHost, shard, kNamespace, boost::none /* expected ChunkVersion */); - future.timed_get(kFutureTimeout); + future.default_timed_get(); checkWrittenChunks( {ChunkType(kNamespace, @@ -280,7 +280,7 @@ TEST_F(ConfigServerShardCollectionTest, RangeSharding_ForMapReduce_WithInitialSp // TODO SERVER-29451: add hooks to the mock storage engine to expect reads and writes. expectSetShardVersion(shard0Host, shard0, kNamespace, boost::none /* expected ChunkVersion */); - future.timed_get(kFutureTimeout); + future.default_timed_get(); checkWrittenChunks({ChunkType(kNamespace, ChunkRange{keyPattern.getKeyPattern().globalMin(), splitPoint0}, @@ -346,7 +346,7 @@ TEST_F(ConfigServerShardCollectionTest, RangeSharding_NoInitialSplitPoints_NoSpl // TODO SERVER-29451: add hooks to the mock storage engine to expect reads and writes. expectSetShardVersion(shardHost, shard, kNamespace, boost::none /* expected ChunkVersion */); - future.timed_get(kFutureTimeout); + future.default_timed_get(); checkWrittenChunks( {ChunkType(kNamespace, @@ -404,7 +404,7 @@ TEST_F(ConfigServerShardCollectionTest, RangeSharding_NoInitialSplitPoints_WithS // TODO SERVER-29451: add hooks to the mock storage engine to expect reads and writes. expectSetShardVersion(shardHost, shard, kNamespace, boost::none); - future.timed_get(kFutureTimeout); + future.default_timed_get(); checkWrittenChunks({ChunkType(kNamespace, ChunkRange{keyPattern.getKeyPattern().globalMin(), splitPoint0}, @@ -472,7 +472,7 @@ TEST_F(ConfigServerShardCollectionTest, RangeSharding_WithInitialSplitPoints_NoS // TODO SERVER-29451: add hooks to the mock storage engine to expect reads and writes. expectSetShardVersion(shardHost, shard, kNamespace, boost::none); - future.timed_get(kFutureTimeout); + future.default_timed_get(); checkWrittenChunks({ChunkType(kNamespace, ChunkRange{keyPattern.getKeyPattern().globalMin(), splitPoint0}, @@ -569,7 +569,7 @@ TEST_F(CreateFirstChunksTest, NonEmptyCollection_SplitPoints_FromSplitVector_Man expectSplitVector(connStr.getServers()[0], kShardKeyPattern, BSON_ARRAY(BSON("x" << 0))); - const auto& firstChunks = future.timed_get(kFutureTimeout); + const auto& firstChunks = future.default_timed_get(); ASSERT_EQ(2U, firstChunks.chunks.size()); ASSERT_EQ(kShards[1].getName(), firstChunks.chunks[0].getShard()); ASSERT_EQ(kShards[1].getName(), firstChunks.chunks[1].getShard()); @@ -614,7 +614,7 @@ TEST_F(CreateFirstChunksTest, NonEmptyCollection_SplitPoints_FromClient_ManyChun collectionIsEmpty); }); - const auto& firstChunks = future.timed_get(kFutureTimeout); + const auto& firstChunks = future.default_timed_get(); ASSERT_EQ(2U, firstChunks.chunks.size()); ASSERT_EQ(kShards[1].getName(), firstChunks.chunks[0].getShard()); ASSERT_EQ(kShards[1].getName(), firstChunks.chunks[1].getShard()); @@ -691,7 +691,7 @@ TEST_F(CreateFirstChunksTest, EmptyCollection_SplitPoints_FromClient_ManyChunksD collectionIsEmpty); }); - const auto& firstChunks = future.timed_get(kFutureTimeout); + const auto& firstChunks = future.default_timed_get(); ASSERT_EQ(3U, firstChunks.chunks.size()); ASSERT_EQ(kShards[0].getName(), firstChunks.chunks[0].getShard()); ASSERT_EQ(kShards[1].getName(), firstChunks.chunks[1].getShard()); @@ -737,7 +737,7 @@ TEST_F(CreateFirstChunksTest, EmptyCollection_NoSplitPoints_OneChunkToPrimary) { collectionIsEmpty); }); - const auto& firstChunks = future.timed_get(kFutureTimeout); + const auto& firstChunks = future.default_timed_get(); ASSERT_EQ(1U, firstChunks.chunks.size()); ASSERT_EQ(kShards[1].getName(), firstChunks.chunks[0].getShard()); } diff --git a/src/mongo/db/s/implicit_create_collection_test.cpp b/src/mongo/db/s/implicit_create_collection_test.cpp index 0c1a08e7b72..a76bb25d208 100644 --- a/src/mongo/db/s/implicit_create_collection_test.cpp +++ b/src/mongo/db/s/implicit_create_collection_test.cpp @@ -78,7 +78,7 @@ TEST_F(ImplicitCreateTest, NormalCreate) { expectConfigCreate(kNs, Status::OK()); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ImplicitCreateTest, CanCallOnCannotImplicitAgainAfterError) { @@ -94,7 +94,7 @@ TEST_F(ImplicitCreateTest, CanCallOnCannotImplicitAgainAfterError) { // return a non retryable error (just for testing) so the handler won't retry. expectConfigCreate(kNs, {ErrorCodes::FailPointEnabled, "deliberate error"}); - future.timed_get(kFutureTimeout); + future.default_timed_get(); // Retry, but this time config server will return success @@ -108,7 +108,7 @@ TEST_F(ImplicitCreateTest, CanCallOnCannotImplicitAgainAfterError) { expectConfigCreate(kNs, Status::OK()); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ImplicitCreateTest, ShouldNotCallConfigCreateIfCollectionExists) { @@ -124,7 +124,7 @@ TEST_F(ImplicitCreateTest, ShouldNotCallConfigCreateIfCollectionExists) { // return a non retryable error (just for testing) so the handler won't retry. expectConfigCreate(kNs, {ErrorCodes::FailPointEnabled, "deliberate error"}); - future.timed_get(kFutureTimeout); + future.default_timed_get(); // Simulate config server successfully creating the collection despite returning error. DBDirectClient client(operationContext()); @@ -143,7 +143,7 @@ TEST_F(ImplicitCreateTest, ShouldNotCallConfigCreateIfCollectionExists) { // Not expecting this shard to send any remote command. - future.timed_get(kFutureTimeout); + future.default_timed_get(); } } // unnamed namespace diff --git a/src/mongo/db/s/migration_chunk_cloner_source_legacy_test.cpp b/src/mongo/db/s/migration_chunk_cloner_source_legacy_test.cpp index aafc5aac1ae..6e396abed5f 100644 --- a/src/mongo/db/s/migration_chunk_cloner_source_legacy_test.cpp +++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy_test.cpp @@ -215,7 +215,7 @@ TEST_F(MigrationChunkClonerSourceLegacyTest, CorrectDocumentsFetched) { }); ASSERT_OK(cloner.startClone(operationContext())); - futureStartClone.timed_get(kFutureTimeout); + futureStartClone.default_timed_get(); } // Ensure the initial clone documents are available @@ -302,7 +302,7 @@ TEST_F(MigrationChunkClonerSourceLegacyTest, CorrectDocumentsFetched) { }); ASSERT_OK(cloner.commitClone(operationContext())); - futureCommit.timed_get(kFutureTimeout); + futureCommit.default_timed_get(); } TEST_F(MigrationChunkClonerSourceLegacyTest, CollectionNotFound) { @@ -355,7 +355,7 @@ TEST_F(MigrationChunkClonerSourceLegacyTest, FailedToEngageRecipientShard) { // Error is converted to OperationFailed as if it's propagated to the MigrationManager // it will mark the migration source as having network problems. ASSERT_EQ(ErrorCodes::OperationFailed, startCloneStatus.code()); - futureStartClone.timed_get(kFutureTimeout); + futureStartClone.default_timed_get(); } // Ensure that if the recipient tries to fetch some documents, the cloner won't crash @@ -407,7 +407,7 @@ TEST_F(MigrationChunkClonerSourceLegacyTest, RecipientShardFailsWithIsNotMaster) // Error is converted to OperationFailed as if it's propagated to the MigrationManager // it will mark the migration source as no longer primary. ASSERT_EQ(ErrorCodes::OperationFailed, startCloneStatus.code()); - futureStartClone.timed_get(kFutureTimeout); + futureStartClone.default_timed_get(); } cloner.cancelClone(operationContext()); } diff --git a/src/mongo/db/s/split_chunk_test.cpp b/src/mongo/db/s/split_chunk_test.cpp index 1ac0aef1780..ce98bafda5a 100644 --- a/src/mongo/db/s/split_chunk_test.cpp +++ b/src/mongo/db/s/split_chunk_test.cpp @@ -255,7 +255,7 @@ TEST_F(SplitChunkTest, HashedKeyPatternNumberLongSplitKeys) { collResponse(); chunkResponse(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(SplitChunkTest, HashedKeyPatternIntegerSplitKeys) { @@ -293,7 +293,7 @@ TEST_F(SplitChunkTest, HashedKeyPatternIntegerSplitKeys) { chunkResponse(); shardResponse(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(SplitChunkTest, HashedKeyPatternDoubleSplitKeys) { @@ -331,7 +331,7 @@ TEST_F(SplitChunkTest, HashedKeyPatternDoubleSplitKeys) { chunkResponse(); shardResponse(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(SplitChunkTest, HashedKeyPatternStringSplitKeys) { @@ -375,7 +375,7 @@ TEST_F(SplitChunkTest, HashedKeyPatternStringSplitKeys) { chunkResponse(); shardResponse(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(SplitChunkTest, ValidRangeKeyPatternSplitKeys) { @@ -423,7 +423,7 @@ TEST_F(SplitChunkTest, ValidRangeKeyPatternSplitKeys) { collResponse(); chunkResponse(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(SplitChunkTest, SplitChunkWithNoErrors) { @@ -484,7 +484,7 @@ TEST_F(SplitChunkTest, SplitChunkWithNoErrors) { collResponse(); chunkResponse(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(SplitChunkTest, AttemptSplitWithConfigsvrError) { @@ -528,7 +528,7 @@ TEST_F(SplitChunkTest, AttemptSplitWithConfigsvrError) { collResponse(); chunkResponse(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(SplitChunkTest, AttemptSplitOnNoDatabases) { @@ -562,7 +562,7 @@ TEST_F(SplitChunkTest, AttemptSplitOnNoDatabases) { emptyResponse(); emptyResponse(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(SplitChunkTest, AttemptSplitOnNoCollections) { @@ -599,7 +599,7 @@ TEST_F(SplitChunkTest, AttemptSplitOnNoCollections) { emptyResponse(); shardResponse(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(SplitChunkTest, AttemptSplitOnNoChunks) { @@ -642,7 +642,7 @@ TEST_F(SplitChunkTest, AttemptSplitOnNoChunks) { collResponse(); emptyResponse(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(SplitChunkTest, NoCollectionAfterSplit) { @@ -686,7 +686,7 @@ TEST_F(SplitChunkTest, NoCollectionAfterSplit) { // Finally, give an empty response to a request regarding a find on the original collection. emptyResponse(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(SplitChunkTest, NoChunksAfterSplit) { @@ -736,7 +736,7 @@ TEST_F(SplitChunkTest, NoChunksAfterSplit) { collResponse(); emptyResponse(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } } // namespace diff --git a/src/mongo/executor/network_test_env.cpp b/src/mongo/executor/network_test_env.cpp index 455fb723eca..c36671dd346 100644 --- a/src/mongo/executor/network_test_env.cpp +++ b/src/mongo/executor/network_test_env.cpp @@ -40,6 +40,8 @@ namespace mongo { namespace executor { +constexpr Minutes NetworkTestEnv::kDefaultLaunchAsyncFutureTimeout; + NetworkTestEnv::NetworkTestEnv(TaskExecutor* executor, NetworkInterfaceMock* network) : _executor(executor), _mockNetwork(network) {} diff --git a/src/mongo/executor/network_test_env.h b/src/mongo/executor/network_test_env.h index 5ea8c5ae474..e7f66f52aea 100644 --- a/src/mongo/executor/network_test_env.h +++ b/src/mongo/executor/network_test_env.h @@ -81,6 +81,9 @@ namespace executor { */ class NetworkTestEnv { public: + // Common timeout for tests to use for any work scheduled through launchAsync to complete. + static constexpr Minutes kDefaultLaunchAsyncFutureTimeout{5}; + /** * Wraps a std::future but will cancel any pending network operations in its destructor if * the future wasn't successfully waited on in the main test thread. @@ -90,6 +93,7 @@ public: template <class T> class FutureHandle { public: + FutureHandle<T>(stdx::future<T> future, executor::TaskExecutor* executor, executor::NetworkInterfaceMock* network) @@ -130,6 +134,10 @@ public: return timed_get(timeout_duration.toSystemDuration()); } + T default_timed_get() { + return timed_get(kDefaultLaunchAsyncFutureTimeout); + } + private: stdx::future<T> _future; executor::TaskExecutor* _executor; diff --git a/src/mongo/s/balancer_configuration_test.cpp b/src/mongo/s/balancer_configuration_test.cpp index e281a1e1a08..b60d59c8fe6 100644 --- a/src/mongo/s/balancer_configuration_test.cpp +++ b/src/mongo/s/balancer_configuration_test.cpp @@ -105,7 +105,7 @@ TEST_F(BalancerConfigurationTestFixture, NoConfigurationDocuments) { expectSettingsQuery(ChunkSizeSettingsType::kKey, boost::optional<BSONObj>()); expectSettingsQuery(AutoSplitSettingsType::kKey, boost::optional<BSONObj>()); - future.timed_get(kFutureTimeout); + future.default_timed_get(); ASSERT(config.shouldBalance()); ASSERT(config.shouldBalanceForAutoSplit()); @@ -126,7 +126,7 @@ TEST_F(BalancerConfigurationTestFixture, ChunkSizeSettingsDocumentOnly) { expectSettingsQuery(ChunkSizeSettingsType::kKey, boost::optional<BSONObj>(BSON("value" << 3))); expectSettingsQuery(AutoSplitSettingsType::kKey, boost::optional<BSONObj>()); - future.timed_get(kFutureTimeout); + future.default_timed_get(); ASSERT(config.shouldBalance()); ASSERT(config.shouldBalanceForAutoSplit()); @@ -148,7 +148,7 @@ TEST_F(BalancerConfigurationTestFixture, BalancerSettingsDocumentOnly) { expectSettingsQuery(ChunkSizeSettingsType::kKey, boost::optional<BSONObj>()); expectSettingsQuery(AutoSplitSettingsType::kKey, boost::optional<BSONObj>()); - future.timed_get(kFutureTimeout); + future.default_timed_get(); ASSERT(!config.shouldBalance()); ASSERT(!config.shouldBalanceForAutoSplit()); @@ -170,7 +170,7 @@ TEST_F(BalancerConfigurationTestFixture, AutoSplitSettingsDocumentOnly) { expectSettingsQuery(AutoSplitSettingsType::kKey, boost::optional<BSONObj>(BSON("enabled" << false))); - future.timed_get(kFutureTimeout); + future.default_timed_get(); ASSERT(config.shouldBalance()); ASSERT(config.shouldBalanceForAutoSplit()); @@ -194,7 +194,7 @@ TEST_F(BalancerConfigurationTestFixture, BalancerSettingsDocumentBalanceForAutoS expectSettingsQuery(AutoSplitSettingsType::kKey, boost::optional<BSONObj>(BSON("enabled" << true))); - future.timed_get(kFutureTimeout); + future.default_timed_get(); ASSERT(!config.shouldBalance()); ASSERT(config.shouldBalanceForAutoSplit()); diff --git a/src/mongo/s/catalog/dist_lock_catalog_impl_test.cpp b/src/mongo/s/catalog/dist_lock_catalog_impl_test.cpp index e0c9db25298..4b11d710a44 100644 --- a/src/mongo/s/catalog/dist_lock_catalog_impl_test.cpp +++ b/src/mongo/s/catalog/dist_lock_catalog_impl_test.cpp @@ -141,7 +141,7 @@ TEST_F(DistLockCatalogTest, BasicPing) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, PingTargetError) { @@ -173,7 +173,7 @@ TEST_F(DistLockCatalogTest, PingCommandError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, PingWriteError) { @@ -191,7 +191,7 @@ TEST_F(DistLockCatalogTest, PingWriteError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, PingWriteConcernError) { @@ -212,7 +212,7 @@ TEST_F(DistLockCatalogTest, PingWriteConcernError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, PingUnsupportedWriteConcernResponse) { @@ -234,7 +234,7 @@ TEST_F(DistLockCatalogTest, PingUnsupportedWriteConcernResponse) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, PingUnsupportedResponseFormat) { @@ -248,7 +248,7 @@ TEST_F(DistLockCatalogTest, PingUnsupportedResponseFormat) { << "NaN"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GrabLockNoOp) { @@ -290,7 +290,7 @@ TEST_F(DistLockCatalogTest, GrabLockNoOp) { return fromjson("{ ok: 1, value: null }"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GrabLockWithNewDoc) { @@ -354,7 +354,7 @@ TEST_F(DistLockCatalogTest, GrabLockWithNewDoc) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GrabLockWithBadLockDoc) { @@ -387,7 +387,7 @@ TEST_F(DistLockCatalogTest, GrabLockWithBadLockDoc) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GrabLockTargetError) { @@ -425,7 +425,7 @@ TEST_F(DistLockCatalogTest, GrabLockCommandError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GrabLockDupKeyError) { @@ -445,7 +445,7 @@ TEST_F(DistLockCatalogTest, GrabLockDupKeyError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GrabLockWriteError) { @@ -465,7 +465,7 @@ TEST_F(DistLockCatalogTest, GrabLockWriteError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GrabLockWriteConcernError) { @@ -488,7 +488,7 @@ TEST_F(DistLockCatalogTest, GrabLockWriteConcernError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GrabLockWriteConcernErrorBadType) { @@ -509,7 +509,7 @@ TEST_F(DistLockCatalogTest, GrabLockWriteConcernErrorBadType) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GrabLockResponseMissingValueField) { @@ -527,7 +527,7 @@ TEST_F(DistLockCatalogTest, GrabLockResponseMissingValueField) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GrabLockUnsupportedWriteConcernResponse) { @@ -551,7 +551,7 @@ TEST_F(DistLockCatalogTest, GrabLockUnsupportedWriteConcernResponse) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GrabLockUnsupportedResponseFormat) { @@ -567,7 +567,7 @@ TEST_F(DistLockCatalogTest, GrabLockUnsupportedResponseFormat) { << "NaN"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, OvertakeLockNoOp) { @@ -616,7 +616,7 @@ TEST_F(DistLockCatalogTest, OvertakeLockNoOp) { return fromjson("{ ok: 1, value: null }"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, OvertakeLockWithNewDoc) { @@ -685,7 +685,7 @@ TEST_F(DistLockCatalogTest, OvertakeLockWithNewDoc) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, OvertakeLockWithBadLockDoc) { @@ -720,7 +720,7 @@ TEST_F(DistLockCatalogTest, OvertakeLockWithBadLockDoc) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, OvertakeLockTargetError) { @@ -761,7 +761,7 @@ TEST_F(DistLockCatalogTest, OvertakeLockCommandError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, OvertakeLockWriteError) { @@ -782,7 +782,7 @@ TEST_F(DistLockCatalogTest, OvertakeLockWriteError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, OvertakeLockWriteConcernError) { @@ -806,7 +806,7 @@ TEST_F(DistLockCatalogTest, OvertakeLockWriteConcernError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, OvertakeLockUnsupportedWriteConcernResponse) { @@ -831,7 +831,7 @@ TEST_F(DistLockCatalogTest, OvertakeLockUnsupportedWriteConcernResponse) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, OvertakeLockUnsupportedResponseFormat) { @@ -848,7 +848,7 @@ TEST_F(DistLockCatalogTest, OvertakeLockUnsupportedResponseFormat) { << "NaN"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, BasicUnlock) { @@ -882,7 +882,7 @@ TEST_F(DistLockCatalogTest, BasicUnlock) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, BasicUnlockWithName) { @@ -916,7 +916,7 @@ TEST_F(DistLockCatalogTest, BasicUnlockWithName) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, UnlockWithNoNewDoc) { @@ -946,7 +946,7 @@ TEST_F(DistLockCatalogTest, UnlockWithNoNewDoc) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, UnlockWithNameWithNoNewDoc) { @@ -976,7 +976,7 @@ TEST_F(DistLockCatalogTest, UnlockWithNameWithNoNewDoc) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, UnlockTargetError) { @@ -1008,7 +1008,7 @@ TEST_F(DistLockCatalogTest, UnlockCommandError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, UnlockWriteError) { @@ -1026,7 +1026,7 @@ TEST_F(DistLockCatalogTest, UnlockWriteError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, UnlockWriteConcernError) { @@ -1059,7 +1059,7 @@ TEST_F(DistLockCatalogTest, UnlockWriteConcernError) { return writeConcernFailedResponse; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, UnlockUnsupportedWriteConcernResponse) { @@ -1081,7 +1081,7 @@ TEST_F(DistLockCatalogTest, UnlockUnsupportedWriteConcernResponse) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, UnlockUnsupportedResponseFormat) { @@ -1095,7 +1095,7 @@ TEST_F(DistLockCatalogTest, UnlockUnsupportedResponseFormat) { << "NaN"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, BasicUnlockAll) { @@ -1129,7 +1129,7 @@ TEST_F(DistLockCatalogTest, BasicUnlockAll) { return BSON("ok" << 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, UnlockAllWriteFailed) { @@ -1143,7 +1143,7 @@ TEST_F(DistLockCatalogTest, UnlockAllWriteFailed) { << "something went wrong"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, UnlockAllNetworkError) { @@ -1158,7 +1158,7 @@ TEST_F(DistLockCatalogTest, UnlockAllNetworkError) { }); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, BasicGetServerInfo) { @@ -1187,7 +1187,7 @@ TEST_F(DistLockCatalogTest, BasicGetServerInfo) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetServerTargetError) { @@ -1219,7 +1219,7 @@ TEST_F(DistLockCatalogTest, GetServerCommandError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetServerBadElectionId) { @@ -1240,7 +1240,7 @@ TEST_F(DistLockCatalogTest, GetServerBadElectionId) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetServerBadLocalTime) { @@ -1261,7 +1261,7 @@ TEST_F(DistLockCatalogTest, GetServerBadLocalTime) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetServerNoGLEStats) { @@ -1278,7 +1278,7 @@ TEST_F(DistLockCatalogTest, GetServerNoGLEStats) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetServerNoElectionId) { @@ -1299,7 +1299,7 @@ TEST_F(DistLockCatalogTest, GetServerNoElectionId) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetServerInvalidReplSubsectionShouldFail) { @@ -1319,7 +1319,7 @@ TEST_F(DistLockCatalogTest, GetServerInvalidReplSubsectionShouldFail) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetServerNoElectionIdButMasterShouldFail) { @@ -1340,7 +1340,7 @@ TEST_F(DistLockCatalogTest, GetServerNoElectionIdButMasterShouldFail) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, BasicStopPing) { @@ -1372,7 +1372,7 @@ TEST_F(DistLockCatalogTest, BasicStopPing) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, StopPingTargetError) { @@ -1404,7 +1404,7 @@ TEST_F(DistLockCatalogTest, StopPingCommandError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, StopPingWriteError) { @@ -1422,7 +1422,7 @@ TEST_F(DistLockCatalogTest, StopPingWriteError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, StopPingWriteConcernError) { @@ -1443,7 +1443,7 @@ TEST_F(DistLockCatalogTest, StopPingWriteConcernError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, StopPingUnsupportedWriteConcernResponse) { @@ -1465,7 +1465,7 @@ TEST_F(DistLockCatalogTest, StopPingUnsupportedWriteConcernResponse) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, StopPingUnsupportedResponseFormat) { @@ -1479,7 +1479,7 @@ TEST_F(DistLockCatalogTest, StopPingUnsupportedResponseFormat) { << "NaN"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, BasicGetPing) { @@ -1516,7 +1516,7 @@ TEST_F(DistLockCatalogTest, BasicGetPing) { return result; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetPingTargetError) { @@ -1544,7 +1544,7 @@ TEST_F(DistLockCatalogTest, GetPingNotFound) { return std::vector<BSONObj>(); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetPingUnsupportedFormat) { @@ -1567,7 +1567,7 @@ TEST_F(DistLockCatalogTest, GetPingUnsupportedFormat) { return result; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, BasicGetLockByTS) { @@ -1602,7 +1602,7 @@ TEST_F(DistLockCatalogTest, BasicGetLockByTS) { return result; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetLockByTSTargetError) { @@ -1629,7 +1629,7 @@ TEST_F(DistLockCatalogTest, GetLockByTSNotFound) { return std::vector<BSONObj>(); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetLockByTSUnsupportedFormat) { @@ -1652,7 +1652,7 @@ TEST_F(DistLockCatalogTest, GetLockByTSUnsupportedFormat) { return result; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, BasicGetLockByName) { @@ -1689,7 +1689,7 @@ TEST_F(DistLockCatalogTest, BasicGetLockByName) { return result; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetLockByNameTargetError) { @@ -1717,7 +1717,7 @@ TEST_F(DistLockCatalogTest, GetLockByNameNotFound) { return std::vector<BSONObj>(); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetLockByNameUnsupportedFormat) { @@ -1740,7 +1740,7 @@ TEST_F(DistLockCatalogTest, GetLockByNameUnsupportedFormat) { return result; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } } // namespace diff --git a/src/mongo/s/catalog/sharding_catalog_log_change_test.cpp b/src/mongo/s/catalog/sharding_catalog_log_change_test.cpp index 88ce211eb6f..5afec608265 100644 --- a/src/mongo/s/catalog/sharding_catalog_log_change_test.cpp +++ b/src/mongo/s/catalog/sharding_catalog_log_change_test.cpp @@ -55,7 +55,6 @@ using executor::TaskExecutor; using stdx::async; using unittest::assertGet; -const Seconds kFutureTimeout{5}; const HostAndPort configHost{"TestHost1"}; class InfoLoggingTest : public ShardingTestFixture { @@ -86,7 +85,7 @@ protected: BSON("min" << 3 << "max" << 4)); // Now wait for the logChange call to return - future.timed_get(kFutureTimeout); + future.default_timed_get(); // Now log another change and confirm that we don't re-attempt to create the collection future = launchAsync([this] { @@ -102,7 +101,7 @@ protected: BSON("min" << 4 << "max" << 5)); // Now wait for the logChange call to return - future.timed_get(kFutureTimeout); + future.default_timed_get(); } void noRetryCreateIfAlreadyExists() { @@ -123,7 +122,7 @@ protected: BSON("min" << 3 << "max" << 4)); // Now wait for the logAction call to return - future.timed_get(kFutureTimeout); + future.default_timed_get(); // Now log another change and confirm that we don't re-attempt to create the collection future = launchAsync([this] { @@ -139,7 +138,7 @@ protected: BSON("min" << 4 << "max" << 5)); // Now wait for the logChange call to return - future.timed_get(kFutureTimeout); + future.default_timed_get(); } void createFailure() { @@ -154,7 +153,7 @@ protected: configHost, getConfigCollName(), _cappedSize, createResponseBuilder.obj()); // Now wait for the logAction call to return - future.timed_get(kFutureTimeout); + future.default_timed_get(); // Now log another change and confirm that we *do* attempt to create the collection future = launchAsync([this] { @@ -171,7 +170,7 @@ protected: BSON("min" << 4 << "max" << 5)); // Now wait for the logChange call to return - future.timed_get(kFutureTimeout); + future.default_timed_get(); } std::string getConfigCollName() const { diff --git a/src/mongo/s/catalog/sharding_catalog_test.cpp b/src/mongo/s/catalog/sharding_catalog_test.cpp index 91e1af67748..3d4a15319e6 100644 --- a/src/mongo/s/catalog/sharding_catalog_test.cpp +++ b/src/mongo/s/catalog/sharding_catalog_test.cpp @@ -128,7 +128,7 @@ TEST_F(ShardingCatalogClientTest, GetCollectionExisting) { }); // Now wait for the getCollection call to return - const auto collOpTimePair = future.timed_get(kFutureTimeout); + const auto collOpTimePair = future.default_timed_get(); ASSERT_EQ(newOpTime, collOpTimePair.opTime); ASSERT_BSONOBJ_EQ(expectedColl.toBSON(), collOpTimePair.value.toBSON()); } @@ -145,7 +145,7 @@ TEST_F(ShardingCatalogClientTest, GetCollectionNotExisting) { onFindCommand([](const RemoteCommandRequest& request) { return vector<BSONObj>{}; }); // Now wait for the getCollection call to return - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, GetDatabaseInvalidName) { @@ -194,7 +194,7 @@ TEST_F(ShardingCatalogClientTest, GetDatabaseExisting) { return std::make_tuple(vector<BSONObj>{expectedDb.toBSON()}, builder.obj()); }); - const auto dbOpTimePair = future.timed_get(kFutureTimeout); + const auto dbOpTimePair = future.default_timed_get(); ASSERT_EQ(newOpTime, dbOpTimePair.opTime); ASSERT_BSONOBJ_EQ(expectedDb.toBSON(), dbOpTimePair.value.toBSON()); } @@ -226,7 +226,7 @@ TEST_F(ShardingCatalogClientTest, GetDatabaseStaleSecondaryRetrySuccess) { return vector<BSONObj>{expectedDb.toBSON()}; }); - const auto dbOpTimePair = future.timed_get(kFutureTimeout); + const auto dbOpTimePair = future.default_timed_get(); ASSERT_BSONOBJ_EQ(expectedDb.toBSON(), dbOpTimePair.value.toBSON()); } @@ -248,7 +248,7 @@ TEST_F(ShardingCatalogClientTest, GetDatabaseStaleSecondaryRetryNoPrimary) { return vector<BSONObj>{}; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, GetDatabaseNotExisting) { @@ -263,7 +263,7 @@ TEST_F(ShardingCatalogClientTest, GetDatabaseNotExisting) { onFindCommand([](const RemoteCommandRequest& request) { return vector<BSONObj>{}; }); onFindCommand([](const RemoteCommandRequest& request) { return vector<BSONObj>{}; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, GetAllShardsValid) { @@ -312,7 +312,7 @@ TEST_F(ShardingCatalogClientTest, GetAllShardsValid) { return vector<BSONObj>{s1.toBSON(), s2.toBSON(), s3.toBSON()}; }); - const vector<ShardType> actualShardsList = future.timed_get(kFutureTimeout); + const vector<ShardType> actualShardsList = future.default_timed_get(); ASSERT_EQ(actualShardsList.size(), expectedShardsList.size()); for (size_t i = 0; i < actualShardsList.size(); ++i) { @@ -342,7 +342,7 @@ TEST_F(ShardingCatalogClientTest, GetAllShardsWithInvalidShard) { }; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, GetChunksForNSWithSortAndLimit) { @@ -414,7 +414,7 @@ TEST_F(ShardingCatalogClientTest, GetChunksForNSWithSortAndLimit) { builder.obj()); }); - const auto& chunks = future.timed_get(kFutureTimeout); + const auto& chunks = future.default_timed_get(); ASSERT_BSONOBJ_EQ(chunkA.toConfigBSON(), chunks[0].toConfigBSON()); ASSERT_BSONOBJ_EQ(chunkB.toConfigBSON(), chunks[1].toConfigBSON()); } @@ -461,7 +461,7 @@ TEST_F(ShardingCatalogClientTest, GetChunksForNSNoSortNoLimit) { return vector<BSONObj>{}; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, GetChunksForNSInvalidChunk) { @@ -504,7 +504,7 @@ TEST_F(ShardingCatalogClientTest, GetChunksForNSInvalidChunk) { return vector<BSONObj>{chunkA.toConfigBSON(), chunkB.toConfigBSON()}; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, RunUserManagementReadCommand) { @@ -539,7 +539,7 @@ TEST_F(ShardingCatalogClientTest, RunUserManagementReadCommand) { return BSON("ok" << 1 << "users" << BSONArrayBuilder().arr()); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, RunUserManagementReadCommandUnsatisfiedReadPref) { @@ -596,7 +596,7 @@ TEST_F(ShardingCatalogClientTest, RunUserManagementWriteCommandSuccess) { }); // Now wait for the runUserManagementWriteCommand call to return - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, RunUserManagementWriteCommandInvalidWriteConcern) { @@ -669,7 +669,7 @@ TEST_F(ShardingCatalogClientTest, RunUserManagementWriteCommandRewriteWriteConce }); // Now wait for the runUserManagementWriteCommand call to return - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, RunUserManagementWriteCommandNotMaster) { @@ -699,7 +699,7 @@ TEST_F(ShardingCatalogClientTest, RunUserManagementWriteCommandNotMaster) { } // Now wait for the runUserManagementWriteCommand call to return - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, RunUserManagementWriteCommandNotMasterRetrySuccess) { @@ -757,7 +757,7 @@ TEST_F(ShardingCatalogClientTest, RunUserManagementWriteCommandNotMasterRetrySuc }); // Now wait for the runUserManagementWriteCommand call to return - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, GetCollectionsValidResultsNoDb) { @@ -824,7 +824,7 @@ TEST_F(ShardingCatalogClientTest, GetCollectionsValidResultsNoDb) { builder.obj()); }); - const auto& actualColls = future.timed_get(kFutureTimeout); + const auto& actualColls = future.default_timed_get(); ASSERT_EQ(3U, actualColls.size()); ASSERT_BSONOBJ_EQ(coll1.toBSON(), actualColls[0].toBSON()); ASSERT_BSONOBJ_EQ(coll2.toBSON(), actualColls[1].toBSON()); @@ -874,7 +874,7 @@ TEST_F(ShardingCatalogClientTest, GetCollectionsValidResultsWithDb) { return vector<BSONObj>{coll1.toBSON(), coll2.toBSON()}; }); - const auto& actualColls = future.timed_get(kFutureTimeout); + const auto& actualColls = future.default_timed_get(); ASSERT_EQ(2U, actualColls.size()); ASSERT_BSONOBJ_EQ(coll1.toBSON(), actualColls[0].toBSON()); ASSERT_BSONOBJ_EQ(coll2.toBSON(), actualColls[1].toBSON()); @@ -923,7 +923,7 @@ TEST_F(ShardingCatalogClientTest, GetCollectionsInvalidCollectionType) { }; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, GetDatabasesForShardValid) { @@ -956,7 +956,7 @@ TEST_F(ShardingCatalogClientTest, GetDatabasesForShardValid) { return vector<BSONObj>{dbt1.toBSON(), dbt2.toBSON()}; }); - const auto& actualDbNames = future.timed_get(kFutureTimeout); + const auto& actualDbNames = future.default_timed_get(); ASSERT_EQ(2U, actualDbNames.size()); ASSERT_EQ(dbt1.getName(), actualDbNames[0]); ASSERT_EQ(dbt2.getName(), actualDbNames[1]); @@ -980,7 +980,7 @@ TEST_F(ShardingCatalogClientTest, GetDatabasesForShardInvalidDoc) { }; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, GetTagsForCollection) { @@ -1025,7 +1025,7 @@ TEST_F(ShardingCatalogClientTest, GetTagsForCollection) { return vector<BSONObj>{tagA.toBSON(), tagB.toBSON()}; }); - const auto& tags = future.timed_get(kFutureTimeout); + const auto& tags = future.default_timed_get(); ASSERT_BSONOBJ_EQ(tagA.toBSON(), tags[0].toBSON()); ASSERT_BSONOBJ_EQ(tagB.toBSON(), tags[1].toBSON()); } @@ -1044,7 +1044,7 @@ TEST_F(ShardingCatalogClientTest, GetTagsForCollectionNoTags) { onFindCommand([](const RemoteCommandRequest& request) { return vector<BSONObj>{}; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, GetTagsForCollectionInvalidTag) { @@ -1073,7 +1073,7 @@ TEST_F(ShardingCatalogClientTest, GetTagsForCollectionInvalidTag) { return vector<BSONObj>{tagA.toBSON(), tagB.toBSON()}; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, UpdateDatabase) { @@ -1119,7 +1119,7 @@ TEST_F(ShardingCatalogClientTest, UpdateDatabase) { }); // Now wait for the updateDatabase call to return - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, UpdateConfigDocumentExceededTimeLimit) { @@ -1155,7 +1155,7 @@ TEST_F(ShardingCatalogClientTest, UpdateConfigDocumentExceededTimeLimit) { }); // Now wait for the updateDatabase call to return - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, ApplyChunkOpsDeprecatedSuccessful) { @@ -1200,7 +1200,7 @@ TEST_F(ShardingCatalogClientTest, ApplyChunkOpsDeprecatedSuccessful) { }); // Now wait for the applyChunkOpsDeprecated call to return - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, ApplyChunkOpsDeprecatedSuccessfulWithCheck) { @@ -1248,7 +1248,7 @@ TEST_F(ShardingCatalogClientTest, ApplyChunkOpsDeprecatedSuccessfulWithCheck) { }); // Now wait for the applyChunkOpsDeprecated call to return - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, ApplyChunkOpsDeprecatedFailedWithCheck) { @@ -1287,7 +1287,7 @@ TEST_F(ShardingCatalogClientTest, ApplyChunkOpsDeprecatedFailedWithCheck) { onFindCommand([this](const RemoteCommandRequest& request) { return vector<BSONObj>{}; }); // Now wait for the applyChunkOpsDeprecated call to return - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, RetryOnFindCommandNetworkErrorFailsAtMaxRetry) { @@ -1305,7 +1305,7 @@ TEST_F(ShardingCatalogClientTest, RetryOnFindCommandNetworkErrorFailsAtMaxRetry) }); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, RetryOnFindCommandNetworkErrorSucceedsAtMaxRetry) { @@ -1331,7 +1331,7 @@ TEST_F(ShardingCatalogClientTest, RetryOnFindCommandNetworkErrorSucceedsAtMaxRet return vector<BSONObj>{dbType.toBSON()}; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, GetNewKeys) { @@ -1379,7 +1379,7 @@ TEST_F(ShardingCatalogClientTest, GetNewKeys) { return vector<BSONObj>{key1.toBSON(), key2.toBSON()}; }); - const auto keyDocs = future.timed_get(kFutureTimeout); + const auto keyDocs = future.default_timed_get(); ASSERT_EQ(2u, keyDocs.size()); const auto& key1Result = keyDocs.front(); @@ -1432,7 +1432,7 @@ TEST_F(ShardingCatalogClientTest, GetNewKeysWithEmptyCollection) { return vector<BSONObj>{}; }); - const auto keyDocs = future.timed_get(kFutureTimeout); + const auto keyDocs = future.default_timed_get(); ASSERT_EQ(0u, keyDocs.size()); } diff --git a/src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp b/src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp index 60b5a5fec92..4ccf4dbd759 100644 --- a/src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp +++ b/src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp @@ -107,7 +107,7 @@ TEST_F(InsertRetryTest, RetryOnInterruptedAndNetworkErrorSuccess) { expectInserts(kTestNamespace, {objToInsert}); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(InsertRetryTest, RetryOnNetworkErrorFails) { @@ -142,7 +142,7 @@ TEST_F(InsertRetryTest, RetryOnNetworkErrorFails) { return Status(ErrorCodes::NetworkTimeout, "Network timeout"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(InsertRetryTest, DuplicateKeyErrorAfterNetworkErrorMatch) { @@ -180,7 +180,7 @@ TEST_F(InsertRetryTest, DuplicateKeyErrorAfterNetworkErrorMatch) { return vector<BSONObj>{objToInsert}; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(InsertRetryTest, DuplicateKeyErrorAfterNetworkErrorNotFound) { @@ -218,7 +218,7 @@ TEST_F(InsertRetryTest, DuplicateKeyErrorAfterNetworkErrorNotFound) { return vector<BSONObj>(); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(InsertRetryTest, DuplicateKeyErrorAfterNetworkErrorMismatch) { @@ -257,7 +257,7 @@ TEST_F(InsertRetryTest, DuplicateKeyErrorAfterNetworkErrorMismatch) { << "TestValue has changed")}; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(InsertRetryTest, DuplicateKeyErrorAfterWriteConcernFailureMatch) { @@ -312,7 +312,7 @@ TEST_F(InsertRetryTest, DuplicateKeyErrorAfterWriteConcernFailureMatch) { return vector<BSONObj>{objToInsert}; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(UpdateRetryTest, Success) { @@ -346,7 +346,7 @@ TEST_F(UpdateRetryTest, Success) { return response.toBSON(); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(UpdateRetryTest, NotMasterErrorReturnedPersistently) { @@ -376,7 +376,7 @@ TEST_F(UpdateRetryTest, NotMasterErrorReturnedPersistently) { }); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(UpdateRetryTest, NotMasterReturnedFromTargeter) { @@ -398,7 +398,7 @@ TEST_F(UpdateRetryTest, NotMasterReturnedFromTargeter) { ASSERT_EQUALS(ErrorCodes::NotMaster, status); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(UpdateRetryTest, NotMasterOnceSuccessAfterRetry) { @@ -452,7 +452,7 @@ TEST_F(UpdateRetryTest, NotMasterOnceSuccessAfterRetry) { return response.toBSON(); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(UpdateRetryTest, OperationInterruptedDueToPrimaryStepDown) { @@ -503,7 +503,7 @@ TEST_F(UpdateRetryTest, OperationInterruptedDueToPrimaryStepDown) { return response.toBSON(); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(UpdateRetryTest, WriteConcernFailure) { @@ -560,7 +560,7 @@ TEST_F(UpdateRetryTest, WriteConcernFailure) { return response.toBSON(); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } } // namespace diff --git a/src/mongo/s/catalog_cache_refresh_test.cpp b/src/mongo/s/catalog_cache_refresh_test.cpp index dd9b9c5eb49..50f53b74e68 100644 --- a/src/mongo/s/catalog_cache_refresh_test.cpp +++ b/src/mongo/s/catalog_cache_refresh_test.cpp @@ -112,7 +112,7 @@ TEST_F(CatalogCacheRefreshTest, FullLoad) { chunk4.toConfigBSON()}; }()); - auto routingInfo = future.timed_get(kFutureTimeout); + auto routingInfo = future.default_timed_get(); ASSERT(routingInfo->cm()); auto cm = routingInfo->cm(); @@ -128,7 +128,7 @@ TEST_F(CatalogCacheRefreshTest, DatabaseNotFound) { expectFindSendBSONObjVector(kConfigHostAndPort, {}); try { - auto routingInfo = future.timed_get(kFutureTimeout); + auto routingInfo = future.default_timed_get(); auto cm = routingInfo->cm(); auto primary = routingInfo->db().primary(); @@ -149,7 +149,7 @@ TEST_F(CatalogCacheRefreshTest, DatabaseBSONCorrupted) { << "This value should not be in a database config document")}); try { - auto routingInfo = future.timed_get(kFutureTimeout); + auto routingInfo = future.default_timed_get(); auto cm = routingInfo->cm(); auto primary = routingInfo->db().primary(); @@ -168,7 +168,7 @@ TEST_F(CatalogCacheRefreshTest, CollectionNotFound) { // Return an empty collection expectFindSendBSONObjVector(kConfigHostAndPort, {}); - auto routingInfo = future.timed_get(kFutureTimeout); + auto routingInfo = future.default_timed_get(); ASSERT(!routingInfo->cm()); ASSERT(routingInfo->db().primary()); ASSERT_EQ(ShardId{"0"}, routingInfo->db().primaryId()); @@ -186,7 +186,7 @@ TEST_F(CatalogCacheRefreshTest, CollectionBSONCorrupted) { << "This value should not be in a collection config document")}); try { - auto routingInfo = future.timed_get(kFutureTimeout); + auto routingInfo = future.default_timed_get(); auto cm = routingInfo->cm(); auto primary = routingInfo->db().primary(); @@ -217,7 +217,7 @@ TEST_F(CatalogCacheRefreshTest, NoChunksFoundForCollection) { expectFindSendBSONObjVector(kConfigHostAndPort, {}); try { - auto routingInfo = future.timed_get(kFutureTimeout); + auto routingInfo = future.default_timed_get(); auto cm = routingInfo->cm(); auto primary = routingInfo->db().primary(); @@ -251,7 +251,7 @@ TEST_F(CatalogCacheRefreshTest, ChunksBSONCorrupted) { }()); try { - auto routingInfo = future.timed_get(kFutureTimeout); + auto routingInfo = future.default_timed_get(); auto cm = routingInfo->cm(); auto primary = routingInfo->db().primary(); @@ -306,7 +306,7 @@ TEST_F(CatalogCacheRefreshTest, IncompleteChunksFoundForCollection) { expectFindSendBSONObjVector(kConfigHostAndPort, incompleteChunks); try { - auto routingInfo = future.timed_get(kFutureTimeout); + auto routingInfo = future.default_timed_get(); auto cm = routingInfo->cm(); auto primary = routingInfo->db().primary(); @@ -353,7 +353,7 @@ TEST_F(CatalogCacheRefreshTest, ChunkEpochChangeDuringIncrementalLoad) { expectFindSendBSONObjVector(kConfigHostAndPort, inconsistentChunks); try { - auto routingInfo = future.timed_get(kFutureTimeout); + auto routingInfo = future.default_timed_get(); auto cm = routingInfo->cm(); auto primary = routingInfo->db().primary(); @@ -437,7 +437,7 @@ TEST_F(CatalogCacheRefreshTest, ChunkEpochChangeDuringIncrementalLoadRecoveryAft chunk1.toConfigBSON(), chunk2.toConfigBSON(), chunk3.toConfigBSON()}; }); - auto routingInfo = future.timed_get(kFutureTimeout); + auto routingInfo = future.default_timed_get(); ASSERT(routingInfo->cm()); auto cm = routingInfo->cm(); @@ -484,7 +484,7 @@ TEST_F(CatalogCacheRefreshTest, IncrementalLoadAfterCollectionEpochChange) { return std::vector<BSONObj>{chunk1.toConfigBSON(), chunk2.toConfigBSON()}; }); - auto routingInfo = future.timed_get(kFutureTimeout); + auto routingInfo = future.default_timed_get(); ASSERT(routingInfo->cm()); auto cm = routingInfo->cm(); @@ -527,7 +527,7 @@ TEST_F(CatalogCacheRefreshTest, IncrementalLoadAfterSplit) { return std::vector<BSONObj>{chunk1.toConfigBSON(), chunk2.toConfigBSON()}; }); - auto routingInfo = future.timed_get(kFutureTimeout); + auto routingInfo = future.default_timed_get(); ASSERT(routingInfo->cm()); auto cm = routingInfo->cm(); @@ -566,7 +566,7 @@ TEST_F(CatalogCacheRefreshTest, IncrementalLoadAfterMove) { return std::vector<BSONObj>{chunk1.toConfigBSON(), chunk2.toConfigBSON()}; }()); - auto routingInfo = future.timed_get(kFutureTimeout); + auto routingInfo = future.default_timed_get(); ASSERT(routingInfo->cm()); auto cm = routingInfo->cm(); @@ -602,7 +602,7 @@ TEST_F(CatalogCacheRefreshTest, IncrementalLoadAfterMoveLastChunk) { return std::vector<BSONObj>{chunk1.toConfigBSON()}; }()); - auto routingInfo = future.timed_get(kFutureTimeout); + auto routingInfo = future.default_timed_get(); ASSERT(routingInfo->cm()); auto cm = routingInfo->cm(); diff --git a/src/mongo/s/catalog_cache_test_fixture.cpp b/src/mongo/s/catalog_cache_test_fixture.cpp index 64185ba45b5..ea597e8cf14 100644 --- a/src/mongo/s/catalog_cache_test_fixture.cpp +++ b/src/mongo/s/catalog_cache_test_fixture.cpp @@ -154,7 +154,7 @@ std::shared_ptr<ChunkManager> CatalogCacheTestFixture::makeChunkManager( expectFindSendBSONObjVector(kConfigHostAndPort, {collectionBSON}); expectFindSendBSONObjVector(kConfigHostAndPort, initialChunks); - auto routingInfo = future.timed_get(kFutureTimeout); + auto routingInfo = future.default_timed_get(); ASSERT(routingInfo->cm()); ASSERT(routingInfo->db().primary()); @@ -207,7 +207,7 @@ CachedCollectionRoutingInfo CatalogCacheTestFixture::loadRoutingTableWithTwoChun return std::vector<BSONObj>{chunk1.toConfigBSON(), chunk2.toConfigBSON()}; }()); - return future.timed_get(kFutureTimeout).get(); + return future.default_timed_get().get(); } } // namespace mongo diff --git a/src/mongo/s/client/shard_remote_test.cpp b/src/mongo/s/client/shard_remote_test.cpp index 44cd9484d87..96f55f7fd74 100644 --- a/src/mongo/s/client/shard_remote_test.cpp +++ b/src/mongo/s/client/shard_remote_test.cpp @@ -130,7 +130,7 @@ TEST_F(ShardRemoteTest, NetworkReplyWithLastCommittedOpTime) { return std::make_tuple(result, metadata); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); // Verify the targeted shard has updated its lastCommittedOpTime. ASSERT_EQ(expectedTime, @@ -157,7 +157,7 @@ TEST_F(ShardRemoteTest, NetworkReplyWithoutLastCommittedOpTime) { return std::make_tuple(result, metadata); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); // Verify the targeted shard has not updated its lastCommittedOpTime. ASSERT_EQ(LogicalTime::kUninitialized, @@ -193,7 +193,7 @@ TEST_F(ShardRemoteTest, ScatterGatherRepliesWithLastCommittedOpTime) { }); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); // Verify all shards updated their lastCommittedOpTime. for (auto shardId : kTestShardIds) { diff --git a/src/mongo/s/cluster_identity_loader_test.cpp b/src/mongo/s/cluster_identity_loader_test.cpp index 4176cb68a15..f851a9986c2 100644 --- a/src/mongo/s/cluster_identity_loader_test.cpp +++ b/src/mongo/s/cluster_identity_loader_test.cpp @@ -118,7 +118,7 @@ TEST_F(ClusterIdentityTest, BasicLoadSuccess) { expectConfigVersionLoad(clusterId); - future.timed_get(kFutureTimeout); + future.default_timed_get(); // Subsequent requests for the cluster ID should not require any network traffic as we consult // the cached version. @@ -154,9 +154,9 @@ TEST_F(ClusterIdentityTest, MultipleThreadsLoadingSuccess) { expectConfigVersionLoad(clusterId); - future1.timed_get(kFutureTimeout); - future2.timed_get(kFutureTimeout); - future3.timed_get(kFutureTimeout); + future1.default_timed_get(); + future2.default_timed_get(); + future3.default_timed_get(); } TEST_F(ClusterIdentityTest, BasicLoadFailureFollowedBySuccess) { @@ -171,7 +171,7 @@ TEST_F(ClusterIdentityTest, BasicLoadFailureFollowedBySuccess) { expectConfigVersionLoad(Status(ErrorCodes::Interrupted, "interrupted")); - future.timed_get(kFutureTimeout); + future.default_timed_get(); // After a failure to load the cluster ID, subsequent attempts to get the cluster ID should // retry loading it. @@ -185,7 +185,7 @@ TEST_F(ClusterIdentityTest, BasicLoadFailureFollowedBySuccess) { expectConfigVersionLoad(clusterId); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } } // namespace diff --git a/src/mongo/s/cluster_last_error_info_test.cpp b/src/mongo/s/cluster_last_error_info_test.cpp index eb109cdf42c..c5541724a84 100644 --- a/src/mongo/s/cluster_last_error_info_test.cpp +++ b/src/mongo/s/cluster_last_error_info_test.cpp @@ -93,7 +93,7 @@ TEST_F(ClusterGetLastErrorTest, return RemoteCommandResponse(BSON("ok" << 1), metadataBob.obj(), Milliseconds(1)); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); // Ensure the last error info was updated with the contacted host and returned opTime. @@ -138,7 +138,7 @@ TEST_F(ClusterGetLastErrorTest, ClusterLastErrorInfoNotUpdatedIfNotInitialized) return RemoteCommandResponse(BSON("ok" << 1), metadataBob.obj(), Milliseconds(1)); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); // Ensure the clusterGLE on the Client has still not been initialized. ASSERT(!ClusterLastErrorInfo::get(client)); @@ -179,7 +179,7 @@ TEST_F(ClusterGetLastErrorTest, ClusterLastErrorInfoNotUpdatedIfReplyDoesntHaveS return RemoteCommandResponse(BSON("ok" << 1), BSONObj(), Milliseconds(1)); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); // Ensure the last error info was not updated. diff --git a/src/mongo/s/commands/cluster_aggregate_test.cpp b/src/mongo/s/commands/cluster_aggregate_test.cpp index 59ffa830242..54c1509eb5a 100644 --- a/src/mongo/s/commands/cluster_aggregate_test.cpp +++ b/src/mongo/s/commands/cluster_aggregate_test.cpp @@ -146,7 +146,7 @@ protected: expectAggReturnsSuccess(i % numShards); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } void runAggCommandOneError(BSONObj cmd, ErrorCodes::Error code, bool isTargeted) { @@ -163,7 +163,7 @@ protected: expectAggReturnsSuccess(i % numShards); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } void runCommandInspectRequests(BSONObj cmd, InspectionCallback cb, bool isTargeted) { @@ -174,7 +174,7 @@ protected: expectAggInspectRequest(i % numShards, cb); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } void runAggCommandMaxErrors(BSONObj cmd, ErrorCodes::Error code, bool isTargeted) { @@ -186,7 +186,7 @@ protected: expectAggReturnsError(code); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } /** diff --git a/src/mongo/s/query/async_results_merger_test.cpp b/src/mongo/s/query/async_results_merger_test.cpp index 5d9b08480a0..2384a0a78e5 100644 --- a/src/mongo/s/query/async_results_merger_test.cpp +++ b/src/mongo/s/query/async_results_merger_test.cpp @@ -2075,7 +2075,7 @@ TEST_F(AsyncResultsMergerTest, ShouldBeAbleToBlockUntilNextResultIsReady) { .toBSON(CursorResponse::ResponseType::SubsequentResponse); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(AsyncResultsMergerTest, ShouldBeInterruptableDuringBlockingNext) { @@ -2095,7 +2095,7 @@ TEST_F(AsyncResultsMergerTest, ShouldBeInterruptableDuringBlockingNext) { stdx::lock_guard<Client> lk(*operationContext()->getClient()); operationContext()->markKilled(ErrorCodes::Interrupted); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); // Be careful not to use a blocking kill here, since the main thread is in charge of running the // callbacks, and we'd block on ourselves. auto killEvent = arm->kill(operationContext()); diff --git a/src/mongo/s/query/cluster_find_test.cpp b/src/mongo/s/query/cluster_find_test.cpp index f05e7d2e639..5fd48631942 100644 --- a/src/mongo/s/query/cluster_find_test.cpp +++ b/src/mongo/s/query/cluster_find_test.cpp @@ -145,7 +145,7 @@ protected: expectFindReturnsSuccess(i % numShards); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } void runFindCommandOneError(BSONObj cmd, ErrorCodes::Error code, bool isTargeted) { @@ -162,7 +162,7 @@ protected: expectFindReturnsSuccess(i % numShards); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } void runFindCommandMaxErrors(BSONObj cmd, ErrorCodes::Error code, bool isTargeted) { @@ -175,7 +175,7 @@ protected: expectFindReturnsError(code); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } void runFindCommandInspectRequests(BSONObj cmd, InspectionCallback cb, bool isTargeted) { @@ -186,7 +186,7 @@ protected: expectFindInspectRequest(i % numShards, cb); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } }; diff --git a/src/mongo/s/query/establish_cursors_test.cpp b/src/mongo/s/query/establish_cursors_test.cpp index eb3520561a6..e7b8ceaecb2 100644 --- a/src/mongo/s/query/establish_cursors_test.cpp +++ b/src/mongo/s/query/establish_cursors_test.cpp @@ -125,7 +125,7 @@ TEST_F(EstablishCursorsTest, SingleRemoteRespondsWithSuccess) { return cursorResponse.toBSON(CursorResponse::ResponseType::InitialResponse); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, SingleRemoteRespondsWithNonretriableError) { @@ -147,7 +147,7 @@ TEST_F(EstablishCursorsTest, SingleRemoteRespondsWithNonretriableError) { ASSERT_EQ(_nss.coll(), request.cmdObj.firstElement().valueStringData()); return Status(ErrorCodes::FailedToParse, "failed to parse"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, SingleRemoteRespondsWithNonretriableErrorAllowPartialResults) { @@ -170,7 +170,7 @@ TEST_F(EstablishCursorsTest, SingleRemoteRespondsWithNonretriableErrorAllowParti ASSERT_EQ(_nss.coll(), request.cmdObj.firstElement().valueStringData()); return Status(ErrorCodes::FailedToParse, "failed to parse"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, SingleRemoteRespondsWithRetriableErrorThenSuccess) { @@ -202,7 +202,7 @@ TEST_F(EstablishCursorsTest, SingleRemoteRespondsWithRetriableErrorThenSuccess) return cursorResponse.toBSON(CursorResponse::ResponseType::InitialResponse); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, SingleRemoteRespondsWithRetriableErrorThenSuccessAllowPartialResults) { @@ -235,7 +235,7 @@ TEST_F(EstablishCursorsTest, SingleRemoteRespondsWithRetriableErrorThenSuccessAl return cursorResponse.toBSON(CursorResponse::ResponseType::InitialResponse); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, SingleRemoteMaxesOutRetriableErrors) { @@ -259,7 +259,7 @@ TEST_F(EstablishCursorsTest, SingleRemoteMaxesOutRetriableErrors) { return Status(ErrorCodes::HostUnreachable, "host unreachable"); }); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, SingleRemoteMaxesOutRetriableErrorsAllowPartialResults) { @@ -287,7 +287,7 @@ TEST_F(EstablishCursorsTest, SingleRemoteMaxesOutRetriableErrorsAllowPartialResu return Status(ErrorCodes::HostUnreachable, "host unreachable"); }); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, MultipleRemotesRespondWithSuccess) { @@ -316,7 +316,7 @@ TEST_F(EstablishCursorsTest, MultipleRemotesRespondWithSuccess) { }); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, MultipleRemotesOneRemoteRespondsWithNonretriableError) { @@ -358,7 +358,7 @@ TEST_F(EstablishCursorsTest, MultipleRemotesOneRemoteRespondsWithNonretriableErr return cursorResponse.toBSON(CursorResponse::ResponseType::InitialResponse); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, @@ -402,7 +402,7 @@ TEST_F(EstablishCursorsTest, return cursorResponse.toBSON(CursorResponse::ResponseType::InitialResponse); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, MultipleRemotesOneRemoteRespondsWithRetriableErrorThenSuccess) { @@ -453,7 +453,7 @@ TEST_F(EstablishCursorsTest, MultipleRemotesOneRemoteRespondsWithRetriableErrorT return cursorResponse.toBSON(CursorResponse::ResponseType::InitialResponse); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, @@ -505,7 +505,7 @@ TEST_F(EstablishCursorsTest, return cursorResponse.toBSON(CursorResponse::ResponseType::InitialResponse); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, MultipleRemotesOneRemoteMaxesOutRetriableErrors) { @@ -555,7 +555,7 @@ TEST_F(EstablishCursorsTest, MultipleRemotesOneRemoteMaxesOutRetriableErrors) { }); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, MultipleRemotesOneRemoteMaxesOutRetriableErrorsAllowPartialResults) { @@ -607,7 +607,7 @@ TEST_F(EstablishCursorsTest, MultipleRemotesOneRemoteMaxesOutRetriableErrorsAllo }); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } } // namespace diff --git a/src/mongo/s/sharding_router_test_fixture.cpp b/src/mongo/s/sharding_router_test_fixture.cpp index d74c03bed43..3134a77a7d1 100644 --- a/src/mongo/s/sharding_router_test_fixture.cpp +++ b/src/mongo/s/sharding_router_test_fixture.cpp @@ -290,7 +290,7 @@ void ShardingTestFixture::setupShards(const std::vector<ShardType>& shards) { expectGetShards(shards); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } void ShardingTestFixture::expectGetShards(const std::vector<ShardType>& shards) { diff --git a/src/mongo/s/sharding_test_fixture_common.cpp b/src/mongo/s/sharding_test_fixture_common.cpp index 04eb0324160..8b6696107e4 100644 --- a/src/mongo/s/sharding_test_fixture_common.cpp +++ b/src/mongo/s/sharding_test_fixture_common.cpp @@ -34,8 +34,6 @@ namespace mongo { -constexpr Seconds ShardingTestFixtureCommon::kFutureTimeout; - ShardingTestFixtureCommon::ShardingTestFixtureCommon() = default; ShardingTestFixtureCommon::~ShardingTestFixtureCommon() = default; diff --git a/src/mongo/s/sharding_test_fixture_common.h b/src/mongo/s/sharding_test_fixture_common.h index 069e9aea220..133bca4ada7 100644 --- a/src/mongo/s/sharding_test_fixture_common.h +++ b/src/mongo/s/sharding_test_fixture_common.h @@ -49,8 +49,6 @@ class TaskExecutor; */ class ShardingTestFixtureCommon { public: - static constexpr Seconds kFutureTimeout{5}; - ShardingTestFixtureCommon(); ~ShardingTestFixtureCommon(); diff --git a/src/mongo/s/write_ops/batch_write_exec_test.cpp b/src/mongo/s/write_ops/batch_write_exec_test.cpp index 84d0b08ad08..470a8d32336 100644 --- a/src/mongo/s/write_ops/batch_write_exec_test.cpp +++ b/src/mongo/s/write_ops/batch_write_exec_test.cpp @@ -260,7 +260,7 @@ TEST_F(BatchWriteExecTest, SingleOp) { expectInsertsReturnSuccess(std::vector<BSONObj>{BSON("x" << 1)}); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(BatchWriteExecTest, MultiOpLarge) { @@ -299,7 +299,7 @@ TEST_F(BatchWriteExecTest, MultiOpLarge) { expectInsertsReturnSuccess(docsToInsert.begin(), docsToInsert.begin() + 66576); expectInsertsReturnSuccess(docsToInsert.begin() + 66576, docsToInsert.end()); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(BatchWriteExecTest, SingleOpError) { @@ -335,7 +335,7 @@ TEST_F(BatchWriteExecTest, SingleOpError) { expectInsertsReturnError({BSON("x" << 1)}, errResponse); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } void serializeErrorToBSON(const Status& status, BSONObjBuilder* builder) { @@ -437,7 +437,7 @@ TEST_F(BatchWriteExecTest, StaleShardVersionReturnedFromBatchWithSingleMultiWrit return response.toBSON(); }); - auto response = future.timed_get(kFutureTimeout); + auto response = future.default_timed_get(); ASSERT_OK(response.getTopLevelStatus()); ASSERT_EQ(3, response.getNModified()); @@ -552,7 +552,7 @@ TEST_F(BatchWriteExecTest, return response.toBSON(); }); - auto response = future.timed_get(kFutureTimeout); + auto response = future.default_timed_get(); ASSERT_OK(response.getTopLevelStatus()); ASSERT_EQ(3, response.getNModified()); } @@ -676,7 +676,7 @@ TEST_F(BatchWriteExecTest, RetryableErrorReturnedFromMultiWriteWithShard1FirstOK return response.toBSON(); }); - auto response = future.timed_get(kFutureTimeout); + auto response = future.default_timed_get(); ASSERT_OK(response.getTopLevelStatus()); ASSERT_EQ(2, response.getNModified()); } @@ -800,7 +800,7 @@ TEST_F(BatchWriteExecTest, RetryableErrorReturnedFromMultiWriteWithShard1FirstOK return response.toBSON(); }); - auto response = future.timed_get(kFutureTimeout); + auto response = future.default_timed_get(); ASSERT_OK(response.getTopLevelStatus()); ASSERT_EQ(2, response.getNModified()); } @@ -897,7 +897,7 @@ TEST_F(BatchWriteExecTest, RetryableErrorReturnedFromWriteWithShard1SSVShard2OK) return response.toBSON(); }); - auto response = future.timed_get(kFutureTimeout); + auto response = future.default_timed_get(); ASSERT_OK(response.getTopLevelStatus()); ASSERT_EQ(1, response.getNModified()); ASSERT_EQ(1, response.getN()); @@ -937,7 +937,7 @@ TEST_F(BatchWriteExecTest, StaleOp) { expectInsertsReturnStaleVersionErrors(expected); expectInsertsReturnSuccess(expected); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(BatchWriteExecTest, MultiStaleOp) { @@ -972,7 +972,7 @@ TEST_F(BatchWriteExecTest, MultiStaleOp) { expectInsertsReturnSuccess(expected); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(BatchWriteExecTest, TooManyStaleShardOp) { @@ -1011,7 +1011,7 @@ TEST_F(BatchWriteExecTest, TooManyStaleShardOp) { expectInsertsReturnStaleVersionErrors({BSON("x" << 1), BSON("x" << 2)}); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(BatchWriteExecTest, RetryableWritesLargeBatch) { @@ -1055,7 +1055,7 @@ TEST_F(BatchWriteExecTest, RetryableWritesLargeBatch) { expectInsertsReturnSuccess(docsToInsert.begin(), docsToInsert.begin() + 63791); expectInsertsReturnSuccess(docsToInsert.begin() + 63791, docsToInsert.end()); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(BatchWriteExecTest, RetryableErrorNoTxnNumber) { @@ -1094,7 +1094,7 @@ TEST_F(BatchWriteExecTest, RetryableErrorNoTxnNumber) { expectInsertsReturnError({BSON("x" << 1), BSON("x" << 2)}, retryableErrResponse); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(BatchWriteExecTest, RetryableErrorTxnNumber) { @@ -1132,7 +1132,7 @@ TEST_F(BatchWriteExecTest, RetryableErrorTxnNumber) { expectInsertsReturnError({BSON("x" << 1), BSON("x" << 2)}, retryableErrResponse); expectInsertsReturnSuccess({BSON("x" << 1), BSON("x" << 2)}); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(BatchWriteExecTest, NonRetryableErrorTxnNumber) { @@ -1174,8 +1174,7 @@ TEST_F(BatchWriteExecTest, NonRetryableErrorTxnNumber) { expectInsertsReturnError({BSON("x" << 1), BSON("x" << 2)}, nonRetryableErrResponse); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } - } // namespace } // namespace mongo |