diff options
author | Xuerui Fa <xuerui.fa@mongodb.com> | 2020-04-17 13:28:51 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-04-17 22:36:53 +0000 |
commit | 321cb6f478bd1969ef4c7a90b210a21272354f41 (patch) | |
tree | fdae80f7df7e7377d200592fef6ee9d8f5c48542 /jstests/replsets/stepup.js | |
parent | 523b9c9f92db20062ad6e3f42ceb80292e1a23f3 (diff) | |
download | mongo-321cb6f478bd1969ef4c7a90b210a21272354f41.tar.gz |
SERVER-47634: Make metrics test in stepup.js more robust
Diffstat (limited to 'jstests/replsets/stepup.js')
-rw-r--r-- | jstests/replsets/stepup.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/jstests/replsets/stepup.js b/jstests/replsets/stepup.js index 8c5b83ab586..c7062a6b4f0 100644 --- a/jstests/replsets/stepup.js +++ b/jstests/replsets/stepup.js @@ -38,7 +38,9 @@ assert.commandWorked(primary.getDB("test").bar.insert({x: 3}, {writeConcern: {w: // 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 @@ const newSecondaryStatus = assert.commandWorked(secondary.adminCommand({serverSt // 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", |