summaryrefslogtreecommitdiff
path: root/src/mongo/s/query/router_stage_skip_test.cpp
diff options
context:
space:
mode:
authorYunhe (John) Wang <yunhe.wang@mongodb.com>2015-10-06 13:41:59 -0400
committerYunhe (John) Wang <yunhe.wang@mongodb.com>2015-10-08 13:31:20 -0400
commitaaf2969861e882624132c5d6b6141acfafc15aa7 (patch)
treef411c1634fdd7af47dde1a9cdb0bfe60335e571d /src/mongo/s/query/router_stage_skip_test.cpp
parent9b984cdc4b58be9002c692cd9ba8af2a3731b748 (diff)
downloadmongo-aaf2969861e882624132c5d6b6141acfafc15aa7.tar.gz
SERVER-20720 mongos now returns dead tailable cursor over an empty capped collection
Diffstat (limited to 'src/mongo/s/query/router_stage_skip_test.cpp')
-rw-r--r--src/mongo/s/query/router_stage_skip_test.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mongo/s/query/router_stage_skip_test.cpp b/src/mongo/s/query/router_stage_skip_test.cpp
index 84761d7b6ee..6e03e2d3301 100644
--- a/src/mongo/s/query/router_stage_skip_test.cpp
+++ b/src/mongo/s/query/router_stage_skip_test.cpp
@@ -172,6 +172,34 @@ TEST(RouterStageSkipTest, SkipStageToleratesMidStreamEOF) {
ASSERT(!thirdResult.getValue());
}
+TEST(RouterStageSkipTest, SkipStageRemotesExhausted) {
+ auto mockStage = stdx::make_unique<RouterStageMock>();
+ mockStage->queueResult(BSON("a" << 1));
+ mockStage->queueResult(BSON("a" << 2));
+ mockStage->queueResult(BSON("a" << 3));
+ mockStage->markRemotesExhausted();
+
+ auto skipStage = stdx::make_unique<RouterStageSkip>(std::move(mockStage), 1);
+ ASSERT_TRUE(skipStage->remotesExhausted());
+
+ auto firstResult = skipStage->next();
+ ASSERT_OK(firstResult.getStatus());
+ ASSERT(firstResult.getValue());
+ ASSERT_EQ(*firstResult.getValue(), BSON("a" << 2));
+ ASSERT_TRUE(skipStage->remotesExhausted());
+
+ auto secondResult = skipStage->next();
+ ASSERT_OK(secondResult.getStatus());
+ ASSERT(secondResult.getValue());
+ ASSERT_EQ(*secondResult.getValue(), BSON("a" << 3));
+ ASSERT_TRUE(skipStage->remotesExhausted());
+
+ auto thirdResult = skipStage->next();
+ ASSERT_OK(thirdResult.getStatus());
+ ASSERT(!thirdResult.getValue());
+ ASSERT_TRUE(skipStage->remotesExhausted());
+}
+
} // namespace
} // namespace mongo