summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/implicit_collection_creation_test.cpp
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2021-04-28 18:40:52 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-04-28 23:01:06 +0000
commit00d3ec0d3a9d7c4077148f528bb1f7293fd1b238 (patch)
treef978b5eb645081d2f73b655ce57dfa86bab12d4b /src/mongo/db/s/implicit_collection_creation_test.cpp
parent0ff6ae4f5e0a69a36610b0ea645ad2dd48132926 (diff)
downloadmongo-00d3ec0d3a9d7c4077148f528bb1f7293fd1b238.tar.gz
SERVER-47123 remove AutoGetOrCreateDb from non-catalog unit tests
Diffstat (limited to 'src/mongo/db/s/implicit_collection_creation_test.cpp')
-rw-r--r--src/mongo/db/s/implicit_collection_creation_test.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mongo/db/s/implicit_collection_creation_test.cpp b/src/mongo/db/s/implicit_collection_creation_test.cpp
index 7754e1acbd2..cd299acf0c8 100644
--- a/src/mongo/db/s/implicit_collection_creation_test.cpp
+++ b/src/mongo/db/s/implicit_collection_creation_test.cpp
@@ -43,11 +43,11 @@ class ImplicitCollectionCreationTest : public ShardServerTestFixture {};
TEST_F(ImplicitCollectionCreationTest, ImplicitCreateDisallowedByDefault) {
NamespaceString nss("ImplicitCreateDisallowedByDefaultDB.TestColl");
- AutoGetOrCreateDb db(operationContext(), nss.db(), MODE_IX);
- Lock::CollectionLock collLock(operationContext(), nss, MODE_IX);
+ AutoGetCollection autoColl(operationContext(), nss, MODE_IX);
+ auto db = autoColl.ensureDbExists();
WriteUnitOfWork wuow(operationContext());
ASSERT_THROWS_CODE(
- uassertStatusOK(db.getDb()->userCreateNS(operationContext(), nss, CollectionOptions{})),
+ uassertStatusOK(db->userCreateNS(operationContext(), nss, CollectionOptions{})),
DBException,
ErrorCodes::CannotImplicitlyCreateCollection);
wuow.commit();
@@ -57,10 +57,10 @@ TEST_F(ImplicitCollectionCreationTest, AllowImplicitCollectionCreate) {
NamespaceString nss("AllowImplicitCollectionCreateDB.TestColl");
OperationShardingState::ScopedAllowImplicitCollectionCreate_UNSAFE unsafeCreateCollection(
operationContext());
- AutoGetOrCreateDb db(operationContext(), nss.db(), MODE_IX);
- Lock::CollectionLock collLock(operationContext(), nss, MODE_IX);
+ AutoGetCollection autoColl(operationContext(), nss, MODE_IX);
+ auto db = autoColl.ensureDbExists();
WriteUnitOfWork wuow(operationContext());
- ASSERT_OK(db.getDb()->userCreateNS(operationContext(), nss, CollectionOptions{}));
+ ASSERT_OK(db->userCreateNS(operationContext(), nss, CollectionOptions{}));
wuow.commit();
}