diff options
author | Medha Potluri <medha.potluri@mongodb.com> | 2019-06-21 10:59:02 -0400 |
---|---|---|
committer | Medha Potluri <medha.potluri@mongodb.com> | 2019-07-08 11:15:28 -0400 |
commit | bf4f91a6087227295007535bf143a8dd20e6a6d5 (patch) | |
tree | caf30263bb98d8281968b96f60d9f95f56fd5f45 /jstests/replsets/replset1.js | |
parent | 75dc5684d4c6be0e8ac7c653f5389df9f45f1baf (diff) | |
download | mongo-bf4f91a6087227295007535bf143a8dd20e6a6d5.tar.gz |
SERVER-414500 Track number of successful elections for each reason in serverStatus
Diffstat (limited to 'jstests/replsets/replset1.js')
-rw-r--r-- | jstests/replsets/replset1.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/jstests/replsets/replset1.js b/jstests/replsets/replset1.js index 6ba1edf2b71..a0754764db0 100644 --- a/jstests/replsets/replset1.js +++ b/jstests/replsets/replset1.js @@ -2,6 +2,7 @@ var ssl_options1; var ssl_options2; var ssl_name; load("jstests/replsets/rslib.js"); +load('jstests/replsets/libs/election_metrics.js'); var doTest = function(signal) { // Test basic replica set functionality. @@ -29,6 +30,12 @@ var doTest = function(signal) { // elected master. var master = replTest.getPrimary(); + // Check that both the 'called' and 'successful' fields of the 'electionTimeout' election reason + // counter have been incremented in serverStatus. + const primaryStatus = assert.commandWorked(master.adminCommand({serverStatus: 1})); + verifyServerStatusElectionReasonCounterValue( + primaryStatus.electionMetrics, "electionTimeout", 1); + // Ensure the primary logs an n-op to the oplog upon transitioning to primary. assert.gt(master.getDB("local").oplog.rs.count({op: 'n', o: {msg: 'new primary'}}), 0); |