Files
mongo/jstests/multiVersion/genericSetFCVUsage/1_test_launching_replset.js
Zac 591928c619 SERVER-108478 JS formatted by prettier and remove clang-format (#39656)
GitOrigin-RevId: 6c8f6aded47f260aa4f7c231b17dae3302cb1e04
2025-08-21 17:27:09 +00:00

91 lines
2.3 KiB
JavaScript

import "jstests/multiVersion/libs/verify_versions.js";
import {ReplSetTest} from "jstests/libs/replsettest.js";
for (let version of ["last-lts", "last-continuous", "latest"]) {
jsTestLog("Testing single version: " + version);
// Set up a single-version replica set
var rst = new ReplSetTest({nodes: 2});
rst.startSet({binVersion: version});
var nodes = rst.nodes;
// Make sure the started versions are actually the correct versions
for (var j = 0; j < nodes.length; j++) assert.binVersion(nodes[j], version);
rst.stopSet();
}
for (let versions of [
["last-lts", "latest"],
["last-continuous", "latest"],
]) {
jsTestLog("Testing mixed versions: " + tojson(versions));
// Set up a multi-version replica set
var rst = new ReplSetTest({nodes: 2});
rst.startSet({binVersion: versions});
var nodes = rst.nodes;
// Make sure we have hosts of all the different versions
var versionsFound = [];
for (var j = 0; j < nodes.length; j++) versionsFound.push(nodes[j].getBinVersion());
assert.allBinVersions(versions, versionsFound);
rst.stopSet();
}
if (MongoRunner.areBinVersionsTheSame("last-continuous", "last-lts")) {
jsTest.log("Skipping test because 'last-continuous' == 'last-lts'");
quit();
}
for (let versions of [
["last-lts", "last-continuous"],
["last-continuous", "last-lts"],
]) {
jsTestLog("Testing mixed versions: " + tojson(versions));
var rst = new ReplSetTest({nodes: 2});
rst.startSet({binVersion: versions});
let err = assert.throws(() => rst.initiate());
assert(
err.message.includes("Can only specify one of 'last-lts' and 'last-continuous' in binVersion, not both."),
err,
);
rst.stopSet();
}
for (let versions of [
["last-lts", "last-continuous"],
["last-continuous", "last-lts"],
]) {
jsTestLog("Testing mixed versions: " + tojson(versions));
const rst = new ReplSetTest({
nodes: [
{
binVersion: versions[0],
},
{
binVersion: versions[1],
},
],
});
rst.startSet();
let err = assert.throws(() => rst.initiate());
assert(
err.message.includes("Can only specify one of 'last-lts' and 'last-continuous' in binVersion, not both."),
err,
);
rst.stopSet();
}
jsTestLog("Done!");