summaryrefslogtreecommitdiff
path: root/jstests/sharding/max_time_ms_sharded.js
diff options
context:
space:
mode:
authorJason Rassi <rassi@10gen.com>2013-10-31 04:55:54 -0400
committerJason Rassi <rassi@10gen.com>2013-10-31 06:16:32 -0400
commit323abaca6f8168b4ff42d3fe08931e7fed3d0fc1 (patch)
treee3966cc89551a35da538048d0c3afc386dda8a92 /jstests/sharding/max_time_ms_sharded.js
parent195c99e44a1483816b3be2a1f6f42bffed7ec18e (diff)
downloadmongo-323abaca6f8168b4ff42d3fe08931e7fed3d0fc1.tar.gz
SERVER-2212 mongos maxTimeMS support for moveChunk
Diffstat (limited to 'jstests/sharding/max_time_ms_sharded.js')
-rw-r--r--jstests/sharding/max_time_ms_sharded.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/jstests/sharding/max_time_ms_sharded.js b/jstests/sharding/max_time_ms_sharded.js
index a34f0e916ac..2c46f3a341f 100644
--- a/jstests/sharding/max_time_ms_sharded.js
+++ b/jstests/sharding/max_time_ms_sharded.js
@@ -106,4 +106,29 @@ assert.doesNotThrow(function() { cursor.itcount(); },
[],
"did not expect getmore ops to hit the time limit");
+configureMaxTimeNeverTimeOut("off");
+
+//
+// Test that mongos correctly forwards max time to shards for sharded commands. Uses
+// maxTimeAlwaysTimeOut to ensure mongod throws if it receives a max time.
+//
+
+// Positive test for "moveChunk".
+configureMaxTimeAlwaysTimeOut("alwaysOn");
+assert.commandFailed(admin.runCommand({moveChunk: coll.getFullName(),
+ find: {_id: 0},
+ to: "shard0000",
+ maxTimeMS: 1000*60*60*24}),
+ "expected moveChunk to fail in mongod due to maxTimeAlwaysTimeOut fail point");
+
+// Negative test for "moveChunk".
+configureMaxTimeAlwaysTimeOut("off");
+assert.commandWorked(admin.runCommand({moveChunk: coll.getFullName(),
+ find: {_id: 0},
+ to: "shard0000",
+ maxTimeMS: 1000*60*60*24}),
+ "expected moveChunk to not hit time limit in mongod");
+
+// TODO Test additional commmands.
+
st.stop();