0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00
mongodb/jstests/multiVersion/mixed_replica_set_with_latest_primary.js

37 lines
1008 B
JavaScript

/**
* Tests initializing a mixed version replica set through the shell.
*
*/
(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();
})();