-
Notifications
You must be signed in to change notification settings - Fork 5.6k
/
Copy pathconfig_transitions.js
23 lines (19 loc) · 1.03 KB
/
config_transitions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import {OverrideHelpers} from "jstests/libs/override_methods/override_helpers.js";
/**
* Throws an error if this command should not be run in config transition suites.
*/
function checkCanRun(dbName, commandName, commandObj) {
if (commandName == "setFeatureCompatibilityVersion" && commandObj[commandName] != latestFCV) {
throw Error("Cannot downgrade the FCV since if the setFCV command fails partway through, " +
"the FCV may be left in the upgrading or downgrading state and the " +
"transitionFromDedicatedConfigServer command and moveCollection command are " +
"not supported when the FCV is upgrading or downgrading.");
}
}
function runCommand(conn, dbName, commandName, commandObj, func, makeFuncArgs) {
checkCanRun(dbName, commandName, commandObj);
return func.apply(conn, makeFuncArgs(commandObj));
}
OverrideHelpers.prependOverrideInParallelShell(
"jstests/libs/override_methods/config_transitions.js");
OverrideHelpers.overrideRunCommand(runCommand);