summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Grebennicov <denis.grebennicov@mongodb.com>2022-01-17 14:37:49 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-01-24 10:21:19 +0000
commitb62f89db8088a592feff150f8116ac675bff7456 (patch)
tree120eeeefcd3b755ccdeb6b3738d10eb35c157290
parent942c7259628af723f70ea88c124a7c713a88fdf9 (diff)
downloadmongo-b62f89db8088a592feff150f8116ac675bff7456.tar.gz
SERVER-62148 Move changeStreamPreAndPostImages collection option tests from timeseries to changeStream test file
-rw-r--r--jstests/core/timeseries/timeseries_collmod.js8
-rw-r--r--jstests/core/timeseries/timeseries_create_collection.js14
-rw-r--r--jstests/noPassthrough/change_streams_pre_and_post_images_in_create_and_collmod.js16
3 files changed, 16 insertions, 22 deletions
diff --git a/jstests/core/timeseries/timeseries_collmod.js b/jstests/core/timeseries/timeseries_collmod.js
index 86374d30dbc..4108ce9c74a 100644
--- a/jstests/core/timeseries/timeseries_collmod.js
+++ b/jstests/core/timeseries/timeseries_collmod.js
@@ -51,14 +51,6 @@ assert.commandFailedWithCode(db.runCommand({"collMod": collName, "viewOn": "foo"
assert.commandFailedWithCode(db.runCommand({"collMod": collName, "recordPreImages": true}),
ErrorCodes.InvalidOptions);
-// Tries to set 'changeStreamPreAndPostImages' for a time-series collection.
-assert.commandFailedWithCode(
- db.runCommand({"collMod": collName, "changeStreamPreAndPostImages": {enabled: true}}), [
- ErrorCodes.InvalidOptions,
- // TODO SERVER-58584: remove the error code.
- 5846901
- ]);
-
// Successfully sets 'expireAfterSeconds' for a time-series collection.
assert.commandWorked(db.runCommand({"collMod": collName, "expireAfterSeconds": 60}));
diff --git a/jstests/core/timeseries/timeseries_create_collection.js b/jstests/core/timeseries/timeseries_create_collection.js
index 20de3e8974f..feb2f443d26 100644
--- a/jstests/core/timeseries/timeseries_create_collection.js
+++ b/jstests/core/timeseries/timeseries_create_collection.js
@@ -68,18 +68,4 @@ collections = assert.commandWorked(testDB.runCommand({listCollections: 1})).curs
jsTestLog('Checking listCollections result: ' + tojson(collections));
assert.isnull(collections.find(entry => entry.name === 'system.buckets.' + coll.getName()));
assert(collections.find(entry => entry.name === coll.getName()));
-
-// Should fail to create a timeseries collection with enabled 'changeStreamPreAndPostImages'
-// option.
-coll.drop();
-assert.commandFailedWithCode(testDB.runCommand({
- create: coll.getName(),
- timeseries: {timeField: timeFieldName},
- changeStreamPreAndPostImages: {enabled: true}
-}),
- [
- ErrorCodes.InvalidOptions,
- // TODO SERVER-58584: remove the error code.
- 5846901
- ]);
})();
diff --git a/jstests/noPassthrough/change_streams_pre_and_post_images_in_create_and_collmod.js b/jstests/noPassthrough/change_streams_pre_and_post_images_in_create_and_collmod.js
index 6b82ce1d7b7..e49969a3462 100644
--- a/jstests/noPassthrough/change_streams_pre_and_post_images_in_create_and_collmod.js
+++ b/jstests/noPassthrough/change_streams_pre_and_post_images_in_create_and_collmod.js
@@ -26,6 +26,7 @@ const collName = 'changeStreamPreAndPostImages';
const collName2 = 'changeStreamPreAndPostImages2';
const collName3 = 'changeStreamPreAndPostImages3';
const collName4 = 'changeStreamPreAndPostImages4';
+const collName5 = 'changeStreamPreAndPostImages5';
const viewName = "view";
const primary = rsTest.getPrimary();
@@ -126,5 +127,20 @@ assert.commandFailedWithCode(
testDB.runCommand({collMod: viewName, changeStreamPreAndPostImages: {enabled: true}}),
ErrorCodes.InvalidOptions);
+// Should fail to create a timeseries collection with enabled 'changeStreamPreAndPostImages'
+// option.
+assert.commandFailedWithCode(testDB.runCommand({
+ create: collName5,
+ timeseries: {timeField: 'time'},
+ changeStreamPreAndPostImages: {enabled: true}
+}),
+ ErrorCodes.InvalidOptions);
+
+// Should fail to enable 'changeStreamPreAndPostImages' option on a timeseries collection.
+assert.commandWorked(testDB.runCommand({create: collName5, timeseries: {timeField: 'time'}}));
+assert.commandFailedWithCode(
+ testDB.runCommand({collMod: collName5, changeStreamPreAndPostImages: {enabled: true}}),
+ ErrorCodes.InvalidOptions);
+
rsTest.stopSet();
}());