File: auth_options.js

package info (click to toggle)
mongodb 1%3A3.2.11-2%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 196,404 kB
  • sloc: cpp: 1,412,793; ansic: 504,961; python: 78,522; perl: 5,837; sh: 5,661; java: 4,202; makefile: 1,784; pascal: 617; xml: 176; asm: 128
file content (52 lines) | stat: -rw-r--r-- 1,746 bytes parent folder | download
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
51
52
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.");