summaryrefslogtreecommitdiff
path: root/jstests/libs
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2018-04-10 13:25:49 -0400
committerCharlie Swanson <charlie.swanson@mongodb.com>2018-04-12 14:00:17 -0400
commitec25294c8d0c1c60ff786ea99198749dc4788dd1 (patch)
tree7d7f55565974f226f3c8c9fb60e36c4f33ded665 /jstests/libs
parent49ab42843f85a50a215687ddbd1dd5db6a94738c (diff)
downloadmongo-ec25294c8d0c1c60ff786ea99198749dc4788dd1.tar.gz
SERVER-34181 Include 'clusterTime' in each change stream
Diffstat (limited to 'jstests/libs')
-rw-r--r--jstests/libs/change_stream_util.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/jstests/libs/change_stream_util.js b/jstests/libs/change_stream_util.js
index a27ec4fe9af..b070db8f6ff 100644
--- a/jstests/libs/change_stream_util.js
+++ b/jstests/libs/change_stream_util.js
@@ -91,8 +91,9 @@ function ChangeStreamTest(_db, name = "ChangeStreamTest") {
/**
* Asserts that the last observed change was the change we expect to see. This also asserts
* that if we do not expect the cursor to be invalidated, that we do not see the cursor
- * invalidated. Omits the observed change's resume token from the comparison, unless the
- * expected change explicitly lists an _id field to compare against.
+ * invalidated. Omits the observed change's resume token and cluster time from the comparison,
+ * unless the expected change explicitly lists an '_id' or 'clusterTime' field to compare
+ * against.
*/
function assertChangeIsExpected(
expectedChanges, numChangesSeen, observedChanges, expectInvalidate) {
@@ -101,6 +102,9 @@ function ChangeStreamTest(_db, name = "ChangeStreamTest") {
if (expectedChanges[numChangesSeen]._id == null) {
delete lastObservedChange._id; // Remove the resume token, if present.
}
+ if (expectedChanges[numChangesSeen].clusterTime == null) {
+ delete lastObservedChange.clusterTime; // Remove the cluster time, if present.
+ }
assert.docEq(lastObservedChange,
expectedChanges[numChangesSeen],
"Change did not match expected change. Expected changes: " +