blob: aa8bd7ee9ebd3502720b69e28102b54f734d590d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
var baseName = "jstests_auth_auth_options";
load('jstests/libs/command_line/test_parsed_options.js');
jsTest.log("Testing \"auth\" command line option");
var expectedResult = {"parsed": {"security": {"authorization": "enabled"}}};
testGetCmdLineOptsMongod({auth: ""}, expectedResult);
jsTest.log("Testing \"noauth\" command line option");
expectedResult = {
"parsed": {"security": {"authorization": "disabled"}}
};
testGetCmdLineOptsMongod({noauth: ""}, expectedResult);
jsTest.log("Testing \"security.authorization\" config file option");
expectedResult = {
"parsed": {
"config": "jstests/libs/config_files/enable_auth.json",
"security": {"authorization": "enabled"}
}
};
testGetCmdLineOptsMongod({config: "jstests/libs/config_files/enable_auth.json"}, expectedResult);
jsTest.log("Testing with no explicit object check setting");
expectedResult = {
"parsed": {}
};
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.");
|