summaryrefslogtreecommitdiff
path: root/jstests/dur
diff options
context:
space:
mode:
authorShaun Verch <shaun.verch@mongodb.com>2014-03-27 11:24:43 -0400
committerShaun Verch <shaun.verch@mongodb.com>2014-03-27 19:36:36 -0400
commit17882d68d1ee00e75e545abe65bda1b18876ef21 (patch)
tree012ead982260d8e95207af71c68a6de060739b47 /jstests/dur
parent04eda9bb1b5a348201f0b81d56af950c1c538a09 (diff)
downloadmongo-17882d68d1ee00e75e545abe65bda1b18876ef21.tar.gz
SERVER-13372 Canonicalize dur, nodur, journal, nojournal and storage.journaling.enabled
Diffstat (limited to 'jstests/dur')
-rw-r--r--jstests/dur/journaling_options.js117
1 files changed, 117 insertions, 0 deletions
diff --git a/jstests/dur/journaling_options.js b/jstests/dur/journaling_options.js
new file mode 100644
index 00000000000..1c62c2167b0
--- /dev/null
+++ b/jstests/dur/journaling_options.js
@@ -0,0 +1,117 @@
+var baseName = "jstests_dur_journaling_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.dbPath
+ delete getCmdLineOptsResult.parsed.net
+ delete getCmdLineOptsResult.parsed.fastsync
+ return getCmdLineOptsResult;
+}
+
+jsTest.log("Testing \"dur\" command line option");
+var mongodSource = MongoRunner.runMongod({ dur : "" });
+var getCmdLineOptsExpected = {
+ "parsed" : {
+ "storage" : {
+ "journal" : {
+ "enabled" : true
+ }
+ }
+ }
+};
+
+var getCmdLineOptsResult = mongodSource.adminCommand("getCmdLineOpts");
+printjson(getCmdLineOptsResult);
+getCmdLineOptsResult = removeOptionsAddedByFramework(getCmdLineOptsResult);
+assert.docEq(getCmdLineOptsResult.parsed, getCmdLineOptsExpected.parsed);
+MongoRunner.stopMongod(mongodSource.port);
+
+jsTest.log("Testing \"nodur\" command line option");
+mongodSource = MongoRunner.runMongod({ nodur : "" });
+getCmdLineOptsExpected = {
+ "parsed" : {
+ "storage" : {
+ "journal" : {
+ "enabled" : false
+ }
+ }
+ }
+};
+
+getCmdLineOptsResult = mongodSource.adminCommand("getCmdLineOpts");
+printjson(getCmdLineOptsResult);
+getCmdLineOptsResult = removeOptionsAddedByFramework(getCmdLineOptsResult);
+assert.docEq(getCmdLineOptsResult.parsed, getCmdLineOptsExpected.parsed);
+MongoRunner.stopMongod(mongodSource.port);
+
+jsTest.log("Testing \"journal\" command line option");
+mongodSource = MongoRunner.runMongod({ journal : "" });
+getCmdLineOptsExpected = {
+ "parsed" : {
+ "storage" : {
+ "journal" : {
+ "enabled" : true
+ }
+ }
+ }
+};
+
+getCmdLineOptsResult = mongodSource.adminCommand("getCmdLineOpts");
+printjson(getCmdLineOptsResult);
+getCmdLineOptsResult = removeOptionsAddedByFramework(getCmdLineOptsResult);
+assert.docEq(getCmdLineOptsResult.parsed, getCmdLineOptsExpected.parsed);
+MongoRunner.stopMongod(mongodSource.port);
+
+jsTest.log("Testing \"nojournal\" command line option");
+mongodSource = MongoRunner.runMongod({ nojournal : "" });
+getCmdLineOptsExpected = {
+ "parsed" : {
+ "storage" : {
+ "journal" : {
+ "enabled" : false
+ }
+ }
+ }
+};
+
+getCmdLineOptsResult = mongodSource.adminCommand("getCmdLineOpts");
+printjson(getCmdLineOptsResult);
+getCmdLineOptsResult = removeOptionsAddedByFramework(getCmdLineOptsResult);
+assert.docEq(getCmdLineOptsResult.parsed, getCmdLineOptsExpected.parsed);
+MongoRunner.stopMongod(mongodSource.port);
+
+jsTest.log("Testing \"storage.journal.enabled\" config file option");
+mongodSource = MongoRunner.runMongod({ config : "jstests/libs/config_files/enable_journal.json" });
+getCmdLineOptsExpected = {
+ "parsed" : {
+ "config" : "jstests/libs/config_files/enable_journal.json",
+ "storage" : {
+ "journal" : {
+ "enabled" : false
+ }
+ }
+ }
+};
+
+getCmdLineOptsResult = mongodSource.adminCommand("getCmdLineOpts");
+printjson(getCmdLineOptsResult);
+getCmdLineOptsResult = removeOptionsAddedByFramework(getCmdLineOptsResult);
+assert.docEq(getCmdLineOptsResult.parsed, getCmdLineOptsExpected.parsed);
+MongoRunner.stopMongod(mongodSource.port);
+
+jsTest.log("Testing with no explicit journal setting");
+mongodSource = MongoRunner.runMongod();
+getCmdLineOptsExpected = {
+ "parsed" : {
+ "storage" : { }
+ }
+};
+
+getCmdLineOptsResult = mongodSource.adminCommand("getCmdLineOpts");
+printjson(getCmdLineOptsResult);
+getCmdLineOptsResult = removeOptionsAddedByFramework(getCmdLineOptsResult);
+assert.docEq(getCmdLineOptsResult.parsed, getCmdLineOptsExpected.parsed);
+MongoRunner.stopMongod(mongodSource.port);
+
+print(baseName + " succeeded.");