summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorNick Zolnierz <nicholas.zolnierz@mongodb.com>2018-06-08 13:06:44 -0400
committerNick Zolnierz <nicholas.zolnierz@mongodb.com>2018-06-08 16:08:09 -0400
commit3895ea32a74e0046e0463761beb3702a845c053c (patch)
treed31bbb52038ed27bb5105ac1e9ccd3bdd387b957 /jstests
parent77fdba110d24da099a73b46b16f1f3a5ab8ed849 (diff)
downloadmongo-3895ea32a74e0046e0463761beb3702a845c053c.tar.gz
SERVER-35508: Robustify change streams collation.js test to handle drops of sharded collections on slow machines
Diffstat (limited to 'jstests')
-rw-r--r--jstests/change_streams/collation.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/jstests/change_streams/collation.js b/jstests/change_streams/collation.js
index 00432b91057..86c7563c339 100644
--- a/jstests/change_streams/collation.js
+++ b/jstests/change_streams/collation.js
@@ -312,8 +312,12 @@
// $changeStream.
assert.soon(() => changeStream.hasNext());
assert.docEq(changeStream.next().fullDocument, {_id: "dropped_coll", text: "ABC"});
- // Only single-collection streams will be exhausted from the drop.
- assert(changeStream.isExhausted() || isChangeStreamPassthrough());
+ // Only single-collection streams will be exhausted from the drop. Use 'next()' instead
+ // of 'isExhausted()' to force a getMore since the previous getMore may not include the
+ // collection drop, which is more likely with sharded collections on slow machines.
+ if (!isChangeStreamPassthrough()) {
+ assert.throws(() => changeStream.next());
+ }
// Test that a pipeline with an explicit collation is allowed to resume from before the
// collection is dropped and recreated.
@@ -323,8 +327,12 @@
assert.soon(() => changeStream.hasNext());
assert.docEq(changeStream.next().documentKey, {_id: "dropped_coll"});
- // Only single-collection streams will be exhausted from the drop.
- assert(changeStream.isExhausted() || isChangeStreamPassthrough());
+ // Only single-collection streams will be exhausted from the drop. Use 'next()' instead
+ // of 'isExhausted()' to force a getMore since the previous getMore may not include the
+ // collection drop, which is more likely with sharded collections on slow machines.
+ if (!isChangeStreamPassthrough()) {
+ assert.throws(() => changeStream.next());
+ }
// Test that a pipeline without an explicit collation is not allowed to resume,
// even though the collection has been recreated with the same default collation as it