summaryrefslogtreecommitdiff
path: root/jstests/multiVersion/mixed_replica_set_with_latest_primary.js
blob: 10802ae523a7311b91af8241b0d9b7d2372a2142 (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
/**
 * Tests initializing a mixed version replica set through the shell.
 *
 * @tags: [fix_for_fcv_46]
 */

(function() {
"use strict";
load('./jstests/multiVersion/libs/multi_rs.js');

const lastStableVersion = "last-stable";
const latestVersion = "latest";

const nodes = {
    0: {binVersion: latestVersion},
    1: {binVersion: lastStableVersion},
    2: {binVersion: lastStableVersion}
};

const rst = new ReplSetTest({nodes: nodes});

rst.startSet();
rst.initiate();

const latestBinVersion = MongoRunner.getBinVersionFor(latestVersion);
const lastStableBinVersion = MongoRunner.getBinVersionFor(lastStableVersion);

for (let i = 0; i < rst.nodes.length; i++) {
    const admin = rst.nodes[i].getDB("admin");
    const serverStatus = admin.serverStatus();
    const expectedVersion =
        nodes[i]["binVersion"] === latestVersion ? latestBinVersion : lastStableBinVersion;
    const actualVersion = serverStatus["version"];
    assert(MongoRunner.areBinVersionsTheSame(actualVersion, expectedVersion));
}
rst.stopSet();
})();