summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/disabled_test_parameters.js
blob: 948883278adf6d21939e0eb60182c0506ad7f41f (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
// Test that test-only set parameters are disabled.

(function() {
    'use strict';

    function assertFails(opts) {
        assert.eq(null, MongoRunner.runMongod(opts), "Mongod startup up");
    }

    function assertStarts(opts) {
        const mongod = MongoRunner.runMongod(opts);
        assert(mongod, "Mongod startup up");
        MongoRunner.stopMongod(mongod);
    }

    setJsTestOption('enableTestCommands', false);

    // enableTestCommands not specified.
    assertFails({
        'setParameter': {
            enableIndexBuildsCoordinatorForCreateIndexesCommand: 'false',
        },
    });

    // enableTestCommands specified as truthy.
    ['1', 'true'].forEach(v => {
        assertStarts({
            'setParameter': {
                enableTestCommands: v,
                enableIndexBuildsCoordinatorForCreateIndexesCommand: 'false',
            },
        });
    });

    // enableTestCommands specified as falsy.
    ['0', 'false'].forEach(v => {
        assertFails({
            'setParameter': {
                enableTestCommands: v,
                enableIndexBuildsCoordinatorForCreateIndexesCommand: 'false',
            },
        });
    });
}());