summaryrefslogtreecommitdiff
path: root/jstests/disk/datafile_options.js
blob: a7639c43d7d30591bab3ae833340feaed80ad68d (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
var baseName = "jstests_disk_datafile_options";

load('jstests/libs/command_line/test_parsed_options.js');

jsTest.log("Testing \"noprealloc\" command line option");
var expectedResult = {
    "parsed": {"storage": {"mmapv1": {"preallocDataFiles": false}}}
};
testGetCmdLineOptsMongod({noprealloc: ""}, expectedResult);

jsTest.log("Testing \"storage.mmapv1.preallocDataFiles\" config file option");
expectedResult = {
    "parsed": {
        "config": "jstests/libs/config_files/enable_prealloc.json",
        "storage": {"mmapv1": {"preallocDataFiles": true}}
    }
};
testGetCmdLineOptsMongod({config: "jstests/libs/config_files/enable_prealloc.json"},
                         expectedResult);

jsTest.log("Testing with no explicit data file option setting");
expectedResult = {
    "parsed": {"storage": {}}
};
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": {"mmapv1": {"preallocDataFiles": true}}
    }
};
testGetCmdLineOptsMongod({config: "jstests/libs/config_files/disable_noprealloc.ini"},
                         expectedResult);

print(baseName + " succeeded.");