diff options
Diffstat (limited to 'jstests/replsets/unconditional_step_down.js')
-rw-r--r-- | jstests/replsets/unconditional_step_down.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/jstests/replsets/unconditional_step_down.js b/jstests/replsets/unconditional_step_down.js index c9f95bcb1ac..4d5e37821db 100644 --- a/jstests/replsets/unconditional_step_down.js +++ b/jstests/replsets/unconditional_step_down.js @@ -106,6 +106,10 @@ function runStepDownTest({testMsg, stepDownFn, toRemovedState}) { jsTestLog("Wait for write cmd to reach the fail point"); waitForCurOpByFailPoint(primaryDB, collNss, writeFailPoint); + let res = assert.commandWorked(primary.adminCommand({replSetGetStatus: 1})); + assert(res.electionCandidateMetrics, + () => "Response should have an 'electionCandidateMetrics' field: " + tojson(res)); + jsTestLog("Trigger step down"); var oldConfig = stepDownFn(); @@ -119,6 +123,16 @@ function runStepDownTest({testMsg, stepDownFn, toRemovedState}) { (toRemovedState) ? ReplSetTest.State.REMOVED : ReplSetTest.State.SECONDARY); assert.commandWorked(primary.adminCommand({configureFailPoint: writeFailPoint, mode: "off"})); + + // Check that the 'electionCandidateMetrics' section of the replSetGetStatus response has been + // cleared, since the node is no longer primary. + if (!toRemovedState) { + res = assert.commandWorked(primary.adminCommand({replSetGetStatus: 1})); + assert( + !res.electionCandidateMetrics, + () => "Response should not have an 'electionCandidateMetrics' field: " + tojson(res)); + } + // Get the new primary. refreshConnection(); } |