diff options
Diffstat (limited to 'jstests/replsets/priority_takeover_one_node_higher_priority.js')
-rw-r--r-- | jstests/replsets/priority_takeover_one_node_higher_priority.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/jstests/replsets/priority_takeover_one_node_higher_priority.js b/jstests/replsets/priority_takeover_one_node_higher_priority.js index 1d9aafb08e7..3059ea2cd00 100644 --- a/jstests/replsets/priority_takeover_one_node_higher_priority.js +++ b/jstests/replsets/priority_takeover_one_node_higher_priority.js @@ -27,19 +27,19 @@ // Primary should step down long enough for election to occur on secondary. var config = assert.commandWorked(primary.adminCommand({replSetGetConfig: 1})).config; - var electionTimeoutMillis = config.settings.electionTimeoutMillis; - var stepDownGuardMillis = electionTimeoutMillis * 2; var stepDownException = assert.throws(function() { - var result = primary.adminCommand({replSetStepDown: stepDownGuardMillis / 1000}); + var result = primary.adminCommand({replSetStepDown: replSet.kDefaultTimeoutMS / 1000}); print('replSetStepDown did not throw exception but returned: ' + tojson(result)); }); assert(isNetworkError(stepDownException), 'replSetStepDown did not disconnect client; failed with ' + tojson(stepDownException)); // Step down primary and wait for node 1 to be promoted to primary. - replSet.waitForState(replSet.nodes[1], ReplSetTest.State.PRIMARY, 60 * 1000); + replSet.waitForState(replSet.nodes[1], ReplSetTest.State.PRIMARY); + + // Unfreeze node 0 so it can seek election. + assert.commandWorked(primary.adminCommand({replSetFreeze: 0})); // Eventually node 0 will stand for election again because it has a higher priorty. - replSet.waitForState( - replSet.nodes[0], ReplSetTest.State.PRIMARY, stepDownGuardMillis + 60 * 1000); + replSet.waitForState(replSet.nodes[0], ReplSetTest.State.PRIMARY); })(); |