summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r--src/mongo/db/commands/create_indexes_test.cpp3
-rw-r--r--src/mongo/db/commands/fle_compact_test.cpp14
-rw-r--r--src/mongo/db/commands/index_filter_commands_test.cpp3
-rw-r--r--src/mongo/db/commands/map_reduce_agg_test.cpp24
-rw-r--r--src/mongo/db/commands/mr_test.cpp6
-rw-r--r--src/mongo/db/commands/plan_cache_commands_test.cpp3
6 files changed, 30 insertions, 23 deletions
diff --git a/src/mongo/db/commands/create_indexes_test.cpp b/src/mongo/db/commands/create_indexes_test.cpp
index 1477ab3dcb0..3c8cc4268e3 100644
--- a/src/mongo/db/commands/create_indexes_test.cpp
+++ b/src/mongo/db/commands/create_indexes_test.cpp
@@ -43,7 +43,8 @@ TEST_F(CreateIndexesTest, CreateIndexesFailsWhenIndexBuildsCollectionIsMissing)
ASSERT_OK(
storageInterface()->dropCollection(opCtx, NamespaceString::kIndexBuildEntryNamespace));
- NamespaceString nss("unittests.timestampMultiIndexBuilds");
+ NamespaceString nss =
+ NamespaceString::createNamespaceString_forTest("unittests.timestampMultiIndexBuilds");
ASSERT_OK(storageInterface()->createCollection(operationContext(), nss, {}));
diff --git a/src/mongo/db/commands/fle_compact_test.cpp b/src/mongo/db/commands/fle_compact_test.cpp
index 3a97d158063..88209614fba 100644
--- a/src/mongo/db/commands/fle_compact_test.cpp
+++ b/src/mongo/db/commands/fle_compact_test.cpp
@@ -222,11 +222,11 @@ void FleCompactTest::setUp() {
_queryImpl = std::make_unique<FLEQueryInterfaceMock>(_opCtx.get(), _storage);
- _namespaces.edcNss = NamespaceString("test.edc");
- _namespaces.escNss = NamespaceString("test.esc");
- _namespaces.eccNss = NamespaceString("test.ecc");
- _namespaces.ecocNss = NamespaceString("test.ecoc");
- _namespaces.ecocRenameNss = NamespaceString("test.ecoc.compact");
+ _namespaces.edcNss = NamespaceString::createNamespaceString_forTest("test.edc");
+ _namespaces.escNss = NamespaceString::createNamespaceString_forTest("test.esc");
+ _namespaces.eccNss = NamespaceString::createNamespaceString_forTest("test.ecc");
+ _namespaces.ecocNss = NamespaceString::createNamespaceString_forTest("test.ecoc");
+ _namespaces.ecocRenameNss = NamespaceString::createNamespaceString_forTest("test.ecoc.compact");
createCollection(_namespaces.edcNss);
createCollection(_namespaces.escNss);
@@ -244,7 +244,9 @@ void FleCompactTest::createCollection(const NamespaceString& ns) {
CollectionOptions collectionOptions;
collectionOptions.uuid = UUID::gen();
auto statusCC = _storage->createCollection(
- _opCtx.get(), NamespaceString(ns.db(), ns.coll()), collectionOptions);
+ _opCtx.get(),
+ NamespaceString::createNamespaceString_forTest(ns.dbName(), ns.coll()),
+ collectionOptions);
ASSERT_OK(statusCC);
}
diff --git a/src/mongo/db/commands/index_filter_commands_test.cpp b/src/mongo/db/commands/index_filter_commands_test.cpp
index 123576874bb..9dc5f8b88a0 100644
--- a/src/mongo/db/commands/index_filter_commands_test.cpp
+++ b/src/mongo/db/commands/index_filter_commands_test.cpp
@@ -349,7 +349,8 @@ private:
QuerySettings _querySettings;
};
-const NamespaceString IndexFilterCommandsTest::_nss{"test.collection"};
+const NamespaceString IndexFilterCommandsTest::_nss(
+ NamespaceString::createNamespaceString_forTest("test.collection"));
/**
* Tests for ListFilters
diff --git a/src/mongo/db/commands/map_reduce_agg_test.cpp b/src/mongo/db/commands/map_reduce_agg_test.cpp
index b47b2bfa0e4..36471106b0e 100644
--- a/src/mongo/db/commands/map_reduce_agg_test.cpp
+++ b/src/mongo/db/commands/map_reduce_agg_test.cpp
@@ -60,7 +60,7 @@ constexpr auto reduceJavascript = "reduce!"_sd;
constexpr auto finalizeJavascript = "finalize!"_sd;
TEST(MapReduceAggTest, testBasicTranslate) {
- auto nss = NamespaceString{"db", "coll"};
+ auto nss = NamespaceString::createNamespaceString_forTest("db", "coll");
auto mr =
MapReduceCommandRequest{nss,
MapReduceJavascriptCode{mapJavascript.toString()},
@@ -77,7 +77,7 @@ TEST(MapReduceAggTest, testBasicTranslate) {
}
TEST(MapReduceAggTest, testSortWithoutLimit) {
- auto nss = NamespaceString{"db", "coll"};
+ auto nss = NamespaceString::createNamespaceString_forTest("db", "coll");
auto mr =
MapReduceCommandRequest{nss,
MapReduceJavascriptCode{mapJavascript.toString()},
@@ -98,7 +98,7 @@ TEST(MapReduceAggTest, testSortWithoutLimit) {
}
TEST(MapReduceAggTest, testSortWithLimit) {
- auto nss = NamespaceString{"db", "coll"};
+ auto nss = NamespaceString::createNamespaceString_forTest("db", "coll");
auto mr =
MapReduceCommandRequest{nss,
MapReduceJavascriptCode{mapJavascript.toString()},
@@ -123,7 +123,7 @@ TEST(MapReduceAggTest, testSortWithLimit) {
}
TEST(MapReduceAggTest, testLimitNoSort) {
- auto nss = NamespaceString{"db", "coll"};
+ auto nss = NamespaceString::createNamespaceString_forTest("db", "coll");
auto mr =
MapReduceCommandRequest{nss,
MapReduceJavascriptCode{mapJavascript.toString()},
@@ -144,7 +144,7 @@ TEST(MapReduceAggTest, testLimitNoSort) {
}
TEST(MapReduceAggTest, testFeatureLadenTranslate) {
- auto nss = NamespaceString{"db", "coll"};
+ auto nss = NamespaceString::createNamespaceString_forTest("db", "coll");
auto mr = MapReduceCommandRequest{
nss,
MapReduceJavascriptCode{mapJavascript.toString()},
@@ -170,7 +170,7 @@ TEST(MapReduceAggTest, testFeatureLadenTranslate) {
}
TEST(MapReduceAggTest, testOutMergeTranslate) {
- auto nss = NamespaceString{"db", "coll"};
+ auto nss = NamespaceString::createNamespaceString_forTest("db", "coll");
auto mr = MapReduceCommandRequest{
nss,
MapReduceJavascriptCode{mapJavascript.toString()},
@@ -190,7 +190,7 @@ TEST(MapReduceAggTest, testOutMergeTranslate) {
}
TEST(MapReduceAggTest, testOutReduceTranslate) {
- auto nss = NamespaceString{"db", "coll"};
+ auto nss = NamespaceString::createNamespaceString_forTest("db", "coll");
auto mr = MapReduceCommandRequest{
nss,
MapReduceJavascriptCode{mapJavascript.toString()},
@@ -212,7 +212,7 @@ TEST(MapReduceAggTest, testOutReduceTranslate) {
}
TEST(MapReduceAggTest, testOutSameCollection) {
- auto nss = NamespaceString{"db", "coll"};
+ auto nss = NamespaceString::createNamespaceString_forTest("db", "coll");
auto mr = MapReduceCommandRequest{
nss,
MapReduceJavascriptCode{mapJavascript.toString()},
@@ -230,7 +230,7 @@ TEST(MapReduceAggTest, testOutSameCollection) {
}
TEST(MapReduceAggTest, testSourceDestinationCollectionsEqualMergeDoesNotFail) {
- auto nss = NamespaceString{"db", "coll"};
+ auto nss = NamespaceString::createNamespaceString_forTest("db", "coll");
auto mr = MapReduceCommandRequest{
nss,
MapReduceJavascriptCode{mapJavascript.toString()},
@@ -241,7 +241,7 @@ TEST(MapReduceAggTest, testSourceDestinationCollectionsEqualMergeDoesNotFail) {
}
TEST(MapReduceAggTest, testSourceDestinationCollectionsNotEqualMergeDoesNotFail) {
- auto nss = NamespaceString{"db", "coll"};
+ auto nss = NamespaceString::createNamespaceString_forTest("db", "coll");
auto mr = MapReduceCommandRequest{
nss,
MapReduceJavascriptCode{mapJavascript.toString()},
@@ -252,7 +252,7 @@ TEST(MapReduceAggTest, testSourceDestinationCollectionsNotEqualMergeDoesNotFail)
}
TEST(MapReduceAggTest, testShardedTrueWithReplaceActionIsNotAllowed) {
- auto nss = NamespaceString{"db", "coll"};
+ auto nss = NamespaceString::createNamespaceString_forTest("db", "coll");
auto mr = MapReduceCommandRequest{
nss,
MapReduceJavascriptCode{mapJavascript.toString()},
@@ -265,7 +265,7 @@ TEST(MapReduceAggTest, testShardedTrueWithReplaceActionIsNotAllowed) {
TEST(MapReduceAggTest, testErrorMessagesTranslated) {
// Verifies that agg specific error messages are translated to be mapReduce specific.
- auto nss = NamespaceString{"db", "coll1"};
+ auto nss = NamespaceString::createNamespaceString_forTest("db", "coll1");
auto mr = MapReduceCommandRequest{
nss,
diff --git a/src/mongo/db/commands/mr_test.cpp b/src/mongo/db/commands/mr_test.cpp
index ed3bbd03458..0c1272e7613 100644
--- a/src/mongo/db/commands/mr_test.cpp
+++ b/src/mongo/db/commands/mr_test.cpp
@@ -393,8 +393,10 @@ protected:
MapReduceOpObserver* _opObserver = nullptr;
};
-const NamespaceString MapReduceCommandTest::inputNss("myDB.myCollection");
-const NamespaceString MapReduceCommandTest::outputNss(inputNss.getSisterNS("outCollection"));
+const NamespaceString MapReduceCommandTest::inputNss =
+ NamespaceString::createNamespaceString_forTest("myDB.myCollection");
+const NamespaceString MapReduceCommandTest::outputNss =
+ NamespaceString::createNamespaceString_forTest(inputNss.getSisterNS("outCollection"));
void MapReduceCommandTest::setUp() {
ServiceContextMongoDTest::setUp();
diff --git a/src/mongo/db/commands/plan_cache_commands_test.cpp b/src/mongo/db/commands/plan_cache_commands_test.cpp
index 3495ee127d6..7c91d584801 100644
--- a/src/mongo/db/commands/plan_cache_commands_test.cpp
+++ b/src/mongo/db/commands/plan_cache_commands_test.cpp
@@ -38,7 +38,8 @@
namespace mongo {
namespace {
-static const NamespaceString nss{"test.collection"_sd};
+static const NamespaceString nss =
+ NamespaceString::createNamespaceString_forTest("test.collection"_sd);
PlanCacheKey makeClassicKey(const CanonicalQuery& cq) {
CollectionMock coll(nss);