diff options
author | Judah Schvimer <judah@mongodb.com> | 2017-01-18 11:53:45 -0500 |
---|---|---|
committer | Judah Schvimer <judah@mongodb.com> | 2017-01-23 10:51:31 -0500 |
commit | f7c338674e5877db373837e957e7109417617988 (patch) | |
tree | 729e86a0d0083c4f164acc93f23ba2a11a7be480 | |
parent | 8ccc63824269d37df9d9105d6076492768b4b5b9 (diff) | |
download | mongo-f7c338674e5877db373837e957e7109417617988.tar.gz |
SERVER-27656 Ensure node 0 is not primary during reconfig in last_vote.js
(cherry picked from commit 2ff3efcabb0a43d5d21b3d636caa76efa4df8bd3)
-rw-r--r-- | jstests/replsets/last_vote.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/jstests/replsets/last_vote.js b/jstests/replsets/last_vote.js index bbb38bd4af3..5aa6da56d20 100644 --- a/jstests/replsets/last_vote.js +++ b/jstests/replsets/last_vote.js @@ -76,6 +76,15 @@ var term = getLatestOp(rst.getPrimary()).t + 100; jsTestLog("Test that last vote is loaded on startup"); + // We cannot reconfig nodes[0] to have priority 0 if it is currently the primary. + if (rst.getPrimary() === rst.nodes[0]) { + jsTestLog("Stepping down node 0 before reconfig"); + assert.throws(function() { + rst.nodes[0].adminCommand({replSetStepDown: 5, force: true}); + }); + rst.waitForState(rst.nodes[0], ReplSetTest.State.SECONDARY); + } + jsTestLog("Reconfiguring cluster to make node 0 unelectable so it stays SECONDARY on restart"); conf = rst.getReplSetConfigFromNode(); conf.version++; |