summaryrefslogtreecommitdiff
path: root/jstests/replsets/election_handoff_basic.js
diff options
context:
space:
mode:
authorVesselina Ratcheva <vesselina.ratcheva@10gen.com>2018-06-25 14:38:41 -0400
committerVesselina Ratcheva <vesselina.ratcheva@10gen.com>2018-07-12 15:52:05 -0400
commit069e6f06b4e0faef45661ac043c7a4ebcf026d96 (patch)
treee1e6b7a404227320360d7ded76d11e0f2bd52141 /jstests/replsets/election_handoff_basic.js
parent2e975546f4676e1ba65e3376c08bd43bee14305f (diff)
downloadmongo-069e6f06b4e0faef45661ac043c7a4ebcf026d96.tar.gz
SERVER-35623 Send a replSetStepUp command to an eligible candidate on stepdown
Diffstat (limited to 'jstests/replsets/election_handoff_basic.js')
-rw-r--r--jstests/replsets/election_handoff_basic.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/jstests/replsets/election_handoff_basic.js b/jstests/replsets/election_handoff_basic.js
new file mode 100644
index 00000000000..c11a60612a2
--- /dev/null
+++ b/jstests/replsets/election_handoff_basic.js
@@ -0,0 +1,26 @@
+/**
+ * This is a basic test that checks that, with election handoff is enabled, a primary that steps
+ * down sends a ReplSetStepUp request to an eligible candidate. It uses a two-node replica set,
+ * so there is only one secondary that can take over.
+ */
+
+(function() {
+ "use strict";
+ load("jstests/replsets/libs/election_handoff.js");
+
+ const testName = "election_handoff_vanilla";
+ const numNodes = 2;
+ const rst = ReplSetTest({name: testName, nodes: numNodes});
+ const nodes = rst.nodeList();
+ rst.startSet();
+
+ // Make sure there are no election timeouts firing for the duration of the test. This helps
+ // ensure that the test will only pass if the election handoff succeeds.
+ const config = rst.getReplSetConfig();
+ config.settings = {"electionTimeoutMillis": 12 * 60 * 60 * 1000};
+ rst.initiate(config);
+
+ ElectionHandoffTest.testElectionHandoff(rst, 0, 1);
+
+ rst.stopSet();
+})(); \ No newline at end of file