diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2019-03-15 12:35:18 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2019-03-18 14:33:38 -0400 |
commit | f4375654883489542379abdd627f8e3454f34eaa (patch) | |
tree | e1b9eb6b55579788ea8bad52650a50286098ce56 /src/mongo | |
parent | 41d912bb27877d7965aa64b51c4cd7a8c79590cc (diff) | |
download | mongo-f4375654883489542379abdd627f8e3454f34eaa.tar.gz |
SERVER-40170 Increase the sharding unit-tests async work future timeout
Diffstat (limited to 'src/mongo')
31 files changed, 289 insertions, 289 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 9e52d29a53c..e6b26b06c70 100644 --- a/src/mongo/db/pipeline/document_source_merge_cursors_test.cpp +++ b/src/mongo/db/pipeline/document_source_merge_cursors_test.cpp @@ -265,7 +265,7 @@ TEST_F(DocumentSourceMergeCursorsTest, ShouldBeAbleToIterateCursorsUntilEOF) { return cursorResponseObj(expCtx->ns, kExhaustedCursorID, {BSON("x" << 1)}); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DocumentSourceMergeCursorsTest, ShouldNotKillCursorsIfTheyAreNotOwned) { @@ -330,7 +330,7 @@ TEST_F(DocumentSourceMergeCursorsTest, ShouldKillCursorIfPartiallyIterated) { // anything except {ok: 1}. return BSON("ok" << 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DocumentSourceMergeCursorsTest, ShouldEnforceSortSpecifiedViaARMParams) { @@ -378,7 +378,7 @@ TEST_F(DocumentSourceMergeCursorsTest, ShouldEnforceSortSpecifiedViaARMParams) { BSON("x" << 4 << "$sortKey" << BSON("" << 4))}); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } } // namespace } // namespace mongo diff --git a/src/mongo/db/s/balancer/migration_manager_test.cpp b/src/mongo/db/s/balancer/migration_manager_test.cpp index 3465d0d8704..ec2bdc8b12d 100644 --- a/src/mongo/db/s/balancer/migration_manager_test.cpp +++ b/src/mongo/db/s/balancer/migration_manager_test.cpp @@ -331,7 +331,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) { @@ -395,7 +395,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. @@ -447,7 +447,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 @@ -489,7 +489,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) { @@ -538,7 +538,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, @@ -613,7 +613,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) { @@ -668,7 +668,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) { @@ -787,7 +787,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 b4584a87695..ae6a7068e01 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 @@ -178,7 +178,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 6418d5980bf..59fe4af9e98 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 @@ -148,7 +148,7 @@ TEST_F(CreateDatabaseTest, createDatabaseSuccess) { return BSON("ok" << 1 << "totalSize" << 100); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(CreateDatabaseTest, createDatabaseDBExists) { 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 b2472a9e690..6f0e42503ed 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 @@ -206,7 +206,7 @@ TEST_F(DropColl2ShardTest, Basic) { expectSetShardVersionZero(shard2()); expectUnsetSharding(shard2()); - future.timed_get(kFutureTimeout); + future.default_timed_get(); expectCollectionDocMarkedAsDropped(); expectNoChunkDocs(); @@ -251,7 +251,7 @@ TEST_F(DropColl2ShardTest, NSNotFound) { expectSetShardVersionZero(shard2()); expectUnsetSharding(shard2()); - future.timed_get(kFutureTimeout); + future.default_timed_get(); expectCollectionDocMarkedAsDropped(); expectNoChunkDocs(); @@ -270,7 +270,7 @@ TEST_F(DropColl2ShardTest, FirstShardTargeterError) { ASSERT_FALSE(status.reason().empty()); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DropColl2ShardTest, FirstShardDropError) { @@ -285,7 +285,7 @@ TEST_F(DropColl2ShardTest, FirstShardDropError) { return BSON("ok" << 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DropColl2ShardTest, FirstShardDropCmdError) { @@ -302,7 +302,7 @@ TEST_F(DropColl2ShardTest, FirstShardDropCmdError) { expectDrop(shard2()); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DropColl2ShardTest, SecondShardTargeterError) { @@ -319,7 +319,7 @@ TEST_F(DropColl2ShardTest, SecondShardTargeterError) { expectDrop(shard1()); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DropColl2ShardTest, SecondShardDropError) { @@ -336,7 +336,7 @@ TEST_F(DropColl2ShardTest, SecondShardDropError) { return BSON("ok" << 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DropColl2ShardTest, SecondShardDropCmdError) { @@ -352,7 +352,7 @@ TEST_F(DropColl2ShardTest, SecondShardDropCmdError) { return BSON("ok" << 0 << "code" << ErrorCodes::Unauthorized); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DropColl2ShardTest, CleanupChunkError) { @@ -370,7 +370,7 @@ TEST_F(DropColl2ShardTest, CleanupChunkError) { << "bad delete"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); expectCollectionDocMarkedAsDropped(); expectNoChunkDocs(); @@ -392,7 +392,7 @@ TEST_F(DropColl2ShardTest, SSVCmdErrorOnShard1) { << "bad"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); expectCollectionDocMarkedAsDropped(); expectNoChunkDocs(); @@ -414,7 +414,7 @@ TEST_F(DropColl2ShardTest, SSVErrorOnShard1) { return BSON("ok" << 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); expectCollectionDocMarkedAsDropped(); expectNoChunkDocs(); @@ -438,7 +438,7 @@ TEST_F(DropColl2ShardTest, UnsetCmdErrorOnShard1) { << "bad"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); expectCollectionDocMarkedAsDropped(); expectNoChunkDocs(); @@ -462,7 +462,7 @@ TEST_F(DropColl2ShardTest, UnsetErrorOnShard1) { return BSON("ok" << 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); expectCollectionDocMarkedAsDropped(); expectNoChunkDocs(); @@ -487,7 +487,7 @@ TEST_F(DropColl2ShardTest, SSVCmdErrorOnShard2) { << "bad"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); expectCollectionDocMarkedAsDropped(); expectNoChunkDocs(); @@ -512,7 +512,7 @@ TEST_F(DropColl2ShardTest, SSVErrorOnShard2) { return BSON("ok" << 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); expectCollectionDocMarkedAsDropped(); expectNoChunkDocs(); @@ -539,7 +539,7 @@ TEST_F(DropColl2ShardTest, UnsetCmdErrorOnShard2) { << "bad"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); expectCollectionDocMarkedAsDropped(); expectNoChunkDocs(); @@ -566,7 +566,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 4b4a9f93cf9..24fb6a641e6 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 @@ -100,7 +100,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 944713c935d..8ebd34de481 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 @@ -66,8 +66,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 b6b937722e6..e7a8ba45c86 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 @@ -204,7 +204,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, @@ -277,7 +277,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}, @@ -342,7 +342,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, @@ -399,7 +399,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}, @@ -466,7 +466,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}, @@ -558,7 +558,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()); @@ -592,7 +592,7 @@ TEST_F(CreateFirstChunksTest, NonEmptyCollection_SplitPoints_FromClient_ManyChun false /* isEmpty */); }); - 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()); @@ -648,7 +648,7 @@ TEST_F(CreateFirstChunksTest, EmptyCollection_SplitPoints_FromClient_ManyChunksD true /* isEmpty */); }); - 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()); @@ -683,7 +683,7 @@ TEST_F(CreateFirstChunksTest, EmptyCollection_NoSplitPoints_OneChunkToPrimary) { true /* isEmpty */); }); - 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 a5b25029335..9129b7867fe 100644 --- a/src/mongo/db/s/implicit_create_collection_test.cpp +++ b/src/mongo/db/s/implicit_create_collection_test.cpp @@ -76,7 +76,7 @@ TEST_F(ImplicitCreateTest, NormalCreate) { expectConfigCreate(kNs, Status::OK()); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ImplicitCreateTest, CanCallOnCannotImplicitAgainAfterError) { @@ -91,7 +91,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 @@ -104,7 +104,7 @@ TEST_F(ImplicitCreateTest, CanCallOnCannotImplicitAgainAfterError) { expectConfigCreate(kNs, Status::OK()); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ImplicitCreateTest, ShouldNotCallConfigCreateIfCollectionExists) { @@ -119,7 +119,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()); @@ -137,7 +137,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 214e6c5deab..3e4f509d6a8 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 @@ -214,7 +214,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 @@ -301,7 +301,7 @@ TEST_F(MigrationChunkClonerSourceLegacyTest, CorrectDocumentsFetched) { }); ASSERT_OK(cloner.commitClone(operationContext())); - futureCommit.timed_get(kFutureTimeout); + futureCommit.default_timed_get(); } TEST_F(MigrationChunkClonerSourceLegacyTest, CollectionNotFound) { @@ -352,7 +352,7 @@ TEST_F(MigrationChunkClonerSourceLegacyTest, FailedToEngageRecipientShard) { auto startCloneStatus = cloner.startClone(operationContext()); ASSERT_EQ(ErrorCodes::NetworkTimeout, 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 diff --git a/src/mongo/db/s/sharding_logging_test.cpp b/src/mongo/db/s/sharding_logging_test.cpp index 5504d76c0d9..3ac6ed54135 100644 --- a/src/mongo/db/s/sharding_logging_test.cpp +++ b/src/mongo/db/s/sharding_logging_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/db/s/split_chunk_test.cpp b/src/mongo/db/s/split_chunk_test.cpp index 497a66267fe..5adb6c0b359 100644 --- a/src/mongo/db/s/split_chunk_test.cpp +++ b/src/mongo/db/s/split_chunk_test.cpp @@ -254,7 +254,7 @@ TEST_F(SplitChunkTest, HashedKeyPatternNumberLongSplitKeys) { collResponse(); chunkResponse(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(SplitChunkTest, HashedKeyPatternIntegerSplitKeys) { @@ -292,7 +292,7 @@ TEST_F(SplitChunkTest, HashedKeyPatternIntegerSplitKeys) { chunkResponse(); shardResponse(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(SplitChunkTest, HashedKeyPatternDoubleSplitKeys) { @@ -330,7 +330,7 @@ TEST_F(SplitChunkTest, HashedKeyPatternDoubleSplitKeys) { chunkResponse(); shardResponse(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(SplitChunkTest, HashedKeyPatternStringSplitKeys) { @@ -374,7 +374,7 @@ TEST_F(SplitChunkTest, HashedKeyPatternStringSplitKeys) { chunkResponse(); shardResponse(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(SplitChunkTest, ValidRangeKeyPatternSplitKeys) { @@ -422,7 +422,7 @@ TEST_F(SplitChunkTest, ValidRangeKeyPatternSplitKeys) { collResponse(); chunkResponse(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(SplitChunkTest, SplitChunkWithNoErrors) { @@ -483,7 +483,7 @@ TEST_F(SplitChunkTest, SplitChunkWithNoErrors) { collResponse(); chunkResponse(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(SplitChunkTest, AttemptSplitWithConfigsvrError) { @@ -527,7 +527,7 @@ TEST_F(SplitChunkTest, AttemptSplitWithConfigsvrError) { collResponse(); chunkResponse(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(SplitChunkTest, AttemptSplitOnNoDatabases) { @@ -561,7 +561,7 @@ TEST_F(SplitChunkTest, AttemptSplitOnNoDatabases) { emptyResponse(); emptyResponse(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(SplitChunkTest, AttemptSplitOnNoCollections) { @@ -598,7 +598,7 @@ TEST_F(SplitChunkTest, AttemptSplitOnNoCollections) { emptyResponse(); shardResponse(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(SplitChunkTest, AttemptSplitOnNoChunks) { @@ -641,7 +641,7 @@ TEST_F(SplitChunkTest, AttemptSplitOnNoChunks) { collResponse(); emptyResponse(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(SplitChunkTest, NoCollectionAfterSplit) { @@ -685,7 +685,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) { @@ -735,7 +735,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.h b/src/mongo/executor/network_test_env.h index 7de1eec94d0..5125b7b4bd5 100644 --- a/src/mongo/executor/network_test_env.h +++ b/src/mongo/executor/network_test_env.h @@ -80,6 +80,9 @@ namespace executor { */ class NetworkTestEnv { public: + // Common timeout for tests to use for any work scheduled through launchAsync to complete. + static constexpr Minutes kDefaulLaunchAsyncFutureTimeout{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. @@ -129,6 +132,10 @@ public: return timed_get(timeout_duration.toSystemDuration()); } + T default_timed_get() { + return timed_get(kDefaulLaunchAsyncFutureTimeout); + } + 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 6440b9dd8f3..a22d6be4698 100644 --- a/src/mongo/s/balancer_configuration_test.cpp +++ b/src/mongo/s/balancer_configuration_test.cpp @@ -104,7 +104,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()); @@ -125,7 +125,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()); @@ -147,7 +147,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()); @@ -169,7 +169,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()); @@ -193,7 +193,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 d088bf9c134..dedf34c2c99 100644 --- a/src/mongo/s/catalog/dist_lock_catalog_impl_test.cpp +++ b/src/mongo/s/catalog/dist_lock_catalog_impl_test.cpp @@ -140,7 +140,7 @@ TEST_F(DistLockCatalogTest, BasicPing) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, PingTargetError) { @@ -172,7 +172,7 @@ TEST_F(DistLockCatalogTest, PingCommandError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, PingWriteError) { @@ -190,7 +190,7 @@ TEST_F(DistLockCatalogTest, PingWriteError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, PingWriteConcernError) { @@ -211,7 +211,7 @@ TEST_F(DistLockCatalogTest, PingWriteConcernError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, PingUnsupportedWriteConcernResponse) { @@ -233,7 +233,7 @@ TEST_F(DistLockCatalogTest, PingUnsupportedWriteConcernResponse) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, PingUnsupportedResponseFormat) { @@ -247,7 +247,7 @@ TEST_F(DistLockCatalogTest, PingUnsupportedResponseFormat) { << "NaN"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GrabLockNoOp) { @@ -289,7 +289,7 @@ TEST_F(DistLockCatalogTest, GrabLockNoOp) { return fromjson("{ ok: 1, value: null }"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GrabLockWithNewDoc) { @@ -353,7 +353,7 @@ TEST_F(DistLockCatalogTest, GrabLockWithNewDoc) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GrabLockWithBadLockDoc) { @@ -386,7 +386,7 @@ TEST_F(DistLockCatalogTest, GrabLockWithBadLockDoc) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GrabLockTargetError) { @@ -424,7 +424,7 @@ TEST_F(DistLockCatalogTest, GrabLockCommandError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GrabLockDupKeyError) { @@ -441,7 +441,7 @@ TEST_F(DistLockCatalogTest, GrabLockDupKeyError) { {DuplicateKeyErrorInfo(BSON("x" << 1), BSON("" << 1)), "Mock duplicate key error"}); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GrabLockWriteError) { @@ -461,7 +461,7 @@ TEST_F(DistLockCatalogTest, GrabLockWriteError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GrabLockWriteConcernError) { @@ -484,7 +484,7 @@ TEST_F(DistLockCatalogTest, GrabLockWriteConcernError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GrabLockWriteConcernErrorBadType) { @@ -505,7 +505,7 @@ TEST_F(DistLockCatalogTest, GrabLockWriteConcernErrorBadType) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GrabLockResponseMissingValueField) { @@ -523,7 +523,7 @@ TEST_F(DistLockCatalogTest, GrabLockResponseMissingValueField) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GrabLockUnsupportedWriteConcernResponse) { @@ -547,7 +547,7 @@ TEST_F(DistLockCatalogTest, GrabLockUnsupportedWriteConcernResponse) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GrabLockUnsupportedResponseFormat) { @@ -563,7 +563,7 @@ TEST_F(DistLockCatalogTest, GrabLockUnsupportedResponseFormat) { << "NaN"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, OvertakeLockNoOp) { @@ -612,7 +612,7 @@ TEST_F(DistLockCatalogTest, OvertakeLockNoOp) { return fromjson("{ ok: 1, value: null }"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, OvertakeLockWithNewDoc) { @@ -681,7 +681,7 @@ TEST_F(DistLockCatalogTest, OvertakeLockWithNewDoc) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, OvertakeLockWithBadLockDoc) { @@ -716,7 +716,7 @@ TEST_F(DistLockCatalogTest, OvertakeLockWithBadLockDoc) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, OvertakeLockTargetError) { @@ -757,7 +757,7 @@ TEST_F(DistLockCatalogTest, OvertakeLockCommandError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, OvertakeLockWriteError) { @@ -778,7 +778,7 @@ TEST_F(DistLockCatalogTest, OvertakeLockWriteError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, OvertakeLockWriteConcernError) { @@ -802,7 +802,7 @@ TEST_F(DistLockCatalogTest, OvertakeLockWriteConcernError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, OvertakeLockUnsupportedWriteConcernResponse) { @@ -827,7 +827,7 @@ TEST_F(DistLockCatalogTest, OvertakeLockUnsupportedWriteConcernResponse) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, OvertakeLockUnsupportedResponseFormat) { @@ -844,7 +844,7 @@ TEST_F(DistLockCatalogTest, OvertakeLockUnsupportedResponseFormat) { << "NaN"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, BasicUnlock) { @@ -878,7 +878,7 @@ TEST_F(DistLockCatalogTest, BasicUnlock) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, BasicUnlockWithName) { @@ -912,7 +912,7 @@ TEST_F(DistLockCatalogTest, BasicUnlockWithName) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, UnlockWithNoNewDoc) { @@ -942,7 +942,7 @@ TEST_F(DistLockCatalogTest, UnlockWithNoNewDoc) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, UnlockWithNameWithNoNewDoc) { @@ -972,7 +972,7 @@ TEST_F(DistLockCatalogTest, UnlockWithNameWithNoNewDoc) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, UnlockTargetError) { @@ -1004,7 +1004,7 @@ TEST_F(DistLockCatalogTest, UnlockCommandError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, UnlockWriteError) { @@ -1022,7 +1022,7 @@ TEST_F(DistLockCatalogTest, UnlockWriteError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, UnlockWriteConcernError) { @@ -1055,7 +1055,7 @@ TEST_F(DistLockCatalogTest, UnlockWriteConcernError) { return writeConcernFailedResponse; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, UnlockUnsupportedWriteConcernResponse) { @@ -1077,7 +1077,7 @@ TEST_F(DistLockCatalogTest, UnlockUnsupportedWriteConcernResponse) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, UnlockUnsupportedResponseFormat) { @@ -1091,7 +1091,7 @@ TEST_F(DistLockCatalogTest, UnlockUnsupportedResponseFormat) { << "NaN"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, BasicUnlockAll) { @@ -1125,7 +1125,7 @@ TEST_F(DistLockCatalogTest, BasicUnlockAll) { return BSON("ok" << 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, UnlockAllWriteFailed) { @@ -1139,7 +1139,7 @@ TEST_F(DistLockCatalogTest, UnlockAllWriteFailed) { << "something went wrong"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, UnlockAllNetworkError) { @@ -1154,7 +1154,7 @@ TEST_F(DistLockCatalogTest, UnlockAllNetworkError) { }); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, BasicGetServerInfo) { @@ -1183,7 +1183,7 @@ TEST_F(DistLockCatalogTest, BasicGetServerInfo) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetServerTargetError) { @@ -1215,7 +1215,7 @@ TEST_F(DistLockCatalogTest, GetServerCommandError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetServerBadElectionId) { @@ -1236,7 +1236,7 @@ TEST_F(DistLockCatalogTest, GetServerBadElectionId) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetServerBadLocalTime) { @@ -1257,7 +1257,7 @@ TEST_F(DistLockCatalogTest, GetServerBadLocalTime) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetServerNoGLEStats) { @@ -1274,7 +1274,7 @@ TEST_F(DistLockCatalogTest, GetServerNoGLEStats) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetServerNoElectionId) { @@ -1295,7 +1295,7 @@ TEST_F(DistLockCatalogTest, GetServerNoElectionId) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetServerInvalidReplSubsectionShouldFail) { @@ -1315,7 +1315,7 @@ TEST_F(DistLockCatalogTest, GetServerInvalidReplSubsectionShouldFail) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetServerNoElectionIdButMasterShouldFail) { @@ -1336,7 +1336,7 @@ TEST_F(DistLockCatalogTest, GetServerNoElectionIdButMasterShouldFail) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, BasicStopPing) { @@ -1368,7 +1368,7 @@ TEST_F(DistLockCatalogTest, BasicStopPing) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, StopPingTargetError) { @@ -1400,7 +1400,7 @@ TEST_F(DistLockCatalogTest, StopPingCommandError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, StopPingWriteError) { @@ -1418,7 +1418,7 @@ TEST_F(DistLockCatalogTest, StopPingWriteError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, StopPingWriteConcernError) { @@ -1439,7 +1439,7 @@ TEST_F(DistLockCatalogTest, StopPingWriteConcernError) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, StopPingUnsupportedWriteConcernResponse) { @@ -1461,7 +1461,7 @@ TEST_F(DistLockCatalogTest, StopPingUnsupportedWriteConcernResponse) { })"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, StopPingUnsupportedResponseFormat) { @@ -1475,7 +1475,7 @@ TEST_F(DistLockCatalogTest, StopPingUnsupportedResponseFormat) { << "NaN"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, BasicGetPing) { @@ -1512,7 +1512,7 @@ TEST_F(DistLockCatalogTest, BasicGetPing) { return result; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetPingTargetError) { @@ -1540,7 +1540,7 @@ TEST_F(DistLockCatalogTest, GetPingNotFound) { return std::vector<BSONObj>(); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetPingUnsupportedFormat) { @@ -1563,7 +1563,7 @@ TEST_F(DistLockCatalogTest, GetPingUnsupportedFormat) { return result; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, BasicGetLockByTS) { @@ -1598,7 +1598,7 @@ TEST_F(DistLockCatalogTest, BasicGetLockByTS) { return result; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetLockByTSTargetError) { @@ -1625,7 +1625,7 @@ TEST_F(DistLockCatalogTest, GetLockByTSNotFound) { return std::vector<BSONObj>(); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetLockByTSUnsupportedFormat) { @@ -1648,7 +1648,7 @@ TEST_F(DistLockCatalogTest, GetLockByTSUnsupportedFormat) { return result; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, BasicGetLockByName) { @@ -1685,7 +1685,7 @@ TEST_F(DistLockCatalogTest, BasicGetLockByName) { return result; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetLockByNameTargetError) { @@ -1713,7 +1713,7 @@ TEST_F(DistLockCatalogTest, GetLockByNameNotFound) { return std::vector<BSONObj>(); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(DistLockCatalogTest, GetLockByNameUnsupportedFormat) { @@ -1736,7 +1736,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_test.cpp b/src/mongo/s/catalog/sharding_catalog_test.cpp index eb62c7aa03b..ca6bad908ac 100644 --- a/src/mongo/s/catalog/sharding_catalog_test.cpp +++ b/src/mongo/s/catalog/sharding_catalog_test.cpp @@ -127,7 +127,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()); } @@ -144,7 +144,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) { @@ -193,7 +193,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()); } @@ -225,7 +225,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()); } @@ -247,7 +247,7 @@ TEST_F(ShardingCatalogClientTest, GetDatabaseStaleSecondaryRetryNoPrimary) { return vector<BSONObj>{}; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, GetDatabaseNotExisting) { @@ -262,7 +262,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) { @@ -311,7 +311,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) { @@ -341,7 +341,7 @@ TEST_F(ShardingCatalogClientTest, GetAllShardsWithInvalidShard) { }; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, GetChunksForNSWithSortAndLimit) { @@ -413,7 +413,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()); } @@ -460,7 +460,7 @@ TEST_F(ShardingCatalogClientTest, GetChunksForNSNoSortNoLimit) { return vector<BSONObj>{}; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, GetChunksForNSInvalidChunk) { @@ -503,7 +503,7 @@ TEST_F(ShardingCatalogClientTest, GetChunksForNSInvalidChunk) { return vector<BSONObj>{chunkA.toConfigBSON(), chunkB.toConfigBSON()}; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, RunUserManagementReadCommand) { @@ -538,7 +538,7 @@ TEST_F(ShardingCatalogClientTest, RunUserManagementReadCommand) { return BSON("ok" << 1 << "users" << BSONArrayBuilder().arr()); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, RunUserManagementReadCommandUnsatisfiedReadPref) { @@ -595,7 +595,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) { @@ -668,7 +668,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) { @@ -698,7 +698,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) { @@ -756,7 +756,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) { @@ -813,7 +813,7 @@ TEST_F(ShardingCatalogClientTest, GetCollectionsValidResultsNoDb) { return std::make_tuple(vector<BSONObj>{coll1.toBSON(), coll2.toBSON()}, builder.obj()); }); - 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()); @@ -862,7 +862,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()); @@ -911,7 +911,7 @@ TEST_F(ShardingCatalogClientTest, GetCollectionsInvalidCollectionType) { }; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, GetDatabasesForShardValid) { @@ -944,7 +944,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]); @@ -968,7 +968,7 @@ TEST_F(ShardingCatalogClientTest, GetDatabasesForShardInvalidDoc) { }; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, GetTagsForCollection) { @@ -1013,7 +1013,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()); } @@ -1032,7 +1032,7 @@ TEST_F(ShardingCatalogClientTest, GetTagsForCollectionNoTags) { onFindCommand([](const RemoteCommandRequest& request) { return vector<BSONObj>{}; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, GetTagsForCollectionInvalidTag) { @@ -1061,7 +1061,7 @@ TEST_F(ShardingCatalogClientTest, GetTagsForCollectionInvalidTag) { return vector<BSONObj>{tagA.toBSON(), tagB.toBSON()}; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, UpdateDatabase) { @@ -1107,7 +1107,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) { @@ -1143,7 +1143,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) { @@ -1188,7 +1188,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) { @@ -1236,7 +1236,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) { @@ -1275,7 +1275,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) { @@ -1293,7 +1293,7 @@ TEST_F(ShardingCatalogClientTest, RetryOnFindCommandNetworkErrorFailsAtMaxRetry) }); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, RetryOnFindCommandNetworkErrorSucceedsAtMaxRetry) { @@ -1319,7 +1319,7 @@ TEST_F(ShardingCatalogClientTest, RetryOnFindCommandNetworkErrorSucceedsAtMaxRet return vector<BSONObj>{dbType.toBSON()}; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ShardingCatalogClientTest, GetNewKeys) { @@ -1367,7 +1367,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(); @@ -1420,7 +1420,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 5fe8c961c33..ae1c8b8ac5c 100644 --- a/src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp +++ b/src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp @@ -111,7 +111,7 @@ TEST_F(InsertRetryTest, RetryOnInterruptedAndNetworkErrorSuccess) { expectInserts(kTestNamespace, {objToInsert}); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(InsertRetryTest, RetryOnNetworkErrorFails) { @@ -146,7 +146,7 @@ TEST_F(InsertRetryTest, RetryOnNetworkErrorFails) { return Status(ErrorCodes::NetworkTimeout, "Network timeout"); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(InsertRetryTest, DuplicateKeyErrorAfterNetworkErrorMatch) { @@ -184,7 +184,7 @@ TEST_F(InsertRetryTest, DuplicateKeyErrorAfterNetworkErrorMatch) { return vector<BSONObj>{objToInsert}; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(InsertRetryTest, DuplicateKeyErrorAfterNetworkErrorNotFound) { @@ -222,7 +222,7 @@ TEST_F(InsertRetryTest, DuplicateKeyErrorAfterNetworkErrorNotFound) { return vector<BSONObj>(); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(InsertRetryTest, DuplicateKeyErrorAfterNetworkErrorMismatch) { @@ -261,7 +261,7 @@ TEST_F(InsertRetryTest, DuplicateKeyErrorAfterNetworkErrorMismatch) { << "TestValue has changed")}; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(InsertRetryTest, DuplicateKeyErrorAfterWriteConcernFailureMatch) { @@ -316,7 +316,7 @@ TEST_F(InsertRetryTest, DuplicateKeyErrorAfterWriteConcernFailureMatch) { return vector<BSONObj>{objToInsert}; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(UpdateRetryTest, Success) { @@ -350,7 +350,7 @@ TEST_F(UpdateRetryTest, Success) { return response.toBSON(); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(UpdateRetryTest, NotMasterErrorReturnedPersistently) { @@ -380,7 +380,7 @@ TEST_F(UpdateRetryTest, NotMasterErrorReturnedPersistently) { }); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(UpdateRetryTest, NotMasterReturnedFromTargeter) { @@ -402,7 +402,7 @@ TEST_F(UpdateRetryTest, NotMasterReturnedFromTargeter) { ASSERT_EQUALS(ErrorCodes::NotMaster, status); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(UpdateRetryTest, NotMasterOnceSuccessAfterRetry) { @@ -456,7 +456,7 @@ TEST_F(UpdateRetryTest, NotMasterOnceSuccessAfterRetry) { return response.toBSON(); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(UpdateRetryTest, OperationInterruptedDueToPrimaryStepDown) { @@ -506,7 +506,7 @@ TEST_F(UpdateRetryTest, OperationInterruptedDueToPrimaryStepDown) { return response.toBSON(); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(UpdateRetryTest, WriteConcernFailure) { @@ -563,7 +563,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 9a120728f3d..c726601dcee 100644 --- a/src/mongo/s/catalog_cache_refresh_test.cpp +++ b/src/mongo/s/catalog_cache_refresh_test.cpp @@ -114,7 +114,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(); @@ -144,7 +144,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(); @@ -165,7 +165,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(); @@ -184,7 +184,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()); @@ -202,7 +202,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(); @@ -233,7 +233,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(); @@ -267,7 +267,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(); @@ -322,7 +322,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(); @@ -369,7 +369,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(); @@ -453,7 +453,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(); @@ -500,7 +500,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(); @@ -543,7 +543,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(); @@ -582,7 +582,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(); @@ -618,7 +618,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 2b4b8c40f85..1bf824c1483 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()); @@ -221,7 +221,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 fb56516f66b..a2600a84558 100644 --- a/src/mongo/s/client/shard_remote_test.cpp +++ b/src/mongo/s/client/shard_remote_test.cpp @@ -129,7 +129,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, @@ -156,7 +156,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 0ad8ddf3528..015f9676011 100644 --- a/src/mongo/s/cluster_identity_loader_test.cpp +++ b/src/mongo/s/cluster_identity_loader_test.cpp @@ -117,7 +117,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. @@ -153,9 +153,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) { @@ -170,7 +170,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. @@ -184,7 +184,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 5ded5905d29..276377dc1d3 100644 --- a/src/mongo/s/cluster_last_error_info_test.cpp +++ b/src/mongo/s/cluster_last_error_info_test.cpp @@ -91,7 +91,7 @@ TEST_F(ClusterGetLastErrorTest, return RemoteCommandResponse(bob.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. @@ -135,7 +135,7 @@ TEST_F(ClusterGetLastErrorTest, ClusterLastErrorInfoNotUpdatedIfNotInitialized) return RemoteCommandResponse(bob.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)); @@ -176,7 +176,7 @@ TEST_F(ClusterGetLastErrorTest, ClusterLastErrorInfoNotUpdatedIfReplyDoesntHaveS return RemoteCommandResponse(BSON("ok" << 1), 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_command_test_fixture.cpp b/src/mongo/s/commands/cluster_command_test_fixture.cpp index 085c3aaa975..9ff7b21b3a9 100644 --- a/src/mongo/s/commands/cluster_command_test_fixture.cpp +++ b/src/mongo/s/commands/cluster_command_test_fixture.cpp @@ -129,7 +129,7 @@ void ClusterCommandTestFixture::runCommandSuccessful(BSONObj cmd, bool isTargete expectReturnsSuccess(i % numShards); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } void ClusterCommandTestFixture::runTxnCommandOneError(BSONObj cmd, @@ -155,7 +155,7 @@ void ClusterCommandTestFixture::runTxnCommandOneError(BSONObj cmd, expectReturnsSuccess(i % numShards); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } void ClusterCommandTestFixture::runCommandInspectRequests(BSONObj cmd, @@ -168,7 +168,7 @@ void ClusterCommandTestFixture::runCommandInspectRequests(BSONObj cmd, expectInspectRequest(i % numShards, cb); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } void ClusterCommandTestFixture::expectAbortTransaction() { @@ -212,7 +212,7 @@ void ClusterCommandTestFixture::runTxnCommandMaxErrors(BSONObj cmd, expectAbortTransaction(); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } void ClusterCommandTestFixture::testNoErrors(BSONObj targetedCmd, BSONObj scatterGatherCmd) { diff --git a/src/mongo/s/query/blocking_results_merger_test.cpp b/src/mongo/s/query/blocking_results_merger_test.cpp index b3fd46ec56d..2c269fd2d6b 100644 --- a/src/mongo/s/query/blocking_results_merger_test.cpp +++ b/src/mongo/s/query/blocking_results_merger_test.cpp @@ -84,7 +84,7 @@ TEST_F(ResultsMergerTestFixture, ShouldBeAbleToBlockUntilDeadlineExpires) { getMockClockSource()->advance(Milliseconds{3000}); - future.timed_get(kFutureTimeout); + future.default_timed_get(); // Answer the getMore, so that there are no more outstanding requests. onCommand([&](const auto& request) { @@ -123,7 +123,7 @@ TEST_F(ResultsMergerTestFixture, ShouldBeAbleToBlockUntilNextResultIsReady) { .toBSON(CursorResponse::ResponseType::SubsequentResponse); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ResultsMergerTestFixture, ShouldBeAbleToBlockUntilNextResultIsReadyWithDeadline) { @@ -154,7 +154,7 @@ TEST_F(ResultsMergerTestFixture, ShouldBeAbleToBlockUntilNextResultIsReadyWithDe sleepsecs(1); getMockClockSource()->advance(Milliseconds{3000}); - future.timed_get(kFutureTimeout); + future.default_timed_get(); // Used for synchronizing the background thread with this thread. stdx::mutex mutex; @@ -183,7 +183,7 @@ TEST_F(ResultsMergerTestFixture, ShouldBeAbleToBlockUntilNextResultIsReadyWithDe // Unblock the other thread, allowing it to call next() on the BlockingResultsMerger. lk.unlock(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ResultsMergerTestFixture, ShouldBeInterruptableDuringBlockingNext) { @@ -207,7 +207,7 @@ TEST_F(ResultsMergerTestFixture, ShouldBeInterruptableDuringBlockingNext) { operationContext()->markKilled(ErrorCodes::Interrupted); } // Wait for the merger to be interrupted. - future.timed_get(kFutureTimeout); + future.default_timed_get(); // Now that we've seen it interrupted, kill it. We have to do this in another thread because // killing a BlockingResultsMerger involves running a killCursors, and this main thread is in @@ -222,7 +222,7 @@ TEST_F(ResultsMergerTestFixture, ShouldBeInterruptableDuringBlockingNext) { // Run the callback for the killCursors. We don't actually inspect the value so we don't have to // schedule a response. runReadyCallbacks(); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ResultsMergerTestFixture, ShouldBeAbleToHandleExceptionWhenYielding) { @@ -260,7 +260,7 @@ TEST_F(ResultsMergerTestFixture, ShouldBeAbleToHandleExceptionWhenYielding) { .toBSON(CursorResponse::ResponseType::SubsequentResponse); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ResultsMergerTestFixture, ShouldBeAbleToHandleExceptionWhenUnyielding) { @@ -298,7 +298,7 @@ TEST_F(ResultsMergerTestFixture, ShouldBeAbleToHandleExceptionWhenUnyielding) { .toBSON(CursorResponse::ResponseType::SubsequentResponse); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } } // namespace diff --git a/src/mongo/s/query/cluster_aggregation_planner_test.cpp b/src/mongo/s/query/cluster_aggregation_planner_test.cpp index fbd49b607db..8f14dceeb6a 100644 --- a/src/mongo/s/query/cluster_aggregation_planner_test.cpp +++ b/src/mongo/s/query/cluster_aggregation_planner_test.cpp @@ -115,7 +115,7 @@ public: return response; }()); - future.timed_get(kFutureTimeout).get(); + future.default_timed_get().get(); } private: @@ -167,7 +167,7 @@ TEST_F(ClusterExchangeTest, SingleOutStageNotEligibleForExchangeIfOutputDatabase expectFindSendBSONObjVector(kConfigHostAndPort, []() { return std::vector<BSONObj>{}; }()); expectFindSendBSONObjVector(kConfigHostAndPort, []() { return std::vector<BSONObj>{}; }()); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } // If the output collection doesn't exist, we don't know how to distribute the output documents so @@ -187,7 +187,7 @@ TEST_F(ClusterExchangeTest, SingleOutStageNotEligibleForExchangeIfOutputCollecti // Pretend there are no collections in this database. expectFindSendBSONObjVector(kConfigHostAndPort, std::vector<BSONObj>()); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } // A $limit stage requires a single merger. @@ -206,7 +206,7 @@ TEST_F(ClusterExchangeTest, LimitFollowedByOutStageIsNotEligibleForExchange) { mergePipe.get())); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ClusterExchangeTest, GroupFollowedByOutIsEligbleForExchange) { @@ -234,7 +234,7 @@ TEST_F(ClusterExchangeTest, GroupFollowedByOutIsEligbleForExchange) { ASSERT_BSONOBJ_EQ(boundaries[2], BSON("_id" << MAXKEY)); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ClusterExchangeTest, RenamesAreEligibleForExchange) { @@ -268,7 +268,7 @@ TEST_F(ClusterExchangeTest, RenamesAreEligibleForExchange) { ASSERT_EQ(consumerIds[1], 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ClusterExchangeTest, MatchesAreEligibleForExchange) { @@ -301,7 +301,7 @@ TEST_F(ClusterExchangeTest, MatchesAreEligibleForExchange) { ASSERT_EQ(consumerIds[1], 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ClusterExchangeTest, SortThenGroupIsEligibleForExchange) { @@ -339,7 +339,7 @@ TEST_F(ClusterExchangeTest, SortThenGroupIsEligibleForExchange) { ASSERT_EQ(consumerIds[1], 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ClusterExchangeTest, SortThenGroupIsEligibleForExchangeHash) { @@ -379,7 +379,7 @@ TEST_F(ClusterExchangeTest, SortThenGroupIsEligibleForExchangeHash) { ASSERT_EQ(consumerIds[1], 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ClusterExchangeTest, ProjectThroughDottedFieldDoesNotPreserveShardKey) { @@ -407,7 +407,7 @@ TEST_F(ClusterExchangeTest, ProjectThroughDottedFieldDoesNotPreserveShardKey) { ASSERT_FALSE(exchangeSpec); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ClusterExchangeTest, WordCountUseCaseExample) { @@ -446,7 +446,7 @@ TEST_F(ClusterExchangeTest, WordCountUseCaseExample) { ASSERT_EQ(consumerIds[1], 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(ClusterExchangeTest, WordCountUseCaseExampleShardedByWord) { @@ -511,7 +511,7 @@ TEST_F(ClusterExchangeTest, WordCountUseCaseExampleShardedByWord) { ASSERT_EQ(consumerIds[2], 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } // We'd like to test that a compound shard key pattern can be used. Strangely, the only case we can @@ -595,7 +595,7 @@ TEST_F(ClusterExchangeTest, CompoundShardKeyThreeShards) { } }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } } // namespace } // namespace mongo diff --git a/src/mongo/s/query/establish_cursors_test.cpp b/src/mongo/s/query/establish_cursors_test.cpp index f0dc083c6b5..675cb6dd4cb 100644 --- a/src/mongo/s/query/establish_cursors_test.cpp +++ b/src/mongo/s/query/establish_cursors_test.cpp @@ -124,7 +124,7 @@ TEST_F(EstablishCursorsTest, SingleRemoteRespondsWithSuccess) { return cursorResponse.toBSON(CursorResponse::ResponseType::InitialResponse); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, SingleRemoteRespondsWithNonretriableError) { @@ -146,7 +146,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) { @@ -169,7 +169,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) { @@ -201,7 +201,7 @@ TEST_F(EstablishCursorsTest, SingleRemoteRespondsWithRetriableErrorThenSuccess) return cursorResponse.toBSON(CursorResponse::ResponseType::InitialResponse); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, SingleRemoteRespondsWithRetriableErrorThenSuccessAllowPartialResults) { @@ -234,7 +234,7 @@ TEST_F(EstablishCursorsTest, SingleRemoteRespondsWithRetriableErrorThenSuccessAl return cursorResponse.toBSON(CursorResponse::ResponseType::InitialResponse); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, SingleRemoteMaxesOutRetriableErrors) { @@ -258,7 +258,7 @@ TEST_F(EstablishCursorsTest, SingleRemoteMaxesOutRetriableErrors) { return Status(ErrorCodes::HostUnreachable, "host unreachable"); }); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, SingleRemoteMaxesOutRetriableErrorsAllowPartialResults) { @@ -286,7 +286,7 @@ TEST_F(EstablishCursorsTest, SingleRemoteMaxesOutRetriableErrorsAllowPartialResu return Status(ErrorCodes::HostUnreachable, "host unreachable"); }); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, MultipleRemotesRespondWithSuccess) { @@ -315,7 +315,7 @@ TEST_F(EstablishCursorsTest, MultipleRemotesRespondWithSuccess) { }); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, MultipleRemotesOneRemoteRespondsWithNonretriableError) { @@ -357,7 +357,7 @@ TEST_F(EstablishCursorsTest, MultipleRemotesOneRemoteRespondsWithNonretriableErr return cursorResponse.toBSON(CursorResponse::ResponseType::InitialResponse); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, @@ -401,7 +401,7 @@ TEST_F(EstablishCursorsTest, return cursorResponse.toBSON(CursorResponse::ResponseType::InitialResponse); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, MultipleRemotesOneRemoteRespondsWithRetriableErrorThenSuccess) { @@ -452,7 +452,7 @@ TEST_F(EstablishCursorsTest, MultipleRemotesOneRemoteRespondsWithRetriableErrorT return cursorResponse.toBSON(CursorResponse::ResponseType::InitialResponse); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, @@ -504,7 +504,7 @@ TEST_F(EstablishCursorsTest, return cursorResponse.toBSON(CursorResponse::ResponseType::InitialResponse); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, MultipleRemotesOneRemoteMaxesOutRetriableErrors) { @@ -554,7 +554,7 @@ TEST_F(EstablishCursorsTest, MultipleRemotesOneRemoteMaxesOutRetriableErrors) { }); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(EstablishCursorsTest, MultipleRemotesOneRemoteMaxesOutRetriableErrorsAllowPartialResults) { @@ -606,7 +606,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 48bda37a9d7..021669e79ba 100644 --- a/src/mongo/s/sharding_router_test_fixture.cpp +++ b/src/mongo/s/sharding_router_test_fixture.cpp @@ -267,7 +267,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 0a23dde0634..c6442c98f72 100644 --- a/src/mongo/s/sharding_test_fixture_common.cpp +++ b/src/mongo/s/sharding_test_fixture_common.cpp @@ -35,8 +35,6 @@ namespace mongo { using executor::NetworkTestEnv; -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 5b762df9e6d..d4b72ef7b05 100644 --- a/src/mongo/s/sharding_test_fixture_common.h +++ b/src/mongo/s/sharding_test_fixture_common.h @@ -48,8 +48,6 @@ class TaskExecutor; */ class ShardingTestFixtureCommon { public: - static constexpr Seconds kFutureTimeout{15}; - ShardingTestFixtureCommon(); ~ShardingTestFixtureCommon(); diff --git a/src/mongo/s/transaction_router_test.cpp b/src/mongo/s/transaction_router_test.cpp index f29eb21c8ad..96b1f242862 100644 --- a/src/mongo/s/transaction_router_test.cpp +++ b/src/mongo/s/transaction_router_test.cpp @@ -732,7 +732,7 @@ TEST_F(TransactionRouterTestWithDefaultSession, return BSON("ok" << 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(TransactionRouterTestWithDefaultSession, @@ -765,7 +765,7 @@ TEST_F(TransactionRouterTestWithDefaultSession, return BSON("ok" << 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(TransactionRouterTestWithDefaultSession, @@ -810,7 +810,7 @@ TEST_F(TransactionRouterTestWithDefaultSession, }); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); ASSERT(expectedHostAndPorts == seenHostAndPorts); } @@ -859,7 +859,7 @@ TEST_F(TransactionRouterTestWithDefaultSession, return BSON("ok" << 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(TransactionRouterTestWithDefaultSession, @@ -907,7 +907,7 @@ TEST_F(TransactionRouterTestWithDefaultSession, return BSON("ok" << 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(TransactionRouterTest, CommitWithRecoveryTokenWithNoParticipants) { @@ -947,7 +947,7 @@ TEST_F(TransactionRouterTest, CommitWithRecoveryTokenWithNoParticipants) { return BSON("ok" << 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); // Sending commit with a recovery token again should cause the router to use the recovery path // again. @@ -970,7 +970,7 @@ TEST_F(TransactionRouterTest, CommitWithRecoveryTokenWithNoParticipants) { return BSON("ok" << 1); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(TransactionRouterTest, CommitWithEmptyRecoveryToken) { @@ -1022,7 +1022,7 @@ TEST_F(TransactionRouterTest, CommitWithRecoveryTokenWithUnknownShard) { // ShardRegistry will try to perform a reload since it doesn't know about the shard. expectGetShards({shardType}); - ASSERT_THROWS_CODE(future.timed_get(kFutureTimeout), DBException, ErrorCodes::ShardNotFound); + ASSERT_THROWS_CODE(future.default_timed_get(), DBException, ErrorCodes::ShardNotFound); } TEST_F(TransactionRouterTestWithDefaultSession, SnapshotErrorsResetAtClusterTime) { @@ -1055,7 +1055,7 @@ TEST_F(TransactionRouterTestWithDefaultSession, SnapshotErrorsResetAtClusterTime ASSERT(txnRouter.canContinueOnSnapshotError()); auto future = launchAsync([&] { txnRouter.onSnapshotError(operationContext(), kDummyStatus); }); expectAbortTransactions({hostAndPort1}, getSessionId(), txnNum); - future.timed_get(kFutureTimeout); + future.default_timed_get(); txnRouter.setDefaultAtClusterTime(operationContext()); @@ -1155,7 +1155,7 @@ TEST_F(TransactionRouterTestWithDefaultSession, SnapshotErrorsClearsAllParticipa ASSERT(txnRouter.canContinueOnSnapshotError()); auto future = launchAsync([&] { txnRouter.onSnapshotError(operationContext(), kDummyStatus); }); expectAbortTransactions({hostAndPort1, hostAndPort2}, getSessionId(), txnNum); - future.timed_get(kFutureTimeout); + future.default_timed_get(); txnRouter.setDefaultAtClusterTime(operationContext()); @@ -1282,7 +1282,7 @@ TEST_F(TransactionRouterTestWithDefaultSession, auto future = launchAsync( [&] { txnRouter.onStaleShardOrDbError(operationContext(), "find", kDummyStatus); }); expectAbortTransactions({hostAndPort1, hostAndPort2}, getSessionId(), txnNum); - future.timed_get(kFutureTimeout); + future.default_timed_get(); ASSERT_FALSE(txnRouter.getCoordinatorId()); @@ -1333,7 +1333,7 @@ TEST_F(TransactionRouterTestWithDefaultSession, OnlyNewlyCreatedParticipantsClea auto future = launchAsync( [&] { txnRouter.onStaleShardOrDbError(operationContext(), "find", kDummyStatus); }); expectAbortTransactions({hostAndPort2, hostAndPort3}, getSessionId(), txnNum); - future.timed_get(kFutureTimeout); + future.default_timed_get(); // Shards 2 and 3 must start a transaction, but shard 1 must not. ASSERT_FALSE(txnRouter.attachTxnFieldsIfNeeded(shard1, {})["startTransaction"].trueValue()); @@ -1381,7 +1381,7 @@ TEST_F(TransactionRouterTestWithDefaultSession, auto future = launchAsync([&] { txnRouter.onViewResolutionError(operationContext(), kViewNss); }); expectAbortTransactions({hostAndPort1}, getSessionId(), txnNum); - future.timed_get(kFutureTimeout); + future.default_timed_get(); txnRouter.setDefaultAtClusterTime(operationContext()); @@ -1471,7 +1471,7 @@ TEST_F(TransactionRouterTest, AbortForSingleParticipant) { return kOkReadOnlyFalseResponse; }); - auto response = future.timed_get(kFutureTimeout); + auto response = future.default_timed_get(); ASSERT_FALSE(response.empty()); } @@ -1514,7 +1514,7 @@ TEST_F(TransactionRouterTest, AbortForMultipleParticipants) { }); } - auto response = future.timed_get(kFutureTimeout); + auto response = future.default_timed_get(); ASSERT_FALSE(response.empty()); } @@ -1539,7 +1539,7 @@ TEST_F(TransactionRouterTestWithDefaultSession, OnViewResolutionErrorClearsAllNe auto future = launchAsync([&] { txnRouter.onViewResolutionError(operationContext(), kViewNss); }); expectAbortTransactions({hostAndPort1}, getSessionId(), txnNum); - future.timed_get(kFutureTimeout); + future.default_timed_get(); // The only participant was the coordinator, so it should have been reset. ASSERT_FALSE(txnRouter.getCoordinatorId()); @@ -1561,7 +1561,7 @@ TEST_F(TransactionRouterTestWithDefaultSession, OnViewResolutionErrorClearsAllNe future = launchAsync([&] { txnRouter.onViewResolutionError(operationContext(), kViewNss); }); expectAbortTransactions({hostAndPort2}, getSessionId(), txnNum); - future.timed_get(kFutureTimeout); + future.default_timed_get(); // Only the new participant shard was reset. firstShardCmd = txnRouter.attachTxnFieldsIfNeeded(shard1, {}); @@ -1617,7 +1617,7 @@ TEST_F(TransactionRouterTest, ImplicitAbortForSingleParticipant) { return kOkReadOnlyFalseResponse; }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(TransactionRouterTest, ImplicitAbortForMultipleParticipants) { @@ -1658,7 +1658,7 @@ TEST_F(TransactionRouterTest, ImplicitAbortForMultipleParticipants) { }); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(TransactionRouterTest, ImplicitAbortIgnoresErrors) { @@ -1692,7 +1692,7 @@ TEST_F(TransactionRouterTest, ImplicitAbortIgnoresErrors) { }); // Shouldn't throw. - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(TransactionRouterTestWithDefaultSession, @@ -1901,7 +1901,7 @@ TEST_F(TransactionRouterTestWithDefaultSession, expectAbortTransactions({hostAndPort1}, getSessionId(), txnNum, noSuchTransactionError); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(TransactionRouterTestWithDefaultSession, @@ -1933,7 +1933,7 @@ TEST_F(TransactionRouterTestWithDefaultSession, expectAbortTransactions({hostAndPort1}, getSessionId(), txnNum, retryableError); expectAbortTransactions({hostAndPort1}, getSessionId(), txnNum); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(TransactionRouterTestWithDefaultSession, @@ -1964,7 +1964,7 @@ TEST_F(TransactionRouterTestWithDefaultSession, }(); expectAbortTransactions({hostAndPort1}, getSessionId(), txnNum, abortError); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } DEATH_TEST_F(TransactionRouterTestWithDefaultSession, 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 c95f09c0012..0ef6987605b 100644 --- a/src/mongo/s/write_ops/batch_write_exec_test.cpp +++ b/src/mongo/s/write_ops/batch_write_exec_test.cpp @@ -239,7 +239,7 @@ TEST_F(BatchWriteExecTest, SingleOp) { expectInsertsReturnSuccess(std::vector<BSONObj>{BSON("x" << 1)}); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(BatchWriteExecTest, MultiOpLarge) { @@ -277,7 +277,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) { @@ -312,7 +312,7 @@ TEST_F(BatchWriteExecTest, SingleOpError) { expectInsertsReturnError({BSON("x" << 1)}, errResponse); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } // @@ -347,7 +347,7 @@ TEST_F(BatchWriteExecTest, StaleOp) { expectInsertsReturnStaleVersionErrors(expected); expectInsertsReturnSuccess(expected); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(BatchWriteExecTest, MultiStaleOp) { @@ -381,7 +381,7 @@ TEST_F(BatchWriteExecTest, MultiStaleOp) { expectInsertsReturnSuccess(expected); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(BatchWriteExecTest, TooManyStaleOp) { @@ -418,7 +418,7 @@ TEST_F(BatchWriteExecTest, TooManyStaleOp) { expectInsertsReturnStaleVersionErrors({BSON("x" << 1), BSON("x" << 2)}); } - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(BatchWriteExecTest, RetryableWritesLargeBatch) { @@ -461,7 +461,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) { @@ -499,7 +499,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) { @@ -536,7 +536,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) { @@ -577,7 +577,7 @@ TEST_F(BatchWriteExecTest, NonRetryableErrorTxnNumber) { expectInsertsReturnError({BSON("x" << 1), BSON("x" << 2)}, nonRetryableErrResponse); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(BatchWriteExecTest, StaleEpochIsNotRetryable) { @@ -617,7 +617,7 @@ TEST_F(BatchWriteExecTest, StaleEpochIsNotRetryable) { expectInsertsReturnError({BSON("x" << 1), BSON("x" << 2)}, nonRetryableErrResponse); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } class BatchWriteExecTransactionTest : public BatchWriteExecTest { @@ -699,7 +699,7 @@ TEST_F(BatchWriteExecTransactionTest, ErrorInBatchThrows_CommandError) { expectInsertsReturnError({BSON("x" << 1), BSON("x" << 2)}, failedResponse); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(BatchWriteExecTransactionTest, ErrorInBatchThrows_WriteError) { @@ -727,7 +727,7 @@ TEST_F(BatchWriteExecTransactionTest, ErrorInBatchThrows_WriteError) { // Any write error works, using SSV for convenience. expectInsertsReturnStaleVersionErrors({BSON("x" << 1), BSON("x" << 2)}); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(BatchWriteExecTransactionTest, ErrorInBatchThrows_WriteErrorOrdered) { @@ -755,7 +755,7 @@ TEST_F(BatchWriteExecTransactionTest, ErrorInBatchThrows_WriteErrorOrdered) { // Any write error works, using SSV for convenience. expectInsertsReturnStaleVersionErrors({BSON("x" << 1), BSON("x" << 2)}); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } TEST_F(BatchWriteExecTransactionTest, ErrorInBatchThrows_WriteConcernError) { @@ -809,7 +809,7 @@ TEST_F(BatchWriteExecTransactionTest, ErrorInBatchThrows_WriteConcernError) { return bob.obj(); }); - future.timed_get(kFutureTimeout); + future.default_timed_get(); } } // namespace |