summaryrefslogtreecommitdiff
path: root/jstests/replsets/stepdown_catch_up_opt.js
diff options
context:
space:
mode:
authorJonathan Abrahams <jonathan@mongodb.com>2016-03-09 12:17:50 -0500
committerJonathan Abrahams <jonathan@mongodb.com>2016-03-09 12:18:14 -0500
commit4ae691e8edc87d0e3cfb633bb91c328426be007b (patch)
tree52079a593f54382ca13a2e741633eab1b6271893 /jstests/replsets/stepdown_catch_up_opt.js
parenta025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff)
downloadmongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/replsets/stepdown_catch_up_opt.js')
-rw-r--r--jstests/replsets/stepdown_catch_up_opt.js40
1 files changed, 15 insertions, 25 deletions
diff --git a/jstests/replsets/stepdown_catch_up_opt.js b/jstests/replsets/stepdown_catch_up_opt.js
index a5ccb456762..304927a7838 100644
--- a/jstests/replsets/stepdown_catch_up_opt.js
+++ b/jstests/replsets/stepdown_catch_up_opt.js
@@ -26,41 +26,32 @@
var stringNotIntCode = 14;
// Expect a failure with a string argument.
- assert.commandFailedWithCode(
- primary.getDB('admin').runCommand({replSetStepDown: 10, secondaryCatchUpPeriodSecs: 'STR'}),
- stringNotIntCode,
- 'Expected string argument to secondaryCatchupPeriodSecs to fail.'
- );
+ assert.commandFailedWithCode(primary.getDB('admin').runCommand(
+ {replSetStepDown: 10, secondaryCatchUpPeriodSecs: 'STR'}),
+ stringNotIntCode,
+ 'Expected string argument to secondaryCatchupPeriodSecs to fail.');
// Expect a failure with a longer secondaryCatchupPeriodSecs than the stepdown period.
assert.commandFailedWithCode(
primary.getDB('admin').runCommand({replSetStepDown: 10, secondaryCatchUpPeriodSecs: 20}),
stepDownPeriodTooShortCode,
('Expected replSetStepDown to fail given a stepdown time shorter than' +
- ' secondaryCatchUpPeriodSecs')
- );
+ ' secondaryCatchUpPeriodSecs'));
jsTestLog('Stop secondary syncing.');
- assert.commandWorked(
- secondary.getDB('admin').runCommand(
- {configureFailPoint: 'rsSyncApplyStop', mode: 'alwaysOn'}
- ),
- 'Failed to configure rsSyncApplyStop failpoint.'
- );
+ assert.commandWorked(secondary.getDB('admin').runCommand(
+ {configureFailPoint: 'rsSyncApplyStop', mode: 'alwaysOn'}),
+ 'Failed to configure rsSyncApplyStop failpoint.');
function disableFailPoint() {
- assert.commandWorked(
- secondary.getDB('admin').runCommand(
- {configureFailPoint: 'rsSyncApplyStop', mode: 'off'}
- ),
- 'Failed to disable rsSyncApplyStop failpoint.'
- );
+ assert.commandWorked(secondary.getDB('admin')
+ .runCommand({configureFailPoint: 'rsSyncApplyStop', mode: 'off'}),
+ 'Failed to disable rsSyncApplyStop failpoint.');
}
// If any of these assertions fail, we need to disable the fail point in order for the mongod to
// shut down.
try {
-
jsTestLog('Write to primary to make secondary out of sync.');
assert.writeOK(primary.getDB('test').foo.insert({i: 1}), 'Failed to insert document.');
sleep(1000);
@@ -69,10 +60,10 @@
jsTestLog('Try to step down.');
var startTime = new Date();
assert.commandFailedWithCode(
- primary.getDB('admin').runCommand({replSetStepDown: 10, secondaryCatchUpPeriodSecs: 1}),
+ primary.getDB('admin')
+ .runCommand({replSetStepDown: 10, secondaryCatchUpPeriodSecs: 1}),
noCaughtUpSecondariesCode,
- 'Expected replSetStepDown to fail, since no secondaries should be caught up.'
- );
+ 'Expected replSetStepDown to fail, since no secondaries should be caught up.');
var endTime = new Date();
// Ensure it took at least 1 second to time out. Adjust the timeout a little bit
@@ -80,8 +71,7 @@
assert.lte(0.95,
(endTime - startTime) / 1000,
'Expected replSetStepDown command to fail after 1 second.');
- }
- catch (err) {
+ } catch (err) {
disableFailPoint();
throw err;
}