summaryrefslogtreecommitdiff
path: root/jstests/replsets/priority_takeover_cascading_priorities.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/replsets/priority_takeover_cascading_priorities.js')
-rw-r--r--jstests/replsets/priority_takeover_cascading_priorities.js20
1 files changed, 5 insertions, 15 deletions
diff --git a/jstests/replsets/priority_takeover_cascading_priorities.js b/jstests/replsets/priority_takeover_cascading_priorities.js
index df119abb669..e210d250f10 100644
--- a/jstests/replsets/priority_takeover_cascading_priorities.js
+++ b/jstests/replsets/priority_takeover_cascading_priorities.js
@@ -21,25 +21,15 @@
replSet.startSet();
replSet.initiate();
- var waitForPrimary = function(i) {
- // Refresh connections to nodes.
- replSet.status();
- assert.commandWorked(
- replSet.nodes[i].adminCommand({
- replSetTest: 1,
- waitForMemberState: ReplSetTest.State.PRIMARY,
- timeoutMillis: 60 * 1000,
- }),
- 'node ' + i + ' ' + replSet.nodes[i].host + ' failed to become primary');
- };
-
- waitForPrimary(0);
+ replSet.waitForState(0, ReplSetTest.State.PRIMARY);
+ // Wait until all nodes get the "no-op" of "new primary" after initial sync.
+ waitUntilAllNodesCaughtUp(replSet.nodes);
replSet.stop(0);
- waitForPrimary(1);
+ replSet.waitForState(1, ReplSetTest.State.PRIMARY);
replSet.stop(1);
- waitForPrimary(2);
+ replSet.waitForState(2, ReplSetTest.State.PRIMARY);
// Cannot stop any more nodes because we will not have a majority.
})();