Files
mongo/jstests/multiVersion/genericSetFCVUsage/arbiter_always_has_latest_fcv.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

35 lines
1.2 KiB
JavaScript

/*
* Tests that an arbiter will always be on the latest FCV regardless of the FCV of the replica set.
*/
import {ReplSetTest} from "jstests/libs/replsettest.js";
function runTest(FCV) {
let rst = new ReplSetTest({nodes: [{}, {rsConfig: {arbiterOnly: true}}]});
rst.startSet();
rst.initiate();
const primary = rst.getPrimary();
if (FCV != latestFCV) {
assert.commandWorked(primary.getDB("admin").runCommand({setFeatureCompatibilityVersion: FCV, confirm: true}));
}
const primaryFCV = assert.commandWorked(
primary.getDB("admin").runCommand({getParameter: 1, featureCompatibilityVersion: 1}),
);
assert.eq(primaryFCV.featureCompatibilityVersion.version, FCV, tojson(primaryFCV));
// The arbiter should always have an FCV matching kLatest.
const arbiter = rst.getArbiter();
const arbiterFCV = assert.commandWorked(
arbiter.getDB("admin").runCommand({getParameter: 1, featureCompatibilityVersion: 1}),
);
assert.eq(arbiterFCV.featureCompatibilityVersion.version, latestFCV, tojson(arbiterFCV));
rst.stopSet();
}
runTest(latestFCV);
runTest(lastLTSFCV);
if (lastContinuousFCV != lastLTSFCV) {
runTest(lastContinuousFCV);
}