summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-11-08 12:06:12 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-11-11 14:21:42 -0500
commit07562c2fb080a3856fe06a2ff412d06060a6abb7 (patch)
tree9b9fd9c65973abdec2e331f25c0b229bc0a96a69 /jstests
parentcbb4e60d3e2756f5861372121228a6fe82a3cedb (diff)
downloadmongo-07562c2fb080a3856fe06a2ff412d06060a6abb7.tar.gz
SERVER-26955 Ensure setFeatureCompatibilityVersion commands support maxTimeMS
Diffstat (limited to 'jstests')
-rw-r--r--jstests/sharding/max_time_ms_sharded.js8
-rw-r--r--jstests/sharding/max_time_ms_sharded_new_commands.js40
2 files changed, 42 insertions, 6 deletions
diff --git a/jstests/sharding/max_time_ms_sharded.js b/jstests/sharding/max_time_ms_sharded.js
index b551826ddfe..33121e61712 100644
--- a/jstests/sharding/max_time_ms_sharded.js
+++ b/jstests/sharding/max_time_ms_sharded.js
@@ -17,8 +17,7 @@
var res;
// 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
+ // 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(
@@ -28,8 +27,7 @@
};
// Helper function to configure "maxTimeAlwaysTimeOut" fail point on shards, which prohibits
- // mongod
- // from enforcing time limits. See fail point declaration for complete description.
+ // mongod from enforcing time limits. See fail point declaration for complete description.
var configureMaxTimeNeverTimeOut = function(mode) {
assert.commandWorked(shards[0].getDB("admin").runCommand(
{configureFailPoint: "maxTimeNeverTimeOut", mode: mode}));
@@ -221,8 +219,6 @@
}),
"expected moveChunk to not hit time limit in mongod");
- // TODO Test additional commmands.
-
st.stop();
})();
diff --git a/jstests/sharding/max_time_ms_sharded_new_commands.js b/jstests/sharding/max_time_ms_sharded_new_commands.js
new file mode 100644
index 00000000000..373b4c5591d
--- /dev/null
+++ b/jstests/sharding/max_time_ms_sharded_new_commands.js
@@ -0,0 +1,40 @@
+// Continuation of max_time_ms.js, but only contains commands which are not present in a previous
+// version
+(function() {
+ 'use strict';
+
+ var st = new ShardingTest({shards: 2});
+
+ var mongos = st.s0;
+ var shards = [st.shard0, st.shard1];
+ var coll = mongos.getCollection("foo.bar");
+ var admin = mongos.getDB("admin");
+ var cursor;
+ var res;
+
+ // 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}));
+ };
+
+ // Positive test for "setFeatureCompatibilityVersion"
+ configureMaxTimeAlwaysTimeOut("alwaysOn");
+ assert.commandFailedWithCode(
+ admin.runCommand({setFeatureCompatibilityVersion: '3.2', maxTimeMS: 1000 * 60 * 60 * 24}),
+ ErrorCodes.ExceededTimeLimit,
+ "expected setFeatureCompatibilityVersion to fail due to maxTimeAlwaysTimeOut fail point");
+
+ // Negative test for "setFeatureCompatibilityVersion"
+ configureMaxTimeAlwaysTimeOut("off");
+ assert.commandWorked(
+ admin.runCommand({setFeatureCompatibilityVersion: '3.2', maxTimeMS: 1000 * 60 * 60 * 24}),
+ "expected setFeatureCompatibilityVersion to not hit time limit in mongod");
+
+ st.stop();
+
+})();