summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_union_with_test.cpp
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2020-01-14 12:37:09 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-02-26 00:41:40 +0000
commit27363455aaba930778a5feff02b0b320d4b850af (patch)
tree7436cbb7be03dc9c98d68349c44977b4a71f066f /src/mongo/db/pipeline/document_source_union_with_test.cpp
parent183e8c5c04d77ea840468ba8723970fa67258376 (diff)
downloadmongo-27363455aaba930778a5feff02b0b320d4b850af.tar.gz
SERVER-45538 Add shard version retry logic for $unionWith sub-pipeline
Diffstat (limited to 'src/mongo/db/pipeline/document_source_union_with_test.cpp')
-rw-r--r--src/mongo/db/pipeline/document_source_union_with_test.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/document_source_union_with_test.cpp b/src/mongo/db/pipeline/document_source_union_with_test.cpp
index 61412ad421c..29d38f916bf 100644
--- a/src/mongo/db/pipeline/document_source_union_with_test.cpp
+++ b/src/mongo/db/pipeline/document_source_union_with_test.cpp
@@ -324,6 +324,23 @@ TEST_F(DocumentSourceUnionWithTest, PropagatePauses) {
ASSERT_TRUE(unionWithTwo.getNext().isEOF());
}
+TEST_F(DocumentSourceUnionWithTest, ReturnEOFAfterBeingDisposed) {
+ const auto mockInput = DocumentSourceMock::createForTest({Document(), Document()});
+ const auto mockUnionInput = std::deque<DocumentSource::GetNextResult>{};
+ const auto mockCtx = getExpCtx()->copyWith({});
+ mockCtx->mongoProcessInterface = std::make_unique<MockMongoInterface>(mockUnionInput);
+ auto unionWith = DocumentSourceUnionWith(
+ mockCtx, Pipeline::create(std::list<boost::intrusive_ptr<DocumentSource>>{}, getExpCtx()));
+ unionWith.setSource(mockInput.get());
+
+ ASSERT_TRUE(unionWith.getNext().isAdvanced());
+
+ unionWith.dispose();
+ ASSERT_TRUE(unionWith.getNext().isEOF());
+ ASSERT_TRUE(unionWith.getNext().isEOF());
+ ASSERT_TRUE(unionWith.getNext().isEOF());
+}
+
TEST_F(DocumentSourceUnionWithTest, DependencyAnalysisReportsFullDoc) {
auto expCtx = getExpCtx();
const auto replaceRoot =