diff options
author | William Schultz <william.schultz@mongodb.com> | 2018-01-24 17:32:31 -0500 |
---|---|---|
committer | William Schultz <william.schultz@mongodb.com> | 2018-01-24 17:34:28 -0500 |
commit | 984bc43b2e56d9893d3ff92c6a17ab2e2feadf67 (patch) | |
tree | 42f86fd601ab6ccc3bfe4295573b23561a2878de /jstests/replsets/stepup.js | |
parent | 1ea5ea2748eef0f91b2be2c91b82cb401c0e0788 (diff) | |
download | mongo-984bc43b2e56d9893d3ff92c6a17ab2e2feadf67.tar.gz |
SERVER-32803 stepup.js should retry stepUp command
Diffstat (limited to 'jstests/replsets/stepup.js')
-rw-r--r-- | jstests/replsets/stepup.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/jstests/replsets/stepup.js b/jstests/replsets/stepup.js index ae78921f44b..0e89fc25252 100644 --- a/jstests/replsets/stepup.js +++ b/jstests/replsets/stepup.js @@ -46,9 +46,14 @@ load("jstests/replsets/rslib.js"); // Wait for the secondary to catch up by replicating a doc to both nodes. assert.writeOK(primary.getDB("test").bar.insert({x: 3}, {writeConcern: {w: "majority"}})); - // Step up the secondary and succeed. - res = secondary.adminCommand({replSetStepUp: 1}); - assert.commandWorked(res); + + // Step up the secondary. Retry since the old primary may step down when we try to ask for its + // vote. + assert.soonNoExcept(function() { + return secondary.adminCommand({replSetStepUp: 1}).ok; + }); + + // Make sure the step up succeeded. assert.eq(secondary, rst.getPrimary()); })(); |