diff options
author | Brigitte Lamarche <thesisiwbl@gmail.com> | 2018-12-20 14:24:02 -0500 |
---|---|---|
committer | Brigitte Lamarche <thesisiwbl@gmail.com> | 2019-01-03 15:13:57 -0500 |
commit | bb9114dc71bfcf42422471f7789eca00881b8864 (patch) | |
tree | 4809839aab0c3f97bf56a66df15cd8eae8b03ca2 /src/mongo/db/pipeline/document_source_lookup_test.cpp | |
parent | 68832e1f70fa4571673ab337ae2e529b04b67e6b (diff) | |
download | mongo-bb9114dc71bfcf42422471f7789eca00881b8864.tar.gz |
SERVER-38362 Prevent $out stage within $lookup
Diffstat (limited to 'src/mongo/db/pipeline/document_source_lookup_test.cpp')
-rw-r--r-- | src/mongo/db/pipeline/document_source_lookup_test.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/mongo/db/pipeline/document_source_lookup_test.cpp b/src/mongo/db/pipeline/document_source_lookup_test.cpp index 027a06c5e15..64e12231227 100644 --- a/src/mongo/db/pipeline/document_source_lookup_test.cpp +++ b/src/mongo/db/pipeline/document_source_lookup_test.cpp @@ -215,12 +215,12 @@ TEST_F(DocumentSourceLookUpTest, LookupEmptyPipelineDoesntUseDiskAndIsOKInATrans DocumentSource::TransactionRequirement::kAllowed); } -TEST_F(DocumentSourceLookUpTest, LookupWithChildStagesInheritsDiskUseRequirement) { +TEST_F(DocumentSourceLookUpTest, LookupWithOutInPipelineNotAllowed) { + auto ERROR_CODE_OUT_BANNED_IN_LOOKUP = 51047; auto expCtx = getExpCtx(); NamespaceString fromNs("test", "coll"); expCtx->setResolvedNamespace_forTest(fromNs, {fromNs, std::vector<BSONObj>{}}); - - auto docSource = + ASSERT_THROWS_CODE( DocumentSourceLookUp::createFromBson(BSON("$lookup" << BSON("from" << "coll" << "pipeline" @@ -229,14 +229,9 @@ TEST_F(DocumentSourceLookUpTest, LookupWithChildStagesInheritsDiskUseRequirement << "as" << "as")) .firstElement(), - expCtx); - auto lookup = static_cast<DocumentSourceLookUp*>(docSource.get()); - - ASSERT_TRUE(lookup->wasConstructedWithPipelineSyntax()); - ASSERT(lookup->constraints(Pipeline::SplitState::kUnsplit).diskRequirement == - DocumentSource::DiskUseRequirement::kWritesPersistentData); - ASSERT(lookup->constraints(Pipeline::SplitState::kUnsplit).transactionRequirement == - DocumentSource::TransactionRequirement::kNotAllowed); + expCtx), + AssertionException, + ERROR_CODE_OUT_BANNED_IN_LOOKUP); } TEST_F(DocumentSourceLookUpTest, LiteParsedDocumentSourceLookupContainsExpectedNamespaces) { |