diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2020-09-04 06:24:39 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-09-05 11:02:40 +0000 |
commit | 8a86a51758f4913fd21f01408a402e5a6f787ea5 (patch) | |
tree | c9904976630ff0bedb3088b54953e5d6215024c1 | |
parent | d860991d18ac6976b930eb3a86d1294e83843869 (diff) | |
download | mongo-8a86a51758f4913fd21f01408a402e5a6f787ea5.tar.gz |
SERVER-46199 Fix CollectionShardingState <-> CatalogCache destruction order in unit-tests
-rw-r--r-- | src/mongo/db/s/migration_util_test.cpp | 11 | ||||
-rw-r--r-- | src/mongo/db/s/sharding_mongod_test_fixture.cpp | 1 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/mongo/db/s/migration_util_test.cpp b/src/mongo/db/s/migration_util_test.cpp index 0d06c8175d8..010f476773c 100644 --- a/src/mongo/db/s/migration_util_test.cpp +++ b/src/mongo/db/s/migration_util_test.cpp @@ -314,8 +314,10 @@ TEST_F(MigrationUtilsTest, TestInvalidUUID) { ASSERT_FALSE(migrationutil::checkForConflictingDeletions(opCtx, range, wrongUuid)); } -// Fixture that uses a mocked CatalogCacheLoader and CatalogClient to allow metadata refreshes -// without using the mock network. +/** + * Fixture that uses a mocked CatalogCacheLoader and CatalogClient to allow metadata refreshes + * without using the mock network. + */ class SubmitRangeDeletionTaskTest : public ShardServerTestFixture { public: const HostAndPort kConfigHostAndPort{"dummy", 123}; @@ -362,9 +364,8 @@ public: void tearDown() override { WaitForMajorityService::get(getServiceContext()).shutDown(); - CatalogCacheLoader::clearForTests(getServiceContext()); - ShardingMongodTestFixture::tearDown(); - CollectionShardingStateFactory::clear(getServiceContext()); + + ShardServerTestFixture::tearDown(); } // Mock for the ShardingCatalogClient used to satisfy loading all shards for the ShardRegistry diff --git a/src/mongo/db/s/sharding_mongod_test_fixture.cpp b/src/mongo/db/s/sharding_mongod_test_fixture.cpp index 4b73a742e02..a78fea13156 100644 --- a/src/mongo/db/s/sharding_mongod_test_fixture.cpp +++ b/src/mongo/db/s/sharding_mongod_test_fixture.cpp @@ -292,6 +292,7 @@ void ShardingMongodTestFixture::tearDown() { Grid::get(operationContext())->shardRegistry()->shutdown(); } + CollectionShardingStateFactory::clear(getServiceContext()); Grid::get(operationContext())->clearForUnitTests(); ServiceContextMongoDTest::tearDown(); |