summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis Osta <luis.osta@mongodb.com>2020-06-23 17:13:47 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-06-23 17:25:54 +0000
commit5958a1302055a6e500ec530fc166c0b7ba4b58bd (patch)
tree9d3738fd319b45f2a2c364e656045204f5fadafa
parentdd51b67d1308ecc52fdf6b91bebfe3a25c30deb0 (diff)
downloadmongo-5958a1302055a6e500ec530fc166c0b7ba4b58bd.tar.gz
SERVER-46856 Sharding jstests should not use assert.throws and assert.doesNotThrow to check if a parallel shell exited with an error
-rw-r--r--jstests/sharding/migration_ignore_interrupts_1.js13
-rw-r--r--jstests/sharding/migration_ignore_interrupts_2.js13
-rw-r--r--jstests/sharding/move_chunk_remove_shard.js13
3 files changed, 24 insertions, 15 deletions
diff --git a/jstests/sharding/migration_ignore_interrupts_1.js b/jstests/sharding/migration_ignore_interrupts_1.js
index d093f0a8f0b..754e4d8d0ab 100644
--- a/jstests/sharding/migration_ignore_interrupts_1.js
+++ b/jstests/sharding/migration_ignore_interrupts_1.js
@@ -44,8 +44,13 @@ jsTest.log("Set up complete, now proceeding to test that migration interruptions
// Start a migration between shard0 and shard1 on coll1 and then pause it
pauseMigrateAtStep(shard1, migrateStepNames.deletedPriorDataInRange);
-var joinMoveChunk = moveChunkParallel(
- staticMongod, st.s0.host, {a: 0}, null, coll1.getFullName(), st.shard1.shardName);
+var joinMoveChunk = moveChunkParallel(staticMongod,
+ st.s0.host,
+ {a: 0},
+ null,
+ coll1.getFullName(),
+ st.shard1.shardName,
+ true /**Parallel should expect success */);
waitForMigrateStep(shard1, migrateStepNames.deletedPriorDataInRange);
assert.commandFailedWithCode(
@@ -65,9 +70,7 @@ assert.commandFailedWithCode(
// Finish migration
unpauseMigrateAtStep(shard1, migrateStepNames.deletedPriorDataInRange);
-assert.doesNotThrow(function() {
- joinMoveChunk();
-});
+joinMoveChunk();
assert.eq(1, shard0Coll1.find().itcount());
assert.eq(1, shard1Coll1.find().itcount());
assert.eq(1, shard2Coll1.find().itcount());
diff --git a/jstests/sharding/migration_ignore_interrupts_2.js b/jstests/sharding/migration_ignore_interrupts_2.js
index f5147659c96..fa496d84318 100644
--- a/jstests/sharding/migration_ignore_interrupts_2.js
+++ b/jstests/sharding/migration_ignore_interrupts_2.js
@@ -30,8 +30,13 @@ jsTest.log("Set up complete, now proceeding to test that migration interruption
// Start a migration between shard0 and shard1 on coll1, pause in steady state before commit.
pauseMoveChunkAtStep(shard0, moveChunkStepNames.reachedSteadyState);
-var joinMoveChunk = moveChunkParallel(
- staticMongod, st.s0.host, {a: 0}, null, coll1.getFullName(), st.shard1.shardName);
+var joinMoveChunk = moveChunkParallel(staticMongod,
+ st.s0.host,
+ {a: 0},
+ null,
+ coll1.getFullName(),
+ st.shard1.shardName,
+ true /**Parallel should expect success */);
waitForMoveChunkStep(shard0, moveChunkStepNames.reachedSteadyState);
jsTest.log('Sending false commit command....');
@@ -45,9 +50,7 @@ assert.eq(true, res.state === "steady", "False commit command succeeded.");
// Finish migration.
unpauseMoveChunkAtStep(shard0, moveChunkStepNames.reachedSteadyState);
-assert.doesNotThrow(function() {
- joinMoveChunk();
-});
+joinMoveChunk();
assert.eq(0, shard0Coll1.find().itcount());
assert.eq(1, shard1Coll1.find().itcount());
diff --git a/jstests/sharding/move_chunk_remove_shard.js b/jstests/sharding/move_chunk_remove_shard.js
index 774de6c225f..e53fb5ab96c 100644
--- a/jstests/sharding/move_chunk_remove_shard.js
+++ b/jstests/sharding/move_chunk_remove_shard.js
@@ -26,8 +26,13 @@ st._configServers.forEach((conn) => {
});
});
-let joinMoveChunk =
- moveChunkParallel(staticMongod, st.s.host, {x: 0}, null, 'test.user', st.shard1.shardName);
+let joinMoveChunk = moveChunkParallel(staticMongod,
+ st.s.host,
+ {x: 0},
+ null,
+ 'test.user',
+ st.shard1.shardName,
+ false /**parallel should expect failure */);
waitForMoveChunkStep(st.shard0, moveChunkStepNames.reachedSteadyState);
@@ -39,9 +44,7 @@ assert.soon(function() {
unpauseMoveChunkAtStep(st.shard0, moveChunkStepNames.reachedSteadyState);
// moveChunk will fail because the destination shard no longer exists.
-assert.throws(function() {
- joinMoveChunk();
-});
+joinMoveChunk();
// All shard0 should now own all chunks
st.s.getDB('config').chunks.find().forEach(function(chunk) {