summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/queryable_backup_mode_incompatible_options.js
blob: 3c9f09ba38c619b094eb712d3c459912996c1c4d (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/**
 * Tests that the following mongod command line options are incompatible with --queryableBackupMode:
 *   --replSet
 *   --configsvr
 *   --upgrade
 *   --repair
 *   --profile
 */

// Check that starting mongod with both --queryableBackupMode and --replSet fails.
(function() {
    "use strict";

    var name = "queryable_backup_mode_repl_set";
    var dbdir = MongoRunner.dataPath + name + "/";

    resetDbpath(dbdir);

    // Insert dummy document to ensure startup failure isn't due to lack of storage metadata file.
    var conn = MongoRunner.runMongod({dbpath: dbdir, noCleanData: true});
    assert.neq(null, conn, "mongod was unable to start up");

    var coll = conn.getCollection('test.foo');
    coll.insertOne({a: 1});
    MongoRunner.stopMongod(conn);

    conn = MongoRunner.runMongod(
        {dbpath: dbdir, noCleanData: true, queryableBackupMode: '', replSet: 'bar'});

    assert.eq(
        null,
        conn,
        "mongod should fail to start when both --queryableBackupMode and --replSet are provided");

    conn = MongoRunner.runMongod(
        {dbpath: dbdir, noCleanData: true, queryableBackupMode: '', configsvr: ''});

    assert.eq(
        null,
        conn,
        "mongod should fail to start when both --queryableBackupMode and --configsvr are provided");

    conn = MongoRunner.runMongod(
        {dbpath: dbdir, noCleanData: true, queryableBackupMode: '', upgrade: ''});

    assert.eq(
        null,
        conn,
        "mongod should fail to start when both --queryableBackupMode and --upgrade are provided");

    conn = MongoRunner.runMongod(
        {dbpath: dbdir, noCleanData: true, queryableBackupMode: '', repair: ''});

    assert.eq(
        null,
        conn,
        "mongod should fail to start when both --queryableBackupMode and --repair are provided");

    conn = MongoRunner.runMongod(
        {dbpath: dbdir, noCleanData: true, queryableBackupMode: '', profile: 1});

    assert.eq(
        null,
        conn,
        "mongod should fail to start when both --queryableBackupMode and --profile are provided");
})();