summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Grundy <michael.grundy@10gen.com>2016-01-28 11:42:00 -0500
committerMike Grundy <michael.grundy@10gen.com>2016-02-05 15:22:57 -0500
commitcbb49ce74204c4b6804bf5110cfb02013f0123e2 (patch)
treea62728b3ce980a9c63c9b73c06e388c508155600
parent77191d85a8a42d28cd32ce37365defae23556069 (diff)
downloadmongo-cbb49ce74204c4b6804bf5110cfb02013f0123e2.tar.gz
SERVER-21698 Add error-checking for isMaster() return values in jstests/libs/election_timing_test.js
-rw-r--r--jstests/libs/election_timing_test.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/jstests/libs/election_timing_test.js b/jstests/libs/election_timing_test.js
index 8ff4daf8bbb..518ff2881f1 100644
--- a/jstests/libs/election_timing_test.js
+++ b/jstests/libs/election_timing_test.js
@@ -102,7 +102,10 @@ ElectionTimingTest.prototype._runTimingTest = function() {
secondary = this.rst.getSecondary();
jsTestLog("Starting test: " + this.name + " run: " + run + " cycle: " + cycle);
- var oldElectionId = primary.getDB("admin").isMaster().electionId;
+ var isMasterResult = primary.getDB("admin").isMaster();
+ assert.commandWorked(isMasterResult, "isMaster() failed");
+ var oldElectionId = isMasterResult.electionId;
+ assert.neq(undefined, oldElectionId, "isMaster() failed to return a valid electionId");
// Time the new election.
var stepDownTime = Date.now();
@@ -131,7 +134,11 @@ ElectionTimingTest.prototype._runTimingTest = function() {
// Verify we had an election and we have a new primary.
var newPrimary = this.rst.getPrimary();
- var newElectionId = newPrimary.getDB("admin").isMaster().electionId;
+ isMasterResult = newPrimary.getDB("admin").isMaster();
+ assert.commandWorked(isMasterResult, "isMaster() failed");
+ var newElectionId = isMasterResult.electionId;
+ assert.neq(undefined, newElectionId, "isMaster() failed to return a valid electionId");
+
if (bsonWoCompare(oldElectionId, newElectionId) !== 0) {
this.testErrors.push({testRun: run,
cycle: cycle,