summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamie Anderson <jamie.anderson@mongodb.com>2021-04-30 17:06:53 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-05-04 14:43:52 +0000
commit8fdd8568c58310cbb1d4e177d95ec63955f6c1aa (patch)
tree3c334f1e023e050b08439a7f0132baa8ca33e64b
parent6f577614656655b5afd6da0c300e1871e75de781 (diff)
downloadmongo-8fdd8568c58310cbb1d4e177d95ec63955f6c1aa.tar.gz
SERVER-29438 Combine max_time_ms_sharded_new_commands.js with max_time_ms_sharded.js
-rw-r--r--jstests/noPassthrough/max_time_ms_sharded.js18
-rw-r--r--jstests/sharding/max_time_ms_sharded_new_commands.js41
2 files changed, 18 insertions, 41 deletions
diff --git a/jstests/noPassthrough/max_time_ms_sharded.js b/jstests/noPassthrough/max_time_ms_sharded.js
index 676651523bd..a0a34762874 100644
--- a/jstests/noPassthrough/max_time_ms_sharded.js
+++ b/jstests/noPassthrough/max_time_ms_sharded.js
@@ -215,6 +215,24 @@ configureMaxTimeAlwaysTimeOut("off");
assert.commandWorked(coll.runCommand("aggregate", {pipeline: [], cursor: {}, maxTimeMS: 60 * 1000}),
"expected aggregate to not hit time limit in mongod");
+// Positive test for "setFeatureCompatibilityVersion"
+configureMaxTimeAlwaysTimeOut("alwaysOn");
+assert.commandFailedWithCode(
+ admin.runCommand({setFeatureCompatibilityVersion: lastLTSFCV, maxTimeMS: 1000 * 60 * 60 * 24}),
+ ErrorCodes.MaxTimeMSExpired,
+ "expected setFeatureCompatibilityVersion to fail due to maxTimeAlwaysTimeOut fail point");
+
+// Negative test for "setFeatureCompatibilityVersion"
+configureMaxTimeAlwaysTimeOut("off");
+assert.commandWorked(
+ admin.runCommand({setFeatureCompatibilityVersion: lastLTSFCV, maxTimeMS: 1000 * 60 * 60 * 24}),
+ "expected setFeatureCompatibilityVersion to not hit time limit in mongod");
+
+// Negative test for "setFeatureCompatibilityVersion" to upgrade
+assert.commandWorked(
+ admin.runCommand({setFeatureCompatibilityVersion: latestFCV, maxTimeMS: 1000 * 60 * 60 * 24}),
+ "expected setFeatureCompatibilityVersion to not hit time limit in mongod");
+
// Test that the maxTimeMS is still enforced on the shards even if we do not spend much time in
// mongos blocking.
diff --git a/jstests/sharding/max_time_ms_sharded_new_commands.js b/jstests/sharding/max_time_ms_sharded_new_commands.js
deleted file mode 100644
index 28046963b75..00000000000
--- a/jstests/sharding/max_time_ms_sharded_new_commands.js
+++ /dev/null
@@ -1,41 +0,0 @@
-// Make sure the setFeatureCompatibilityVersion command respects maxTimeMs.
-// @tags: [multiversion_incompatible]
-(function() {
-'use strict';
-
-var st = new ShardingTest({shards: 2});
-
-var mongos = st.s0;
-var shards = [st.shard0, st.shard1];
-var admin = mongos.getDB("admin");
-
-// Helper function to configure "maxTimeAlwaysTimeOut" fail point on shards, which forces mongod
-// to throw if it receives an operation with a max time. See fail point declaration for
-// complete description.
-var configureMaxTimeAlwaysTimeOut = function(mode) {
- assert.commandWorked(shards[0].getDB("admin").runCommand(
- {configureFailPoint: "maxTimeAlwaysTimeOut", mode: mode}));
- assert.commandWorked(shards[1].getDB("admin").runCommand(
- {configureFailPoint: "maxTimeAlwaysTimeOut", mode: mode}));
-};
-
-jsTestLog("Positive test for setFeatureCompatibilityVersion");
-configureMaxTimeAlwaysTimeOut("alwaysOn");
-assert.commandFailedWithCode(
- admin.runCommand({setFeatureCompatibilityVersion: lastLTSFCV, maxTimeMS: 1000 * 60 * 60 * 24}),
- ErrorCodes.MaxTimeMSExpired,
- "expected setFeatureCompatibilityVersion to fail due to maxTimeAlwaysTimeOut fail point");
-
-jsTestLog("Negative test for setFeatureCompatibilityVersion to downgrade");
-configureMaxTimeAlwaysTimeOut("off");
-assert.commandWorked(
- admin.runCommand({setFeatureCompatibilityVersion: lastLTSFCV, maxTimeMS: 1000 * 60 * 60 * 24}),
- "expected setFeatureCompatibilityVersion to not hit time limit in mongod");
-
-jsTestLog("Negative test for setFeatureCompatibilityVersion to upgrade");
-assert.commandWorked(
- admin.runCommand({setFeatureCompatibilityVersion: latestFCV, maxTimeMS: 1000 * 60 * 60 * 24}),
- "expected setFeatureCompatibilityVersion to not hit time limit in mongod");
-
-st.stop();
-})();