diff options
author | Samy Lanka <samy.lanka@mongodb.com> | 2021-02-18 23:08:30 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-02-23 04:18:27 +0000 |
commit | d9f77934c145e2f602c3b5c72d7ce9ae6aec233a (patch) | |
tree | 51ccd7743b892660ecb471bbac152658a9687fdb /jstests | |
parent | d93aff7795f7089e9bdd253db792c6878c4be1cd (diff) | |
download | mongo-d9f77934c145e2f602c3b5c72d7ce9ae6aec233a.tar.gz |
SERVER-53953 Use safe reconfigs for setFCV command
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/multiVersion/genericSetFCVUsage/upgrade_downgrade_idempotency.js | 60 | ||||
-rw-r--r-- | jstests/noPassthrough/index_downgrade_fcv.js | 12 |
2 files changed, 60 insertions, 12 deletions
diff --git a/jstests/multiVersion/genericSetFCVUsage/upgrade_downgrade_idempotency.js b/jstests/multiVersion/genericSetFCVUsage/upgrade_downgrade_idempotency.js new file mode 100644 index 00000000000..ff24256908a --- /dev/null +++ b/jstests/multiVersion/genericSetFCVUsage/upgrade_downgrade_idempotency.js @@ -0,0 +1,60 @@ +/** + * Tests the idempotency of the 'setFeatureCompatibilityVersion' command. + * We execute the following steps for both upgrade and downgrade: + * 1. Enable a failpoint to fail upgrading/downgrading. + * 2. Issue a setFeatureCompatibilityVersion command, which upgrades/downgrades + * the replica set to a kUpgrading/kDowngrading intermediary state. + * 3. The setFeatureCompatibilityVersion command fails without completing all + * upgrade/downgrade behavior. + * 4. Disable the failpoint, and issue a succesful setFeatureCompatibilityVersion + * to finish upgrading/downgrading. + */ + +(function() { +"use strict"; + +load("jstests/libs/write_concern_util.js"); + +function runTest(downgradeVersion) { + const downgradeFCV = binVersionToFCV(downgradeVersion); + const replTest = new ReplSetTest({name: jsTestName(), nodes: 2}); + replTest.startSet(); + replTest.initiate(); + + let primary = replTest.getPrimary(); + // Enable failpoint to fail downgrading. + let failpoint = configureFailPoint(primary, 'failDowngrading'); + assert.commandFailed(primary.adminCommand({setFeatureCompatibilityVersion: downgradeFCV})); + + // Verify the node is in an intermediary state. If the response object has the 'targetVersion' + // field, we are in a partially upgraded or downgraded state. + checkFCV(primary.getDB("admin"), downgradeFCV, downgradeFCV); + + failpoint.off(); + + assert.commandWorked(primary.adminCommand({setFeatureCompatibilityVersion: downgradeFCV})); + + // Verify the feature compatibility version transition is complete. + checkFCV(primary.getDB("admin"), downgradeFCV); + + const latestFCV = binVersionToFCV('latest'); + // Enable failpoint to fail upgrading. + failpoint = configureFailPoint(primary, 'failUpgrading'); + assert.commandFailed(primary.adminCommand({setFeatureCompatibilityVersion: latestFCV})); + + // Verify the node is in an intermediary state. If the response object has the 'targetVersion' + // field, we are in a partially upgraded or downgraded state. + checkFCV(primary.getDB("admin"), downgradeFCV, latestFCV); + + failpoint.off(); + assert.commandWorked(primary.adminCommand({setFeatureCompatibilityVersion: latestFCV})); + + // Verify the feature compatibility version transition is complete. + checkFCV(primary.getDB("admin"), latestFCV); + + replTest.stopSet(); +} + +runTest('last-lts'); +runTest('last-continuous'); +}());
\ No newline at end of file diff --git a/jstests/noPassthrough/index_downgrade_fcv.js b/jstests/noPassthrough/index_downgrade_fcv.js index be0e879af8d..771471d74a0 100644 --- a/jstests/noPassthrough/index_downgrade_fcv.js +++ b/jstests/noPassthrough/index_downgrade_fcv.js @@ -30,18 +30,6 @@ const primary = rst.getPrimary(); const testDB = primary.getDB('test'); const coll = testDB.getCollection('test'); -// TODO SERVER-53953: Remove to re-enable test for feature flag enabled variants. -const res = assert.commandWorked( - primary.adminCommand({getParameter: 1, featureFlagUseSecondaryDelaySecs: 1}), - "Failed to call getParameter on feature flag: featureFlagUseSecondaryDelaySecs"); -const featureFlagUseSecondaryDelaySecsEnabled = res.featureFlagUseSecondaryDelaySecs.value; - -if (featureFlagUseSecondaryDelaySecsEnabled) { - jsTestLog("Skipping test because the useSecondaryDelaySecs feature flag is enabled"); - rst.stopSet(); - return; -} - assert.commandWorked(coll.insert({a: 1})); IndexBuildTest.pauseIndexBuilds(primary); |