summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorShaun Verch <shaun.verch@mongodb.com>2014-05-07 18:01:04 -0400
committerShaun Verch <shaun.verch@mongodb.com>2014-05-13 17:08:50 -0400
commita503b4b57e57f81bebddd07ed75cf116f23de350 (patch)
treeae0db9e6b4474142a3862ddf550554f1af09ba39 /jstests
parentb3e8e45ea6f346f804161e1fe4043ba3e5850ba8 (diff)
downloadmongo-a503b4b57e57f81bebddd07ed75cf116f23de350.tar.gz
SERVER-13439 Make sure values explicitly set to false in config file show up in parsed result
Diffstat (limited to 'jstests')
-rw-r--r--jstests/auth/auth_options.js23
-rw-r--r--jstests/disk/datafile_options.js13
-rw-r--r--jstests/disk/index_options.js12
-rw-r--r--jstests/dur/journaling_options.js57
-rw-r--r--jstests/libs/config_files/disable_auth.ini1
-rw-r--r--jstests/libs/config_files/disable_dur.ini1
-rw-r--r--jstests/libs/config_files/disable_httpinterface.ini1
-rw-r--r--jstests/libs/config_files/disable_ipv6.ini1
-rw-r--r--jstests/libs/config_files/disable_journal.ini1
-rw-r--r--jstests/libs/config_files/disable_jsonp.ini1
-rw-r--r--jstests/libs/config_files/disable_jsonp.json7
-rw-r--r--jstests/libs/config_files/disable_moveparanoia.ini1
-rw-r--r--jstests/libs/config_files/disable_noauth.ini1
-rw-r--r--jstests/libs/config_files/disable_noautosplit.ini1
-rw-r--r--jstests/libs/config_files/disable_nodur.ini1
-rw-r--r--jstests/libs/config_files/disable_nohttpinterface.ini1
-rw-r--r--jstests/libs/config_files/disable_noindexbuildretry.ini1
-rw-r--r--jstests/libs/config_files/disable_nojournal.ini1
-rw-r--r--jstests/libs/config_files/disable_nomoveparanoia.ini1
-rw-r--r--jstests/libs/config_files/disable_noobjcheck.ini1
-rw-r--r--jstests/libs/config_files/disable_noprealloc.ini1
-rw-r--r--jstests/libs/config_files/disable_nounixsocket.ini1
-rw-r--r--jstests/libs/config_files/disable_objcheck.ini1
-rw-r--r--jstests/libs/config_files/disable_rest_interface.json7
-rw-r--r--jstests/libs/testconfig2
-rw-r--r--jstests/noPassthrough/network_options.js130
-rw-r--r--jstests/noPassthroughWithMongod/command_line_parsing.js10
-rw-r--r--jstests/sharding/sharding_options.js38
28 files changed, 315 insertions, 2 deletions
diff --git a/jstests/auth/auth_options.js b/jstests/auth/auth_options.js
index ad694df7413..4f5dc27fb78 100644
--- a/jstests/auth/auth_options.js
+++ b/jstests/auth/auth_options.js
@@ -39,4 +39,27 @@ expectedResult = {
};
testGetCmdLineOptsMongod({}, expectedResult);
+// Test that we preserve switches explicitly set to false in config files. See SERVER-13439.
+jsTest.log("Testing explicitly disabled \"auth\" config file option");
+expectedResult = {
+ "parsed" : {
+ "config" : "jstests/libs/config_files/disable_auth.ini",
+ "security" : {
+ "authorization" : "disabled"
+ }
+ }
+};
+testGetCmdLineOptsMongod({ config : "jstests/libs/config_files/disable_auth.ini" }, expectedResult);
+
+jsTest.log("Testing explicitly disabled \"noauth\" config file option");
+expectedResult = {
+ "parsed" : {
+ "config" : "jstests/libs/config_files/disable_noauth.ini",
+ "security" : {
+ "authorization" : "enabled"
+ }
+ }
+};
+testGetCmdLineOptsMongod({ config : "jstests/libs/config_files/disable_noauth.ini" }, expectedResult);
+
print(baseName + " succeeded.");
diff --git a/jstests/disk/datafile_options.js b/jstests/disk/datafile_options.js
index 36a3de3663c..01dd1be49b4 100644
--- a/jstests/disk/datafile_options.js
+++ b/jstests/disk/datafile_options.js
@@ -32,4 +32,17 @@ expectedResult = {
};
testGetCmdLineOptsMongod({}, expectedResult);
+// Test that we preserve switches explicitly set to false in config files. See SERVER-13439.
+jsTest.log("Testing explicitly disabled \"noprealloc\" config file option");
+expectedResult = {
+ "parsed" : {
+ "config" : "jstests/libs/config_files/disable_noprealloc.ini",
+ "storage" : {
+ "preallocDataFiles" : true
+ }
+ }
+};
+testGetCmdLineOptsMongod({ config : "jstests/libs/config_files/disable_noprealloc.ini" },
+ expectedResult);
+
print(baseName + " succeeded.");
diff --git a/jstests/disk/index_options.js b/jstests/disk/index_options.js
index 0624d93b21e..d8a3b267333 100644
--- a/jstests/disk/index_options.js
+++ b/jstests/disk/index_options.js
@@ -32,4 +32,16 @@ expectedResult = {
};
testGetCmdLineOptsMongod({}, expectedResult);
+jsTest.log("Testing explicitly disabled \"noIndexBuildRetry\" config file option");
+expectedResult = {
+ "parsed" : {
+ "config" : "jstests/libs/config_files/disable_noindexbuildretry.ini",
+ "storage" : {
+ "indexBuildRetry" : true
+ }
+ }
+};
+testGetCmdLineOptsMongod({ config : "jstests/libs/config_files/disable_noindexbuildretry.ini" },
+ expectedResult);
+
print(baseName + " succeeded.");
diff --git a/jstests/dur/journaling_options.js b/jstests/dur/journaling_options.js
index a457882fffe..9d2c418d494 100644
--- a/jstests/dur/journaling_options.js
+++ b/jstests/dur/journaling_options.js
@@ -72,4 +72,61 @@ expectedResult = {
};
testGetCmdLineOptsMongod({}, expectedResult);
+// Test that we preserve switches explicitly set to false in config files. See SERVER-13439.
+jsTest.log("Testing explicitly disabled \"journal\" config file option");
+expectedResult = {
+ "parsed" : {
+ "config" : "jstests/libs/config_files/disable_journal.ini",
+ "storage" : {
+ "journal" : {
+ "enabled" : false
+ }
+ }
+ }
+};
+testGetCmdLineOptsMongod({ config : "jstests/libs/config_files/disable_journal.ini" },
+ expectedResult);
+
+jsTest.log("Testing explicitly disabled \"nojournal\" config file option");
+expectedResult = {
+ "parsed" : {
+ "config" : "jstests/libs/config_files/disable_nojournal.ini",
+ "storage" : {
+ "journal" : {
+ "enabled" : true
+ }
+ }
+ }
+};
+testGetCmdLineOptsMongod({ config : "jstests/libs/config_files/disable_nojournal.ini" },
+ expectedResult);
+
+jsTest.log("Testing explicitly disabled \"dur\" config file option");
+expectedResult = {
+ "parsed" : {
+ "config" : "jstests/libs/config_files/disable_dur.ini",
+ "storage" : {
+ "journal" : {
+ "enabled" : false
+ }
+ }
+ }
+};
+testGetCmdLineOptsMongod({ config : "jstests/libs/config_files/disable_dur.ini" },
+ expectedResult);
+
+jsTest.log("Testing explicitly disabled \"nodur\" config file option");
+expectedResult = {
+ "parsed" : {
+ "config" : "jstests/libs/config_files/disable_nodur.ini",
+ "storage" : {
+ "journal" : {
+ "enabled" : true
+ }
+ }
+ }
+};
+testGetCmdLineOptsMongod({ config : "jstests/libs/config_files/disable_nodur.ini" },
+ expectedResult);
+
print(baseName + " succeeded.");
diff --git a/jstests/libs/config_files/disable_auth.ini b/jstests/libs/config_files/disable_auth.ini
new file mode 100644
index 00000000000..c1193be1b03
--- /dev/null
+++ b/jstests/libs/config_files/disable_auth.ini
@@ -0,0 +1 @@
+auth=false
diff --git a/jstests/libs/config_files/disable_dur.ini b/jstests/libs/config_files/disable_dur.ini
new file mode 100644
index 00000000000..8f83f3ae5a7
--- /dev/null
+++ b/jstests/libs/config_files/disable_dur.ini
@@ -0,0 +1 @@
+dur=false
diff --git a/jstests/libs/config_files/disable_httpinterface.ini b/jstests/libs/config_files/disable_httpinterface.ini
new file mode 100644
index 00000000000..fc839a98a76
--- /dev/null
+++ b/jstests/libs/config_files/disable_httpinterface.ini
@@ -0,0 +1 @@
+httpinterface=false
diff --git a/jstests/libs/config_files/disable_ipv6.ini b/jstests/libs/config_files/disable_ipv6.ini
new file mode 100644
index 00000000000..a091421022d
--- /dev/null
+++ b/jstests/libs/config_files/disable_ipv6.ini
@@ -0,0 +1 @@
+ipv6=false
diff --git a/jstests/libs/config_files/disable_journal.ini b/jstests/libs/config_files/disable_journal.ini
new file mode 100644
index 00000000000..d0010a86906
--- /dev/null
+++ b/jstests/libs/config_files/disable_journal.ini
@@ -0,0 +1 @@
+journal=false
diff --git a/jstests/libs/config_files/disable_jsonp.ini b/jstests/libs/config_files/disable_jsonp.ini
new file mode 100644
index 00000000000..82847f50b2b
--- /dev/null
+++ b/jstests/libs/config_files/disable_jsonp.ini
@@ -0,0 +1 @@
+jsonp=false
diff --git a/jstests/libs/config_files/disable_jsonp.json b/jstests/libs/config_files/disable_jsonp.json
new file mode 100644
index 00000000000..4d5477a8547
--- /dev/null
+++ b/jstests/libs/config_files/disable_jsonp.json
@@ -0,0 +1,7 @@
+{
+ "net" : {
+ "http" : {
+ "JSONPEnabled" : false
+ }
+ }
+}
diff --git a/jstests/libs/config_files/disable_moveparanoia.ini b/jstests/libs/config_files/disable_moveparanoia.ini
new file mode 100644
index 00000000000..f21b50f9513
--- /dev/null
+++ b/jstests/libs/config_files/disable_moveparanoia.ini
@@ -0,0 +1 @@
+moveParanoia=false
diff --git a/jstests/libs/config_files/disable_noauth.ini b/jstests/libs/config_files/disable_noauth.ini
new file mode 100644
index 00000000000..a65f909baf3
--- /dev/null
+++ b/jstests/libs/config_files/disable_noauth.ini
@@ -0,0 +1 @@
+noauth=false
diff --git a/jstests/libs/config_files/disable_noautosplit.ini b/jstests/libs/config_files/disable_noautosplit.ini
new file mode 100644
index 00000000000..b490f9038dd
--- /dev/null
+++ b/jstests/libs/config_files/disable_noautosplit.ini
@@ -0,0 +1 @@
+noAutoSplit=false
diff --git a/jstests/libs/config_files/disable_nodur.ini b/jstests/libs/config_files/disable_nodur.ini
new file mode 100644
index 00000000000..b0c73a48b30
--- /dev/null
+++ b/jstests/libs/config_files/disable_nodur.ini
@@ -0,0 +1 @@
+nodur=false
diff --git a/jstests/libs/config_files/disable_nohttpinterface.ini b/jstests/libs/config_files/disable_nohttpinterface.ini
new file mode 100644
index 00000000000..52c4958da6e
--- /dev/null
+++ b/jstests/libs/config_files/disable_nohttpinterface.ini
@@ -0,0 +1 @@
+nohttpinterface=false
diff --git a/jstests/libs/config_files/disable_noindexbuildretry.ini b/jstests/libs/config_files/disable_noindexbuildretry.ini
new file mode 100644
index 00000000000..79e428c492f
--- /dev/null
+++ b/jstests/libs/config_files/disable_noindexbuildretry.ini
@@ -0,0 +1 @@
+noIndexBuildRetry=false
diff --git a/jstests/libs/config_files/disable_nojournal.ini b/jstests/libs/config_files/disable_nojournal.ini
new file mode 100644
index 00000000000..17172363d25
--- /dev/null
+++ b/jstests/libs/config_files/disable_nojournal.ini
@@ -0,0 +1 @@
+nojournal=false
diff --git a/jstests/libs/config_files/disable_nomoveparanoia.ini b/jstests/libs/config_files/disable_nomoveparanoia.ini
new file mode 100644
index 00000000000..4696304134f
--- /dev/null
+++ b/jstests/libs/config_files/disable_nomoveparanoia.ini
@@ -0,0 +1 @@
+noMoveParanoia=false
diff --git a/jstests/libs/config_files/disable_noobjcheck.ini b/jstests/libs/config_files/disable_noobjcheck.ini
new file mode 100644
index 00000000000..471e83c3172
--- /dev/null
+++ b/jstests/libs/config_files/disable_noobjcheck.ini
@@ -0,0 +1 @@
+noobjcheck=false
diff --git a/jstests/libs/config_files/disable_noprealloc.ini b/jstests/libs/config_files/disable_noprealloc.ini
new file mode 100644
index 00000000000..08c78be3507
--- /dev/null
+++ b/jstests/libs/config_files/disable_noprealloc.ini
@@ -0,0 +1 @@
+noprealloc=false
diff --git a/jstests/libs/config_files/disable_nounixsocket.ini b/jstests/libs/config_files/disable_nounixsocket.ini
new file mode 100644
index 00000000000..66da9f08391
--- /dev/null
+++ b/jstests/libs/config_files/disable_nounixsocket.ini
@@ -0,0 +1 @@
+nounixsocket=false
diff --git a/jstests/libs/config_files/disable_objcheck.ini b/jstests/libs/config_files/disable_objcheck.ini
new file mode 100644
index 00000000000..bd19d026bbf
--- /dev/null
+++ b/jstests/libs/config_files/disable_objcheck.ini
@@ -0,0 +1 @@
+objcheck=false
diff --git a/jstests/libs/config_files/disable_rest_interface.json b/jstests/libs/config_files/disable_rest_interface.json
new file mode 100644
index 00000000000..f9ad93a4f5d
--- /dev/null
+++ b/jstests/libs/config_files/disable_rest_interface.json
@@ -0,0 +1,7 @@
+{
+ "net" : {
+ "http" : {
+ "RESTInterfaceEnabled" : false
+ }
+ }
+}
diff --git a/jstests/libs/testconfig b/jstests/libs/testconfig
index 0c1fc871d61..4b09f37ad13 100644
--- a/jstests/libs/testconfig
+++ b/jstests/libs/testconfig
@@ -2,3 +2,5 @@ fastsync = true
#comment line
#commentedflagwithan = false
version = false
+help = false
+sysinfo = false
diff --git a/jstests/noPassthrough/network_options.js b/jstests/noPassthrough/network_options.js
index c3baa7b38ca..33f117f980b 100644
--- a/jstests/noPassthrough/network_options.js
+++ b/jstests/noPassthrough/network_options.js
@@ -1,5 +1,7 @@
var baseName = "jstests_core_network_options";
+// Tests for command line option canonicalization. See SERVER-13379.
+
load('jstests/libs/command_line/test_parsed_options.js');
// Object Check
@@ -157,4 +159,132 @@ if (!_isWindows()) {
testGetCmdLineOptsMongod({}, expectedResult);
}
+
+// Test that we preserve switches explicitly set to false in config files. See SERVER-13439.
+jsTest.log("Testing explicitly disabling \"net.http.RESTInterfaceEnabled\" config file option");
+expectedResult = {
+ "parsed" : {
+ "config" : "jstests/libs/config_files/disable_rest_interface.json",
+ "net" : {
+ "http" : {
+ "RESTInterfaceEnabled" : false
+ }
+ }
+ }
+};
+testGetCmdLineOptsMongod({ config : "jstests/libs/config_files/disable_rest_interface.json" },
+ expectedResult);
+
+jsTest.log("Testing explicitly disabling \"net.http.JSONPEnabled\" config file option on mongoD");
+expectedResult = {
+ "parsed" : {
+ "config" : "jstests/libs/config_files/disable_jsonp.json",
+ "net" : {
+ "http" : {
+ "JSONPEnabled" : false
+ }
+ }
+ }
+};
+testGetCmdLineOptsMongod({ config : "jstests/libs/config_files/disable_jsonp.json" },
+ expectedResult);
+
+// jsonp on mongos is legacy and not supported in json/yaml config files since this interface is not
+// well defined. See SERVER-11707 for an example.
+jsTest.log("Testing explicitly disabling \"jsonp\" config file option on mongoS");
+expectedResult = {
+ "parsed" : {
+ "config" : "jstests/libs/config_files/disable_jsonp.ini",
+ "net" : {
+ "http" : {
+ "JSONPEnabled" : false
+ }
+ }
+ }
+};
+testGetCmdLineOptsMongos({ config : "jstests/libs/config_files/disable_jsonp.ini" },
+ expectedResult);
+
+jsTest.log("Testing explicitly disabled \"objcheck\" config file option");
+expectedResult = {
+ "parsed" : {
+ "config" : "jstests/libs/config_files/disable_objcheck.ini",
+ "net" : {
+ "wireObjectCheck" : false
+ }
+ }
+};
+testGetCmdLineOptsMongod({ config : "jstests/libs/config_files/disable_objcheck.ini" },
+ expectedResult);
+
+jsTest.log("Testing explicitly disabled \"noobjcheck\" config file option");
+expectedResult = {
+ "parsed" : {
+ "config" : "jstests/libs/config_files/disable_noobjcheck.ini",
+ "net" : {
+ "wireObjectCheck" : true
+ }
+ }
+};
+testGetCmdLineOptsMongod({ config : "jstests/libs/config_files/disable_noobjcheck.ini" },
+ expectedResult);
+
+jsTest.log("Testing explicitly disabled \"httpinterface\" config file option");
+expectedResult = {
+ "parsed" : {
+ "config" : "jstests/libs/config_files/disable_httpinterface.ini",
+ "net" : {
+ "http" : {
+ "enabled" : false
+ }
+ }
+ }
+};
+testGetCmdLineOptsMongod({ config : "jstests/libs/config_files/disable_httpinterface.ini" },
+ expectedResult);
+
+jsTest.log("Testing explicitly disabled \"nohttpinterface\" config file option");
+expectedResult = {
+ "parsed" : {
+ "config" : "jstests/libs/config_files/disable_nohttpinterface.ini",
+ "net" : {
+ "http" : {
+ "enabled" : true
+ }
+ }
+ }
+};
+testGetCmdLineOptsMongod({ config : "jstests/libs/config_files/disable_nohttpinterface.ini" },
+ expectedResult);
+
+jsTest.log("Testing explicitly disabled \"ipv6\" config file option");
+expectedResult = {
+ "parsed" : {
+ "config" : "jstests/libs/config_files/disable_ipv6.ini",
+ "net" : {
+ "ipv6" : false
+ }
+ }
+};
+testGetCmdLineOptsMongod({ config : "jstests/libs/config_files/disable_ipv6.ini" },
+ expectedResult);
+
+if (!_isWindows()) {
+ jsTest.log("Testing explicitly disabled \"nounixsocket\" config file option");
+ expectedResult = {
+ "parsed" : {
+ "config" : "jstests/libs/config_files/disable_nounixsocket.ini",
+ "net" : {
+ "unixDomainSocket" : {
+ "enabled" : true
+ }
+ }
+ }
+ };
+ testGetCmdLineOptsMongod({ config : "jstests/libs/config_files/disable_nounixsocket.ini" },
+ expectedResult);
+}
+
+
+
print(baseName + " succeeded.");
diff --git a/jstests/noPassthroughWithMongod/command_line_parsing.js b/jstests/noPassthroughWithMongod/command_line_parsing.js
index bb64e9b2e06..a1a6528b451 100644
--- a/jstests/noPassthroughWithMongod/command_line_parsing.js
+++ b/jstests/noPassthroughWithMongod/command_line_parsing.js
@@ -20,7 +20,10 @@ var m2expected = {
},
"net" : {
"port" : 31002
- }
+ },
+ "help" : false,
+ "version" : false,
+ "sysinfo" : false
}
};
var m2result = m2.getDB("admin").runCommand( "getCmdLineOpts" );
@@ -42,7 +45,10 @@ var m3expected = {
},
"net" : {
"port" : 31004
- }
+ },
+ "help" : false,
+ "version" : false,
+ "sysinfo" : false
}
};
var m3result = m3.getDB("admin").runCommand( "getCmdLineOpts" );
diff --git a/jstests/sharding/sharding_options.js b/jstests/sharding/sharding_options.js
index d3376c9ce29..ff7098e9006 100644
--- a/jstests/sharding/sharding_options.js
+++ b/jstests/sharding/sharding_options.js
@@ -97,4 +97,42 @@ expectedResult = {
testGetCmdLineOptsMongos({ config : "jstests/libs/config_files/enable_autosplit.json" },
expectedResult);
+// Test that we preserve switches explicitly set to false in config files. See SERVER-13439.
+jsTest.log("Testing explicitly disabled \"moveParanoia\" config file option");
+expectedResult = {
+ "parsed" : {
+ "config" : "jstests/libs/config_files/disable_moveparanoia.ini",
+ "sharding" : {
+ "archiveMovedChunks" : false
+ }
+ }
+};
+testGetCmdLineOptsMongod({ config : "jstests/libs/config_files/disable_moveparanoia.ini" },
+ expectedResult);
+
+jsTest.log("Testing explicitly disabled \"noMoveParanoia\" config file option");
+expectedResult = {
+ "parsed" : {
+ "config" : "jstests/libs/config_files/disable_nomoveparanoia.ini",
+ "sharding" : {
+ "archiveMovedChunks" : true
+ }
+ }
+};
+testGetCmdLineOptsMongod({ config : "jstests/libs/config_files/disable_nomoveparanoia.ini" },
+ expectedResult);
+
+jsTest.log("Testing explicitly disabled \"noAutoSplit\" config file option");
+expectedResult = {
+ "parsed" : {
+ "config" : "jstests/libs/config_files/disable_noautosplit.ini",
+ "sharding" : {
+ "autoSplit" : true
+ }
+ }
+};
+testGetCmdLineOptsMongos({ config : "jstests/libs/config_files/disable_noautosplit.ini" },
+ expectedResult);
+
+
print(baseName + " succeeded.");