summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/skip_sharding_configuration_checks.js
blob: 62553d42432ca5605632fd1d84073c0947a0fd48 (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
/**
 *  Starts standalone RS with skipShardingConfigurationChecks.
 * @tags: [
 *   requires_majority_read_concern,
 *   requires_persistence,
 *   requires_replication,
 *   requires_sharding,
 * ]
 */
(function() {
'use strict';

function expectState(rst, state) {
    assert.soon(function() {
        var status = rst.status();
        if (status.myState != state) {
            print("Waiting for state " + state + " in replSetGetStatus output: " + tojson(status));
        }
        return status.myState == state;
    });
}

assert.throws(() => MongoRunner.runMongod(
                  {configsvr: "", setParameter: 'skipShardingConfigurationChecks=true'}));

assert.throws(() => MongoRunner.runMongod(
                  {shardsvr: "", setParameter: 'skipShardingConfigurationChecks=true'}));

var st = new ShardingTest({name: "skipConfig", shards: {rs0: {nodes: 1}}});
var configRS = st.configRS;
var shardRS = st.rs0;

shardRS.stopSet(15, true);
configRS.stopSet(undefined, true);

jsTestLog("Restarting configRS as a standalone ReplicaSet");

for (let i = 0; i < configRS.nodes.length; i++) {
    delete configRS.nodes[i].fullOptions.configsvr;
    configRS.nodes[i].fullOptions.setParameter = 'skipShardingConfigurationChecks=true';
}
configRS.startSet({}, true);
expectState(configRS, ReplSetTest.State.PRIMARY);
configRS.stopSet();

jsTestLog("Restarting shardRS as a standalone ReplicaSet");
for (let i = 0; i < shardRS.nodes.length; i++) {
    delete shardRS.nodes[i].fullOptions.shardsvr;
    shardRS.nodes[i].fullOptions.setParameter = 'skipShardingConfigurationChecks=true';
}
shardRS.startSet({}, true);
expectState(shardRS, ReplSetTest.State.PRIMARY);
shardRS.stopSet();
MongoRunner.stopMongos(st.s);
})();