summaryrefslogtreecommitdiff
path: root/jstests/sharding/sharding_options.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/sharding/sharding_options.js')
-rw-r--r--jstests/sharding/sharding_options.js65
1 files changed, 5 insertions, 60 deletions
diff --git a/jstests/sharding/sharding_options.js b/jstests/sharding/sharding_options.js
index fc410e33d0f..d3376c9ce29 100644
--- a/jstests/sharding/sharding_options.js
+++ b/jstests/sharding/sharding_options.js
@@ -1,62 +1,7 @@
var baseName = "jstests_sharding_sharding_options";
-function removeOptionsAddedByFramework(getCmdLineOptsResult) {
- // Remove options that we are not interested in checking, but that get set by the test
- delete getCmdLineOptsResult.parsed.setParameter
- delete getCmdLineOptsResult.parsed.storage
- delete getCmdLineOptsResult.parsed.net
- delete getCmdLineOptsResult.parsed.fastsync
- delete getCmdLineOptsResult.parsed.security
- return getCmdLineOptsResult;
-}
+load('jstests/libs/command_line/test_parsed_options.js');
-function testGetCmdLineOptsMongod(mongoRunnerConfig, expectedResult) {
-
- // Start mongod with options
- var mongod = MongoRunner.runMongod(mongoRunnerConfig);
-
- // Get the parsed options
- var getCmdLineOptsResult = mongod.adminCommand("getCmdLineOpts");
- printjson(getCmdLineOptsResult);
-
- // Remove options added by the test framework
- getCmdLineOptsResult = removeOptionsAddedByFramework(getCmdLineOptsResult);
-
- // Make sure the options are equal to what we expect
- assert.docEq(getCmdLineOptsResult.parsed, expectedResult.parsed);
-
- // Cleanup
- MongoRunner.stopMongod(mongod.port);
-}
-
-function testGetCmdLineOptsMongos(mongoRunnerConfig, expectedResult) {
-
- // Start mongod with options
- var mongod = MongoRunner.runMongod();
-
- // Add configdb option
- mongoRunnerConfig['configdb'] = mongod.host;
-
- // Start mongos connected to mongod
- var mongos = MongoRunner.runMongos(mongoRunnerConfig);
-
- // Get the parsed options
- var getCmdLineOptsResult = mongos.adminCommand("getCmdLineOpts");
- printjson(getCmdLineOptsResult);
-
- // Remove options added by the test framework
- getCmdLineOptsResult = removeOptionsAddedByFramework(getCmdLineOptsResult);
-
- // Remove the configdb option
- delete getCmdLineOptsResult.parsed.sharding.configDB;
-
- // Make sure the options are equal to what we expect
- assert.docEq(getCmdLineOptsResult.parsed, expectedResult.parsed);
-
- // Cleanup
- MongoRunner.stopMongod(mongod.port);
- MongoRunner.stopMongos(mongos.port);
-}
// Move Paranoia
@@ -89,7 +34,8 @@ expectedResult = {
}
}
};
-testGetCmdLineOptsMongod({ config : "jstests/libs/config_files/enable_paranoia.json" }, expectedResult);
+testGetCmdLineOptsMongod({ config : "jstests/libs/config_files/enable_paranoia.json" },
+ expectedResult);
@@ -123,7 +69,8 @@ expectedResult = {
}
}
};
-testGetCmdLineOptsMongod({ config : "jstests/libs/config_files/set_shardingrole.json" }, expectedResult);
+testGetCmdLineOptsMongod({ config : "jstests/libs/config_files/set_shardingrole.json" },
+ expectedResult);
@@ -150,6 +97,4 @@ expectedResult = {
testGetCmdLineOptsMongos({ config : "jstests/libs/config_files/enable_autosplit.json" },
expectedResult);
-
-
print(baseName + " succeeded.");