diff options
author | Pavi Vetriselvan <pvselvan@umich.edu> | 2020-05-06 11:25:31 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-05-26 18:09:44 +0000 |
commit | 545ea895bfd90ea274a2b8da34c4534d6dc9c0af (patch) | |
tree | c85b7f56ec812fdb2d60486b67f57e1c3acc6dd3 | |
parent | ba7d21608131d8236f2c2b66a93c9d6311f8506c (diff) | |
download | mongo-545ea895bfd90ea274a2b8da34c4534d6dc9c0af.tar.gz |
SERVER-47798 ismaster.js tests should ensure ismaster field is a boolean
(cherry picked from commit d5d0401e518beab5b659c1a01a092286f8a9c792)
(cherry picked from commit 9c1ce38d7c87f625be1c2d5d7f5a6b709ebfb72e)
-rw-r--r-- | jstests/core/ismaster.js | 5 | ||||
-rw-r--r-- | jstests/sharding/ismaster.js | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/jstests/core/ismaster.js b/jstests/core/ismaster.js index 54006814b68..a29be88331c 100644 --- a/jstests/core/ismaster.js +++ b/jstests/core/ismaster.js @@ -1,3 +1,4 @@ +"use strict"; var res = db.isMaster(); // check that the fields that should be there are there and have proper values assert(res.maxBsonObjectSize && isNumber(res.maxBsonObjectSize) && res.maxBsonObjectSize > 0, @@ -6,7 +7,8 @@ assert(res.maxMessageSizeBytes && isNumber(res.maxMessageSizeBytes) && res.maxBs "maxMessageSizeBytes possibly missing:" + tojson(res)); assert(res.maxWriteBatchSize && isNumber(res.maxWriteBatchSize) && res.maxWriteBatchSize > 0, "maxWriteBatchSize possibly missing:" + tojson(res)); -assert(res.ismaster, "ismaster missing or false:" + tojson(res)); +assert.eq("boolean", typeof res.ismaster, "ismaster field is not a boolean" + tojson(res)); +assert(res.ismaster === true, "ismaster field is false" + tojson(res)); assert(res.localTime, "localTime possibly missing:" + tojson(res)); assert(res.connectionId, "connectionId missing or false" + tojson(res)); @@ -28,6 +30,7 @@ if (!testingReplication) { "buildIndexes", "me" ]; + var field; // check that the fields that shouldn't be there are not there for (field in res) { if (!res.hasOwnProperty(field)) { diff --git a/jstests/sharding/ismaster.js b/jstests/sharding/ismaster.js index 47dff297e96..2d5cea7b586 100644 --- a/jstests/sharding/ismaster.js +++ b/jstests/sharding/ismaster.js @@ -1,3 +1,4 @@ +"use strict"; var st = new ShardingTest({shards: 1, mongos: 1}); var res = st.s0.getDB("admin").runCommand("ismaster"); // check that the fields that should be there are there and have proper values @@ -5,7 +6,8 @@ assert(res.maxBsonObjectSize && isNumber(res.maxBsonObjectSize) && res.maxBsonOb "maxBsonObjectSize possibly missing:" + tojson(res)); assert(res.maxMessageSizeBytes && isNumber(res.maxMessageSizeBytes) && res.maxBsonObjectSize > 0, "maxMessageSizeBytes possibly missing:" + tojson(res)); -assert(res.ismaster, "ismaster missing or false:" + tojson(res)); +assert.eq("boolean", typeof res.ismaster, "ismaster field is not a boolean" + tojson(res)); +assert(res.ismaster === true, "ismaster field is false" + tojson(res)); assert(res.localTime, "localTime possibly missing:" + tojson(res)); assert(res.msg && res.msg == "isdbgrid", "msg possibly missing or wrong:" + tojson(res)); var unwantedFields = [ @@ -26,6 +28,7 @@ var unwantedFields = [ ]; // check that the fields that shouldn't be there are not there var badFields = []; +var field; for (field in res) { if (!res.hasOwnProperty(field)) { continue; |