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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
function doTest() {
var baseName = "jstests_dur_journaling_options";
load('jstests/libs/command_line/test_parsed_options.js');
jsTest.log("Testing \"dur\" command line option");
var expectedResult = {
"parsed": {"storage": {"journal": {"enabled": true}}}
};
testGetCmdLineOptsMongod({dur: ""}, expectedResult);
jsTest.log("Testing \"nodur\" command line option");
expectedResult = {
"parsed": {"storage": {"journal": {"enabled": false}}}
};
testGetCmdLineOptsMongod({nodur: ""}, expectedResult);
jsTest.log("Testing \"journal\" command line option");
expectedResult = {
"parsed": {"storage": {"journal": {"enabled": true}}}
};
testGetCmdLineOptsMongod({journal: ""}, expectedResult);
jsTest.log("Testing \"nojournal\" command line option");
expectedResult = {
"parsed": {"storage": {"journal": {"enabled": false}}}
};
testGetCmdLineOptsMongod({nojournal: ""}, expectedResult);
jsTest.log("Testing \"storage.journal.enabled\" config file option");
expectedResult = {
"parsed": {
"config": "jstests/libs/config_files/enable_journal.json",
"storage": {"journal": {"enabled": false}}
}
};
testGetCmdLineOptsMongod({config: "jstests/libs/config_files/enable_journal.json"},
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);
// Test that switches in old config files with no value have an implicit value of true
jsTest.log("Testing implicitly enabled \"journal\" config file option");
expectedResult = {
"parsed": {
"config": "jstests/libs/config_files/implicitly_enable_journal.ini",
"storage": {"journal": {"enabled": true}}
}
};
testGetCmdLineOptsMongod({config: "jstests/libs/config_files/implicitly_enable_journal.ini"},
expectedResult);
jsTest.log("Testing implicitly enabled \"nojournal\" config file option");
expectedResult = {
"parsed": {
"config": "jstests/libs/config_files/implicitly_enable_nojournal.ini",
"storage": {"journal": {"enabled": false}}
}
};
testGetCmdLineOptsMongod({config: "jstests/libs/config_files/implicitly_enable_nojournal.ini"},
expectedResult);
jsTest.log("Testing implicitly enabled \"dur\" config file option");
expectedResult = {
"parsed": {
"config": "jstests/libs/config_files/implicitly_enable_dur.ini",
"storage": {"journal": {"enabled": true}}
}
};
testGetCmdLineOptsMongod({config: "jstests/libs/config_files/implicitly_enable_dur.ini"},
expectedResult);
jsTest.log("Testing implicitly enabled \"nodur\" config file option");
expectedResult = {
"parsed": {
"config": "jstests/libs/config_files/implicitly_enable_nodur.ini",
"storage": {"journal": {"enabled": false}}
}
};
testGetCmdLineOptsMongod({config: "jstests/libs/config_files/implicitly_enable_nodur.ini"},
expectedResult);
print(baseName + " succeeded.");
}
if (!jsTestOptions().noJournal) {
doTest();
}
|