summaryrefslogtreecommitdiff
path: root/jstests/multiVersion/2_test_launching_cluster.js
blob: f26d3e78ac0d2a304ce4452c1e8dc2ff48fa3ecc (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
//
// Tests launching multi-version ShardingTest clusters.
//
// We cannot test with the shards being replica sets. If the 'replSetInitiate' command goes to a
// 3.6 node, then the node will initiate in fCV 3.6 and refuse to talk to the 3.4 node. If the
// 'replSetInitiate' command goes to a 3.4 node, then the node will not write it's fCV document
// at initiation and the 3.6 node will refuse to initial sync from it. For 3.8, we will be able
// to send 'replSetInitiate' to the 3.6 node and it will write the document at initiate in fCV
// 3.6 (since this changed between 3.4 and 3.6), and the 3.8 node will initial sync from it.
// TODO(SERVER-33180) update this test to use replica set shards.
//

load('./jstests/multiVersion/libs/verify_versions.js');

(function() {
    "use strict";
    // Check our latest versions
    var versionsToCheck = ["last-stable", "latest"];
    var versionsToCheckConfig = ["latest"];
    var versionsToCheckMongos = ["last-stable"];

    jsTest.log("Testing mixed versions...");

    // Set up a multi-version cluster
    var st = new ShardingTest({
        shards: 2,
        mongos: 2,
        other: {
            mongosOptions: {binVersion: versionsToCheckMongos},
            configOptions: {binVersion: versionsToCheckConfig},
            shardOptions: {binVersion: versionsToCheck},
            enableBalancer: true,
            shardAsReplicaSet: false
        }
    });

    var shards = [st.shard0, st.shard1];
    var mongoses = [st.s0, st.s1];
    var configs = [st.config0, st.config1, st.config2];

    // Make sure we have hosts of all the different versions
    var versionsFound = [];
    for (var j = 0; j < shards.length; j++)
        versionsFound.push(shards[j].getBinVersion());

    assert.allBinVersions(versionsToCheck, versionsFound);

    versionsFound = [];
    for (var j = 0; j < mongoses.length; j++)
        versionsFound.push(mongoses[j].getBinVersion());

    assert.allBinVersions(versionsToCheckMongos, versionsFound);

    versionsFound = [];
    for (var j = 0; j < configs.length; j++)
        versionsFound.push(configs[j].getBinVersion());

    assert.allBinVersions(versionsToCheckConfig, versionsFound);

    st.stop();
})();