diff options
Diffstat (limited to 'src/mongo/db/repl')
-rw-r--r-- | src/mongo/db/repl/tenant_migration_recipient_service_test.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/mongo/db/repl/tenant_migration_recipient_service_test.cpp b/src/mongo/db/repl/tenant_migration_recipient_service_test.cpp index 3ead92bb258..019467c5b49 100644 --- a/src/mongo/db/repl/tenant_migration_recipient_service_test.cpp +++ b/src/mongo/db/repl/tenant_migration_recipient_service_test.cpp @@ -3473,8 +3473,13 @@ TEST_F(TenantMigrationRecipientServiceTest, IncrementNumRestartsDueToRecipientFa CollectionOptions collectionOptions; collectionOptions.uuid = UUID::gen(); auto storage = StorageInterface::get(opCtx->getServiceContext()); - ASSERT_OK(storage->createCollection( - opCtx.get(), NamespaceString::kTenantMigrationRecipientsNamespace, collectionOptions)); + const auto status = storage->createCollection( + opCtx.get(), NamespaceString::kTenantMigrationRecipientsNamespace, collectionOptions); + if (!status.isOK()) { + // It's possible to race with the test fixture setup in creating the tenant recipient + // collection. + ASSERT_EQ(ErrorCodes::NamespaceExists, status.code()); + } ASSERT_OK(storage->insertDocument(opCtx.get(), NamespaceString::kTenantMigrationRecipientsNamespace, {initialStateDocument.toBSON()}, @@ -3520,8 +3525,13 @@ TEST_F(TenantMigrationRecipientServiceTest, CollectionOptions collectionOptions; collectionOptions.uuid = UUID::gen(); auto storage = StorageInterface::get(opCtx->getServiceContext()); - ASSERT_OK(storage->createCollection( - opCtx.get(), NamespaceString::kTenantMigrationRecipientsNamespace, collectionOptions)); + const auto status = storage->createCollection( + opCtx.get(), NamespaceString::kTenantMigrationRecipientsNamespace, collectionOptions); + if (!status.isOK()) { + // It's possible to race with the test fixture setup in creating the tenant recipient + // collection. + ASSERT_EQ(ErrorCodes::NamespaceExists, status.code()); + } ASSERT_OK(storage->insertDocument(opCtx.get(), NamespaceString::kTenantMigrationRecipientsNamespace, {initialStateDocument.toBSON()}, |