summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXuerui Fa <xuerui.fa@mongodb.com>2020-04-17 13:28:51 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-05 19:18:40 +0000
commit4b6df5cd12fd22c6bff1c86167ee586c1a2735e1 (patch)
tree2caa79853f874411c69bb753149711c703761599
parent7c735729433bfa51536ccb1371a81d63557e4d22 (diff)
downloadmongo-4b6df5cd12fd22c6bff1c86167ee586c1a2735e1.tar.gz
SERVER-47634: Make metrics test in stepup.js more robust
(cherry picked from commit 321cb6f478bd1969ef4c7a90b210a21272354f41)
-rw-r--r--jstests/replsets/stepup.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/jstests/replsets/stepup.js b/jstests/replsets/stepup.js
index 4c5d20d42c4..aeffcc37e58 100644
--- a/jstests/replsets/stepup.js
+++ b/jstests/replsets/stepup.js
@@ -38,7 +38,9 @@ load('jstests/replsets/libs/election_metrics.js');
// Step up the secondary. Retry since the old primary may step down when we try to ask for its
// vote.
+ let numStepUpCmds = 0;
assert.soonNoExcept(function() {
+ numStepUpCmds++;
return secondary.adminCommand({replSetStepUp: 1}).ok;
});
@@ -50,8 +52,10 @@ load('jstests/replsets/libs/election_metrics.js');
// Check that both the 'called' and 'successful' fields of stepUpCmd have been incremented in
// serverStatus, and that they have not been incremented in any of the other election reason
// counters.
- verifyServerStatusElectionReasonCounterChange(
- initialSecondaryStatus.electionMetrics, newSecondaryStatus.electionMetrics, "stepUpCmd", 1);
+ verifyServerStatusElectionReasonCounterChange(initialSecondaryStatus.electionMetrics,
+ newSecondaryStatus.electionMetrics,
+ "stepUpCmd",
+ numStepUpCmds);
verifyServerStatusElectionReasonCounterChange(initialSecondaryStatus.electionMetrics,
newSecondaryStatus.electionMetrics,
"priorityTakeover",