summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/plan_cache_commands_test.cpp
diff options
context:
space:
mode:
authorTess Avitabile <tess.avitabile@mongodb.com>2016-05-05 17:33:34 -0400
committerTess Avitabile <tess.avitabile@mongodb.com>2016-05-10 16:00:35 -0400
commit8f8043d6128813e9862b5a5c30a90d007d92c363 (patch)
treec5cf74eab1ad31f171b5fef90d39d4247df6b086 /src/mongo/db/commands/plan_cache_commands_test.cpp
parent87f738623ffe55535fde1462cda5d9715893e713 (diff)
downloadmongo-8f8043d6128813e9862b5a5c30a90d007d92c363.tar.gz
SERVER-24045 Refactor CanonicalQuery::canonicalize()
Diffstat (limited to 'src/mongo/db/commands/plan_cache_commands_test.cpp')
-rw-r--r--src/mongo/db/commands/plan_cache_commands_test.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/mongo/db/commands/plan_cache_commands_test.cpp b/src/mongo/db/commands/plan_cache_commands_test.cpp
index ab811c7cf92..21cbc937e73 100644
--- a/src/mongo/db/commands/plan_cache_commands_test.cpp
+++ b/src/mongo/db/commands/plan_cache_commands_test.cpp
@@ -130,8 +130,10 @@ TEST(PlanCacheCommandsTest, planCacheListQueryShapesOneKey) {
auto txn = serviceContext.makeOperationContext();
// Create a canonical query
+ auto lpq = stdx::make_unique<LiteParsedQuery>(nss);
+ lpq->setFilter(fromjson("{a: 1}"));
auto statusWithCQ = CanonicalQuery::canonicalize(
- txn.get(), nss, fromjson("{a: 1}"), ExtensionsCallbackDisallowExtensions());
+ txn.get(), std::move(lpq), ExtensionsCallbackDisallowExtensions());
ASSERT_OK(statusWithCQ.getStatus());
unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
@@ -159,8 +161,10 @@ TEST(PlanCacheCommandsTest, planCacheClearAllShapes) {
auto txn = serviceContext.makeOperationContext();
// Create a canonical query
+ auto lpq = stdx::make_unique<LiteParsedQuery>(nss);
+ lpq->setFilter(fromjson("{a: 1}"));
auto statusWithCQ = CanonicalQuery::canonicalize(
- txn.get(), nss, fromjson("{a: 1}"), ExtensionsCallbackDisallowExtensions());
+ txn.get(), std::move(lpq), ExtensionsCallbackDisallowExtensions());
ASSERT_OK(statusWithCQ.getStatus());
unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
@@ -278,12 +282,16 @@ TEST(PlanCacheCommandsTest, planCacheClearOneKey) {
auto txn = serviceContext.makeOperationContext();
// Create 2 canonical queries.
+ auto lpqA = stdx::make_unique<LiteParsedQuery>(nss);
+ lpqA->setFilter(fromjson("{a: 1}"));
auto statusWithCQA = CanonicalQuery::canonicalize(
- txn.get(), nss, fromjson("{a: 1}"), ExtensionsCallbackDisallowExtensions());
+ txn.get(), std::move(lpqA), ExtensionsCallbackDisallowExtensions());
ASSERT_OK(statusWithCQA.getStatus());
+ auto lpqB = stdx::make_unique<LiteParsedQuery>(nss);
+ lpqB->setFilter(fromjson("{b: 1}"));
unique_ptr<CanonicalQuery> cqA = std::move(statusWithCQA.getValue());
auto statusWithCQB = CanonicalQuery::canonicalize(
- txn.get(), nss, fromjson("{b: 1}"), ExtensionsCallbackDisallowExtensions());
+ txn.get(), std::move(lpqB), ExtensionsCallbackDisallowExtensions());
ASSERT_OK(statusWithCQB.getStatus());
unique_ptr<CanonicalQuery> cqB = std::move(statusWithCQB.getValue());
@@ -404,8 +412,10 @@ TEST(PlanCacheCommandsTest, planCacheListPlansOnlyOneSolutionTrue) {
auto txn = serviceContext.makeOperationContext();
// Create a canonical query
+ auto lpq = stdx::make_unique<LiteParsedQuery>(nss);
+ lpq->setFilter(fromjson("{a: 1}"));
auto statusWithCQ = CanonicalQuery::canonicalize(
- txn.get(), nss, fromjson("{a: 1}"), ExtensionsCallbackDisallowExtensions());
+ txn.get(), std::move(lpq), ExtensionsCallbackDisallowExtensions());
ASSERT_OK(statusWithCQ.getStatus());
unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
@@ -427,8 +437,10 @@ TEST(PlanCacheCommandsTest, planCacheListPlansOnlyOneSolutionFalse) {
auto txn = serviceContext.makeOperationContext();
// Create a canonical query
+ auto lpq = stdx::make_unique<LiteParsedQuery>(nss);
+ lpq->setFilter(fromjson("{a: 1}"));
auto statusWithCQ = CanonicalQuery::canonicalize(
- txn.get(), nss, fromjson("{a: 1}"), ExtensionsCallbackDisallowExtensions());
+ txn.get(), std::move(lpq), ExtensionsCallbackDisallowExtensions());
ASSERT_OK(statusWithCQ.getStatus());
unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());