summaryrefslogtreecommitdiff
path: root/jstests/replsets
diff options
context:
space:
mode:
authorJudah Schvimer <judah@mongodb.com>2017-04-17 10:02:12 -0400
committerJudah Schvimer <judah@mongodb.com>2017-04-17 10:02:12 -0400
commit148c0031f517117a39e0c260051169b2831d5e64 (patch)
tree5507b2f73cf6c6f4d683ff9470ec0b77dcca087a /jstests/replsets
parent932c2f345598d8e1d283e8c2bb54fd8d0e11c853 (diff)
downloadmongo-148c0031f517117a39e0c260051169b2831d5e64.tar.gz
SERVER-28053 allow network errors when turning off rollbackHangBeforeStart failpoint
Diffstat (limited to 'jstests/replsets')
-rw-r--r--jstests/replsets/double_rollback_early.js4
-rw-r--r--jstests/replsets/read_committed_stale_history.js4
-rw-r--r--jstests/replsets/rollback_too_new.js8
-rw-r--r--jstests/replsets/rollback_with_socket_error_then_steady_state.js4
-rw-r--r--jstests/replsets/stepdown.js10
5 files changed, 8 insertions, 22 deletions
diff --git a/jstests/replsets/double_rollback_early.js b/jstests/replsets/double_rollback_early.js
index 07757270593..11ceb4fefa2 100644
--- a/jstests/replsets/double_rollback_early.js
+++ b/jstests/replsets/double_rollback_early.js
@@ -130,8 +130,8 @@
// It should fail with a rbid error and get stuck.
jsTestLog("Repartition to: [0,3,4] and [1,2].");
nodes[1].reconnect(nodes[2]);
- assert.commandWorked(
- nodes[2].adminCommand({configureFailPoint: 'rollbackHangBeforeStart', mode: 'off'}));
+ assert.adminCommandWorkedAllowingNetworkError(
+ nodes[2], {configureFailPoint: 'rollbackHangBeforeStart', mode: 'off'});
jsTestLog("Wait for node 2 exit ROLLBACK state and go into RECOVERING");
waitForState(nodes[2], ReplSetTest.State.RECOVERING);
diff --git a/jstests/replsets/read_committed_stale_history.js b/jstests/replsets/read_committed_stale_history.js
index 1129e0118d9..424e0d838ce 100644
--- a/jstests/replsets/read_committed_stale_history.js
+++ b/jstests/replsets/read_committed_stale_history.js
@@ -127,8 +127,8 @@
checkDocNotCommitted(nodes[0], {a: 2});
jsTest.log("Allow the original primary to roll back its write and catch up to the new primary");
- assert.commandWorked(
- nodes[0].adminCommand({configureFailPoint: 'rollbackHangBeforeStart', mode: 'off'}));
+ assert.adminCommandWorkedAllowingNetworkError(
+ nodes[0], {configureFailPoint: 'rollbackHangBeforeStart', mode: 'off'});
assert.soonNoExcept(function() {
return null == nodes[0].getDB(dbName).getCollection(collName).findOne({a: 2});
diff --git a/jstests/replsets/rollback_too_new.js b/jstests/replsets/rollback_too_new.js
index 4e216a6028d..131d80a54fe 100644
--- a/jstests/replsets/rollback_too_new.js
+++ b/jstests/replsets/rollback_too_new.js
@@ -43,13 +43,7 @@
// We bump the term to make sure node 0's oplog is ahead of node 2's.
var term = getLatestOp(conns[0]).t;
- try {
- assert.commandWorked(conns[0].adminCommand({replSetStepDown: 1, force: true}));
- } catch (e) {
- if (!isNetworkError(e)) {
- throw e;
- }
- }
+ assert.adminCommandWorkedAllowingNetworkError(conns[0], {replSetStepDown: 1, force: true});
// After stepping down due to the higher term, it will eventually get reelected.
replTest.waitForState(conns[0], ReplSetTest.State.PRIMARY);
diff --git a/jstests/replsets/rollback_with_socket_error_then_steady_state.js b/jstests/replsets/rollback_with_socket_error_then_steady_state.js
index 8dcea725885..33f6fdf2684 100644
--- a/jstests/replsets/rollback_with_socket_error_then_steady_state.js
+++ b/jstests/replsets/rollback_with_socket_error_then_steady_state.js
@@ -106,8 +106,8 @@
nodes[4].reconnect(nodes[2]);
// Turn off failpoint on node 2 to allow rollback against node 1 to fail with a network error.
- assert.commandWorked(
- nodes[2].adminCommand({configureFailPoint: 'rollbackHangBeforeStart', mode: 'off'}));
+ assert.adminCommandWorkedAllowingNetworkError(
+ nodes[2], {configureFailPoint: 'rollbackHangBeforeStart', mode: 'off'});
// Make node 0 ahead of node 2 again so node 2 will pick it as a sync source.
diff --git a/jstests/replsets/stepdown.js b/jstests/replsets/stepdown.js
index 6213e47bede..5f222025f18 100644
--- a/jstests/replsets/stepdown.js
+++ b/jstests/replsets/stepdown.js
@@ -107,15 +107,7 @@ master = replTest.getPrimary();
var firstMaster = master;
print("\nmaster is now " + firstMaster);
-try {
- assert.commandWorked(master.getDB("admin").runCommand({replSetStepDown: 100, force: true}));
-} catch (e) {
- // ignore errors due to connection failures as we expect the master to close connections
- // on stepdown
- if (!isNetworkError(e)) {
- throw e;
- }
-}
+assert.adminCommandWorkedAllowingNetworkError(master, {replSetStepDown: 100, force: true});
print("\nget a master");
replTest.getPrimary();