summaryrefslogtreecommitdiff
path: root/jstests/libs/chunk_manipulation_util.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/libs/chunk_manipulation_util.js')
-rw-r--r--jstests/libs/chunk_manipulation_util.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/jstests/libs/chunk_manipulation_util.js b/jstests/libs/chunk_manipulation_util.js
index 00ec3687b45..7509deba755 100644
--- a/jstests/libs/chunk_manipulation_util.js
+++ b/jstests/libs/chunk_manipulation_util.js
@@ -19,11 +19,12 @@ load('./jstests/libs/test_background_ops.js');
// Returns a join function; call it to wait for moveChunk to complete.
//
-function moveChunkParallel(staticMongod, mongosURL, findCriteria, bounds, ns, toShardId) {
+function moveChunkParallel(
+ staticMongod, mongosURL, findCriteria, bounds, ns, toShardId, expectSuccess = true) {
assert((findCriteria || bounds) && !(findCriteria && bounds),
'Specify either findCriteria or bounds, but not both.');
- function runMoveChunk(mongosURL, findCriteria, bounds, ns, toShardId) {
+ function runMoveChunk(mongosURL, findCriteria, bounds, ns, toShardId, expectSuccess) {
assert(mongosURL && ns && toShardId, 'Missing arguments.');
assert((findCriteria || bounds) && !(findCriteria && bounds),
'Specify either findCriteria or bounds, but not both.');
@@ -42,12 +43,17 @@ function moveChunkParallel(staticMongod, mongosURL, findCriteria, bounds, ns, to
printjson(cmd);
var result = admin.runCommand(cmd);
printjson(result);
- assert(result.ok);
+ if (expectSuccess) {
+ assert(result.ok);
+ } else {
+ assert.commandFailed(result);
+ }
}
// Return the join function.
- return startParallelOps(
- staticMongod, runMoveChunk, [mongosURL, findCriteria, bounds, ns, toShardId]);
+ return startParallelOps(staticMongod,
+ runMoveChunk,
+ [mongosURL, findCriteria, bounds, ns, toShardId, expectSuccess]);
}
// moveChunk starts at step 0 and proceeds to 1 (it has *finished* parsing