summaryrefslogtreecommitdiff
path: root/jstests/change_streams
diff options
context:
space:
mode:
authorIan Boros <ian.boros@10gen.com>2018-05-02 11:24:56 -0400
committerIan Boros <ian.boros@10gen.com>2018-05-02 17:23:53 -0400
commita54e19b6d2e4c027057c9c7bbb6fa76ec60364fc (patch)
tree6a404f01b91c3fa7c522dd489b2ccaa72d115b61 /jstests/change_streams
parent1a605a99bdc242fd957afdb6e9fe9b8f9c32c862 (diff)
downloadmongo-a54e19b6d2e4c027057c9c7bbb6fa76ec60364fc.tar.gz
SERVER-34032 part 2: Relax tests which attempt to resume a change stream after invalidate
Diffstat (limited to 'jstests/change_streams')
-rw-r--r--jstests/change_streams/change_stream_rename_resumability.js18
-rw-r--r--jstests/change_streams/change_stream_rename_target.js16
2 files changed, 23 insertions, 11 deletions
diff --git a/jstests/change_streams/change_stream_rename_resumability.js b/jstests/change_streams/change_stream_rename_resumability.js
index e3d7f5191c5..5d7e8d3c153 100644
--- a/jstests/change_streams/change_stream_rename_resumability.js
+++ b/jstests/change_streams/change_stream_rename_resumability.js
@@ -33,12 +33,16 @@
assert.eq(change.operationType, "invalidate", tojson(change));
assert(cursor.isExhausted());
- // Try resuming from the invalidate.
- const resumeCursor = coll.watch([], {resumeAfter: change._id});
+ // TODO SERVER-34789: The code below should throw an error. We exercise this behavior here to
+ // be sure that it doesn't crash the server, but the ability to resume a change stream after an
+ // invalidate is a bug, not a feature.
- // Be sure we can see the change after the rename.
- assert.soon(() => resumeCursor.hasNext());
- change = resumeCursor.next();
- assert.eq(change.operationType, "insert", tojson(change));
- assert.docEq(change.fullDocument, {_id: 2});
+ // Try resuming from the invalidate.
+ assert.doesNotThrow(function() {
+ const resumeCursor = coll.watch([], {resumeAfter: change._id});
+ assert.soon(() => resumeCursor.hasNext());
+ // Not checking the contents of the document returned, because we do not technically
+ // support this behavior.
+ resumeCursor.next();
+ });
}());
diff --git a/jstests/change_streams/change_stream_rename_target.js b/jstests/change_streams/change_stream_rename_target.js
index 3ff1b4289f0..92a1d0c7c64 100644
--- a/jstests/change_streams/change_stream_rename_target.js
+++ b/jstests/change_streams/change_stream_rename_target.js
@@ -33,8 +33,16 @@
// Do another insert.
assert.writeOK(testDB[collName2].insert({_id: 2}));
- let cursor = testDB[collName2].watch([], {resumeAfter: invalidate._id});
- assert.soon(() => cursor.hasNext());
- let change = cursor.next();
- assert.docEq(change.fullDocument, {_id: 2});
+ // TODO SERVER-34789: The code below should throw an error. We exercise this behavior here to
+ // be sure that it doesn't crash the server, but the ability to resume a change stream after an
+ // invalidate is a bug, not a feature.
+
+ // Try resuming from the invalidate.
+ assert.doesNotThrow(function() {
+ let cursor = testDB[collName2].watch([], {resumeAfter: invalidate._id});
+ assert.soon(() => cursor.hasNext());
+ // Not checking the contents of the document returned, because we do not technically
+ // support this behavior.
+ cursor.next();
+ });
}());