diff options
Diffstat (limited to 'jstests/libs/command_line/test_parsed_options.js')
-rw-r--r-- | jstests/libs/command_line/test_parsed_options.js | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/jstests/libs/command_line/test_parsed_options.js b/jstests/libs/command_line/test_parsed_options.js index 1f3a626ee02..c38d07668af 100644 --- a/jstests/libs/command_line/test_parsed_options.js +++ b/jstests/libs/command_line/test_parsed_options.js @@ -4,26 +4,22 @@ function mergeOptions(obj1, obj2) { var obj3 = {}; for (var attrname in obj1) { - if (typeof obj1[attrname] === "object" && - typeof obj2[attrname] !== "undefined") { + if (typeof obj1[attrname] === "object" && typeof obj2[attrname] !== "undefined") { if (typeof obj2[attrname] !== "object") { throw Error("Objects being merged must have the same structure"); } obj3[attrname] = mergeOptions(obj1[attrname], obj2[attrname]); - } - else { + } else { obj3[attrname] = obj1[attrname]; } } for (var attrname in obj2) { - if (typeof obj2[attrname] === "object" && - typeof obj1[attrname] !== "undefined") { + if (typeof obj2[attrname] === "object" && typeof obj1[attrname] !== "undefined") { if (typeof obj1[attrname] !== "object") { throw Error("Objects being merged must have the same structure"); } // Already handled above - } - else { + } else { obj3[attrname] = obj2[attrname]; } } @@ -45,12 +41,10 @@ function mergeOptions(obj1, obj2) { // var getCmdLineOptsBaseMongod; function testGetCmdLineOptsMongod(mongoRunnerConfig, expectedResult) { - // Get the options object returned by "getCmdLineOpts" when we spawn a mongod using our test // framework without passing any additional options. We need this because the framework adds // options of its own, and we only want to compare against the options we care about. function getBaseOptsObject() { - // Start mongod with no options var baseMongod = MongoRunner.runMongod(); @@ -96,8 +90,7 @@ function testGetCmdLineOptsMongod(mongoRunnerConfig, expectedResult) { try { mongod.getDB("admin").createUser({user: "root", pwd: "pass", roles: ["root"]}); mongod.getDB("admin").auth("root", "pass"); - } - catch (ex) { + } catch (ex) { } // Get the parsed options @@ -146,16 +139,11 @@ function testGetCmdLineOptsMongos(mongoRunnerConfig, expectedResult) { // options of its own, and we only want to compare against the options we care about. function getCmdLineOptsFromMongos(mongosOptions) { // Start mongod with no options - var baseMongod = MongoRunner.runMongod({ - configsvr: "", - journal: "", - replSet: "csrs", - storageEngine: "wiredTiger" - }); - assert.commandWorked(baseMongod.adminCommand( { - replSetInitiate: { - _id: "csrs", configsvr: true, members: [{_id: 0, host: baseMongod.host}] - } + var baseMongod = MongoRunner.runMongod( + {configsvr: "", journal: "", replSet: "csrs", storageEngine: "wiredTiger"}); + assert.commandWorked(baseMongod.adminCommand({ + replSetInitiate: + {_id: "csrs", configsvr: true, members: [{_id: 0, host: baseMongod.host}]} })); var configdbStr = "csrs/" + baseMongod.host; var ismasterResult; @@ -164,7 +152,7 @@ function testGetCmdLineOptsMongos(mongoRunnerConfig, expectedResult) { ismasterResult = baseMongod.adminCommand("ismaster"); return ismasterResult.ismaster; }, - function () { + function() { return tojson(ismasterResult); }); |