Files
mongo/jstests/multiVersion/genericBinVersion/command_registration_startup_behavior_fcv.js
Steve McClure cf59a46893 SERVER-87891: Move targeted multiversion tests (#41621)
GitOrigin-RevId: 04a80da842c063cbe06c45da01572ac690794f17
2025-09-24 19:21:00 +00:00

35 lines
1.1 KiB
JavaScript

/**
* Tests that commands gated on a feature flag does not depend on FCV at startup.
*/
import "jstests/multiVersion/libs/multi_rs.js";
import {ReplSetTest} from "jstests/libs/replsettest.js";
const rst = new ReplSetTest({
nodes: [{binVersion: "last-lts"}, {binVersion: "last-lts"}],
});
rst.startSet();
rst.initiate();
// This testCmd is gated by gFeatureFlagBlender which is enabled on latest version.
const testCmd = {
testCommandFeatureFlaggedOnLatestFCV83: 1,
};
// The testCmd should not be registered when the node is on the last-lts binary.
assert.commandFailedWithCode(rst.getPrimary().adminCommand(testCmd), ErrorCodes.CommandNotFound);
jsTest.log("Upgrading the replica set to latest.");
rst.upgradeSet({binVersion: "latest"});
jsTest.log("Upgrade complete.");
// Check that the FCV is still on lastLTS since we only upgraded the binary to latest.
checkFCV(rst.getPrimary().getDB("admin"), lastLTSFCV);
// The testCmd should now be registered since the feature flag is enabled, even though the FCV
// hasn't been upgraded.
assert.commandWorked(rst.getPrimary().adminCommand(testCmd));
rst.stopSet();