summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2023-02-14 02:41:11 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-02-14 04:30:07 +0000
commit157657ee0a42a4b47d2e810635da2fb9534ded96 (patch)
tree10ec6e8e1cb81ad4fdbafe44ce4be966c023da3c
parent13e18ee61ce8025d67d34f44db65c355daaf59e5 (diff)
downloadmongo-157657ee0a42a4b47d2e810635da2fb9534ded96.tar.gz
SERVER-72517 feature flag testing robustness
-rw-r--r--jstests/concurrency/fsm_workloads/random_moveChunk_timeseries_deletes.js1
-rw-r--r--jstests/concurrency/fsm_workloads/random_moveChunk_timeseries_updates.js1
-rw-r--r--jstests/core/timeseries/libs/timeseries.js26
-rw-r--r--jstests/core/timeseries/timeseries_delete.js5
-rw-r--r--jstests/core/timeseries/timeseries_delete_concurrent.js5
-rw-r--r--jstests/core/timeseries/timeseries_delete_hint.js5
-rw-r--r--jstests/core/timeseries/timeseries_insert_after_delete.js5
-rw-r--r--jstests/core/timeseries/timeseries_insert_after_update.js5
-rw-r--r--jstests/core/timeseries/timeseries_lastpoint.js5
-rw-r--r--jstests/core/timeseries/timeseries_lastpoint_top.js5
-rw-r--r--jstests/core/timeseries/timeseries_update.js5
-rw-r--r--jstests/core/timeseries/timeseries_update_concurrent.js5
-rw-r--r--jstests/core/timeseries/timeseries_update_hint.js5
-rw-r--r--jstests/libs/feature_flag_util.js118
-rw-r--r--jstests/multiVersion/genericSetFCVUsage/upgrade_downgrade_sharded_cluster.js2
-rw-r--r--jstests/noPassthrough/timeseries_compression_fail.js6
-rw-r--r--jstests/noPassthrough/timeseries_update_delete_transaction.js6
-rw-r--r--jstests/sharding/move_primary_basic.js2
-rw-r--r--jstests/sharding/move_primary_clone.js2
-rw-r--r--jstests/sharding/move_primary_with_writes.js3
-rw-r--r--jstests/sharding/timeseries_multiple_mongos.js3
-rw-r--r--jstests/sharding/timeseries_update.js7
-rw-r--r--jstests/sharding/timeseries_update_routing.js7
23 files changed, 123 insertions, 111 deletions
diff --git a/jstests/concurrency/fsm_workloads/random_moveChunk_timeseries_deletes.js b/jstests/concurrency/fsm_workloads/random_moveChunk_timeseries_deletes.js
index f38b9191310..3dd6588ef68 100644
--- a/jstests/concurrency/fsm_workloads/random_moveChunk_timeseries_deletes.js
+++ b/jstests/concurrency/fsm_workloads/random_moveChunk_timeseries_deletes.js
@@ -39,7 +39,6 @@ var $config = extendWorkload($config, function($config, $super) {
$super.states.init.call(this, db, collName, connCache);
this.featureFlagDisabled = this.featureFlagDisabled ||
- !TimeseriesTest.timeseriesUpdatesAndDeletesEnabled(db) ||
!TimeseriesTest.shardedTimeseriesUpdatesAndDeletesEnabled(db);
if (this.featureFlagDisabled) {
jsTestLog(
diff --git a/jstests/concurrency/fsm_workloads/random_moveChunk_timeseries_updates.js b/jstests/concurrency/fsm_workloads/random_moveChunk_timeseries_updates.js
index d020043fb2a..7046ebac1ed 100644
--- a/jstests/concurrency/fsm_workloads/random_moveChunk_timeseries_updates.js
+++ b/jstests/concurrency/fsm_workloads/random_moveChunk_timeseries_updates.js
@@ -21,7 +21,6 @@ load('jstests/concurrency/fsm_workloads/random_moveChunk_timeseries_inserts.js')
var $config = extendWorkload($config, function($config, $super) {
$config.states.init = function(db, collName, connCache) {
if (TimeseriesTest.shardedtimeseriesCollectionsEnabled(db) &&
- TimeseriesTest.timeseriesUpdatesAndDeletesEnabled(db) &&
TimeseriesTest.shardedTimeseriesUpdatesAndDeletesEnabled(db)) {
this.featureFlagDisabled = false;
} else {
diff --git a/jstests/core/timeseries/libs/timeseries.js b/jstests/core/timeseries/libs/timeseries.js
index d1299096acc..ed82d6cbda6 100644
--- a/jstests/core/timeseries/libs/timeseries.js
+++ b/jstests/core/timeseries/libs/timeseries.js
@@ -34,39 +34,33 @@ var TimeseriesTest = class {
/**
* Returns whether time-series scalability improvements (like bucket reopening) are enabled.
+ * TODO SERVER-66438 remove this helper.
*/
static timeseriesScalabilityImprovementsEnabled(conn) {
- return FeatureFlagUtil.isEnabled(conn, "TimeseriesScalabilityImprovements");
- }
-
- /**
- * Returns whether time-series updates and deletes are supported.
- */
- static timeseriesUpdatesAndDeletesEnabled(conn) {
- return FeatureFlagUtil.isEnabled(conn, "TimeseriesUpdatesAndDeletes");
+ return FeatureFlagUtil.isPresentAndEnabled(conn, "TimeseriesScalabilityImprovements");
}
/**
* Returns whether sharded time-series updates and deletes are supported.
+ * TODO SERVER-69320 remove this helper.
*/
static shardedTimeseriesUpdatesAndDeletesEnabled(conn) {
- return FeatureFlagUtil.isEnabled(conn, "ShardedTimeSeriesUpdateDelete");
+ return FeatureFlagUtil.isPresentAndEnabled(conn, "ShardedTimeSeriesUpdateDelete");
}
+ // TODO SERVER-69320 remove this helper.
static shardedtimeseriesCollectionsEnabled(conn) {
- return FeatureFlagUtil.isEnabled(conn, "ShardedTimeSeries");
- }
-
- static shardedTimeseriesUpdatesAndDeletesEnabled(conn) {
- return FeatureFlagUtil.isEnabled(conn, "ShardedTimeSeriesUpdateDelete");
+ return FeatureFlagUtil.isPresentAndEnabled(conn, "ShardedTimeSeries");
}
+ // TODO SERVER-65082 remove this helper.
static timeseriesMetricIndexesEnabled(conn) {
- return FeatureFlagUtil.isEnabled(conn, "TimeseriesMetricIndexes");
+ return FeatureFlagUtil.isPresentAndEnabled(conn, "TimeseriesMetricIndexes");
}
+ // TODO SERVER-69324 remove this helper.
static bucketUnpackWithSortEnabled(conn) {
- return FeatureFlagUtil.isEnabled(conn, "BucketUnpackWithSort");
+ return FeatureFlagUtil.isPresentAndEnabled(conn, "BucketUnpackWithSort");
}
/**
diff --git a/jstests/core/timeseries/timeseries_delete.js b/jstests/core/timeseries/timeseries_delete.js
index ba7e7d46950..6d40ac89d9b 100644
--- a/jstests/core/timeseries/timeseries_delete.js
+++ b/jstests/core/timeseries/timeseries_delete.js
@@ -15,11 +15,6 @@ load("jstests/core/timeseries/libs/timeseries.js");
load("jstests/core/timeseries/libs/timeseries.js"); // For 'TimeseriesTest'.
load("jstests/libs/fixture_helpers.js"); // For 'FixtureHelpers'.
-if (!TimeseriesTest.timeseriesUpdatesAndDeletesEnabled(db.getMongo())) {
- jsTestLog("Skipping test because the time-series updates and deletes feature flag is disabled");
- return;
-}
-
if (FixtureHelpers.isMongos(db) &&
TimeseriesTest.shardedtimeseriesCollectionsEnabled(db.getMongo()) &&
!TimeseriesTest.shardedTimeseriesUpdatesAndDeletesEnabled(db.getMongo())) {
diff --git a/jstests/core/timeseries/timeseries_delete_concurrent.js b/jstests/core/timeseries/timeseries_delete_concurrent.js
index 08312a40299..290e6f22f73 100644
--- a/jstests/core/timeseries/timeseries_delete_concurrent.js
+++ b/jstests/core/timeseries/timeseries_delete_concurrent.js
@@ -25,11 +25,6 @@ load("jstests/core/timeseries/libs/timeseries.js");
load("jstests/libs/curop_helpers.js");
load('jstests/libs/parallel_shell_helpers.js');
-if (!TimeseriesTest.timeseriesUpdatesAndDeletesEnabled(db.getMongo())) {
- jsTestLog("Skipping test because the time-series updates and deletes feature flag is disabled");
- return;
-}
-
const timeFieldName = "time";
const metaFieldName = "tag";
const collName = 't';
diff --git a/jstests/core/timeseries/timeseries_delete_hint.js b/jstests/core/timeseries/timeseries_delete_hint.js
index c28a5f96d01..187173f48d4 100644
--- a/jstests/core/timeseries/timeseries_delete_hint.js
+++ b/jstests/core/timeseries/timeseries_delete_hint.js
@@ -24,11 +24,6 @@ load("jstests/libs/curop_helpers.js");
load("jstests/libs/feature_flag_util.js");
load('jstests/libs/parallel_shell_helpers.js');
-if (!FeatureFlagUtil.isEnabled(db, "TimeseriesUpdatesAndDeletes")) {
- jsTestLog("Skipping test because the time-series updates and deletes feature flag is disabled");
- return;
-}
-
const timeFieldName = "time";
const metaFieldName = "tag";
const collName = 't';
diff --git a/jstests/core/timeseries/timeseries_insert_after_delete.js b/jstests/core/timeseries/timeseries_insert_after_delete.js
index ca5874820e8..cffe0c7c91d 100644
--- a/jstests/core/timeseries/timeseries_insert_after_delete.js
+++ b/jstests/core/timeseries/timeseries_insert_after_delete.js
@@ -14,11 +14,6 @@
load("jstests/core/timeseries/libs/timeseries.js"); // For 'TimeseriesTest'.
load("jstests/libs/fixture_helpers.js"); // For 'FixtureHelpers'.
-if (!TimeseriesTest.timeseriesUpdatesAndDeletesEnabled(db.getMongo())) {
- jsTestLog("Skipping test because the time-series updates and deletes feature flag is disabled");
- return;
-}
-
if (FixtureHelpers.isMongos(db) &&
!TimeseriesTest.shardedTimeseriesUpdatesAndDeletesEnabled(db.getMongo())) {
jsTestLog(
diff --git a/jstests/core/timeseries/timeseries_insert_after_update.js b/jstests/core/timeseries/timeseries_insert_after_update.js
index 193cdc9d6c9..196ccae2149 100644
--- a/jstests/core/timeseries/timeseries_insert_after_update.js
+++ b/jstests/core/timeseries/timeseries_insert_after_update.js
@@ -20,11 +20,6 @@
load("jstests/core/timeseries/libs/timeseries.js");
load("jstests/libs/fixture_helpers.js");
-if (!TimeseriesTest.timeseriesUpdatesAndDeletesEnabled(db.getMongo())) {
- jsTestLog("Skipping test because the time-series updates and deletes feature flag is disabled");
- return;
-}
-
if (FixtureHelpers.isMongos(db) &&
!TimeseriesTest.shardedtimeseriesCollectionsEnabled(db.getMongo())) {
jsTestLog("Skipping test because the time-series updates and deletes feature flag is disabled");
diff --git a/jstests/core/timeseries/timeseries_lastpoint.js b/jstests/core/timeseries/timeseries_lastpoint.js
index c6469736c09..f3ea1f5c093 100644
--- a/jstests/core/timeseries/timeseries_lastpoint.js
+++ b/jstests/core/timeseries/timeseries_lastpoint.js
@@ -24,11 +24,6 @@ load("jstests/libs/analyze_plan.js");
const testDB = TimeseriesAggTests.getTestDb();
assert.commandWorked(testDB.dropDatabase());
-// Do not run the rest of the tests if the lastpoint optimization is disabled.
-if (!FeatureFlagUtil.isEnabled(db, "LastPointQuery")) {
- return;
-}
-
/**
* Returns a lastpoint $group stage of the form:
* {$group: {
diff --git a/jstests/core/timeseries/timeseries_lastpoint_top.js b/jstests/core/timeseries/timeseries_lastpoint_top.js
index 14260a6efda..f6a93b70919 100644
--- a/jstests/core/timeseries/timeseries_lastpoint_top.js
+++ b/jstests/core/timeseries/timeseries_lastpoint_top.js
@@ -27,8 +27,9 @@ load("jstests/libs/feature_flag_util.js");
const testDB = TimeseriesAggTests.getTestDb();
assert.commandWorked(testDB.dropDatabase());
-// Do not run the rest of the tests if the lastpoint optimization is disabled.
-if (!FeatureFlagUtil.isEnabled(db, "LastPointQuery")) {
+// TODO SERVER-73509 The test doesn't work yet, even though this feature flag is gone.
+if (true /* previously guarded by featureFlagLastPointQuery */) {
+ jsTestLog("Skipping the test.");
return;
}
diff --git a/jstests/core/timeseries/timeseries_update.js b/jstests/core/timeseries/timeseries_update.js
index a223d34763a..9eca3ee44fd 100644
--- a/jstests/core/timeseries/timeseries_update.js
+++ b/jstests/core/timeseries/timeseries_update.js
@@ -16,11 +16,6 @@
load("jstests/core/timeseries/libs/timeseries.js");
load("jstests/libs/fixture_helpers.js");
-if (!TimeseriesTest.timeseriesUpdatesAndDeletesEnabled(db.getMongo())) {
- jsTestLog("Skipping test because the time-series updates and deletes feature flag is disabled");
- return;
-}
-
if (FixtureHelpers.isMongos(db) &&
!TimeseriesTest.shardedtimeseriesCollectionsEnabled(db.getMongo())) {
jsTestLog("Skipping test because the sharded time-series feature flag is disabled");
diff --git a/jstests/core/timeseries/timeseries_update_concurrent.js b/jstests/core/timeseries/timeseries_update_concurrent.js
index d48e6dc28e3..c6a7b41aadf 100644
--- a/jstests/core/timeseries/timeseries_update_concurrent.js
+++ b/jstests/core/timeseries/timeseries_update_concurrent.js
@@ -28,11 +28,6 @@ load("jstests/core/timeseries/libs/timeseries.js");
load("jstests/libs/curop_helpers.js");
load("jstests/libs/parallel_shell_helpers.js");
-if (!TimeseriesTest.timeseriesUpdatesAndDeletesEnabled(db.getMongo())) {
- jsTestLog("Skipping test because the time-series updates and deletes feature flag is disabled");
- return;
-}
-
const timeFieldName = "time";
const metaFieldName = "tag";
const collName = 't';
diff --git a/jstests/core/timeseries/timeseries_update_hint.js b/jstests/core/timeseries/timeseries_update_hint.js
index 885850fc009..98ecca8e872 100644
--- a/jstests/core/timeseries/timeseries_update_hint.js
+++ b/jstests/core/timeseries/timeseries_update_hint.js
@@ -26,11 +26,6 @@ load("jstests/core/timeseries/libs/timeseries.js");
load("jstests/libs/curop_helpers.js");
load('jstests/libs/parallel_shell_helpers.js');
-if (!TimeseriesTest.timeseriesUpdatesAndDeletesEnabled(db.getMongo())) {
- jsTestLog("Skipping test because the time-series updates and deletes feature flag is disabled");
- return;
-}
-
const timeFieldName = "time";
const metaFieldName = "tag";
const dateTime = ISODate("2021-01-01T18:00:00Z");
diff --git a/jstests/libs/feature_flag_util.js b/jstests/libs/feature_flag_util.js
index 4ebb5ef23be..d14c1dbfcfa 100644
--- a/jstests/libs/feature_flag_util.js
+++ b/jstests/libs/feature_flag_util.js
@@ -5,15 +5,29 @@ load("jstests/libs/fixture_helpers.js");
/**
* Utilities for feature flags.
*/
-var FeatureFlagUtil = class {
+var FeatureFlagUtil = (function() {
+ // A JS attempt at an enum.
+ const FlagStatus = {
+ kEnabled: 'kEnabled',
+ kDisabled: 'kDisabled',
+ kNotFound: 'kNotFound',
+ };
+
/**
- * If 'ignoreFCV' is true, return whether or not the given feature flag is enabled,
- * regardless of the current FCV version (this is used when a feature flag needs to be enabled
- * in downgraded FCV versions).
- * If 'ignoreFCV' is false or null, we only return true if the flag is enabled and this FCV
- * version is greater or equal to the required version for the flag.
+ * @param 'featureFlag' - the name of the flag you want to check, but *without* the
+ * 'featureFlag' prefix. For example, just "Toaster" instead of "featureFlagToaster."
+ *
+ * @param 'ignoreFcv' - If true, return whether or not the given feature flag is enabled,
+ * regardless of the current FCV version. This is used when a feature flag needs to be
+ * enabled in downgraded FCV versions. If 'ignoreFCV' is false or null, we only return true
+ * if the flag is enabled and this FCV version is greater or equal to the required version
+ * for the flag.
+ *
+ * @returns one of the 'FlagStatus' values indicating whether the flag is enabled, disabled, or
+ * not found. A flag may be not found because it was recently deleted or because the test is
+ * running on an older mongod version for example.
*/
- static isEnabled(db, featureFlag, user, ignoreFCV) {
+ function getStatus(db, featureFlag, user, ignoreFCV) {
// In order to get an accurate answer for whether a feature flag is enabled, we need to ask
// a mongod. If db represents a connection to mongos, or some other configuration, we need
// to obtain the correct connection to a mongod.
@@ -41,20 +55,96 @@ var FeatureFlagUtil = class {
const fcvDoc = assert.commandWorked(
conn.adminCommand({getParameter: 1, featureCompatibilityVersion: 1}));
+ assert(fcvDoc.hasOwnProperty("featureCompatibilityVersion"), fcvDoc);
const fullFlagName = `featureFlag${featureFlag}`;
const flagDoc = conn.adminCommand({getParameter: 1, [fullFlagName]: 1});
- if (!flagDoc.ok) {
+ if (!flagDoc.ok || !flagDoc.hasOwnProperty(fullFlagName)) {
// Feature flag not found.
- assert.eq(flagDoc.errmsg, "no option found to get");
- return false;
+ if (!flagDoc.ok) {
+ assert.eq(flagDoc.errmsg, "no option found to get");
+ }
+ return FlagStatus.kNotFound;
}
- const flagIsEnabled = flagDoc.hasOwnProperty(fullFlagName) && flagDoc[fullFlagName].value;
- const flagVersionIsValid = !fcvDoc.hasOwnProperty("featureCompatibilityVersion") ||
+ const flagIsEnabled = flagDoc[fullFlagName].value;
+ const flagVersionIsValid =
MongoRunner.compareBinVersions(fcvDoc.featureCompatibilityVersion.version,
flagDoc[fullFlagName].version) >= 0;
- return flagIsEnabled && (ignoreFCV || flagVersionIsValid);
+ if (flagIsEnabled && (ignoreFCV || flagVersionIsValid)) {
+ return FlagStatus.kEnabled;
+ }
+ return FlagStatus.kDisabled;
+ }
+
+ /**
+ * @param 'featureFlag' - the name of the flag you want to check, but *without* the
+ * 'featureFlag' prefix. For example, just "Toaster" instead of "featureFlagToaster."
+ *
+ * Wrapper around 'getStatus' - see that function for more details on the arguemnts.
+ *
+ * This wrapper checks for 'kEnabled' but raises an error for 'kNotFound' - if the flag is not
+ * known. This can be useful if you want to gate an entire test on a feature flag like so:
+ * if (!FeatureFlagUtils.isEnabled(db, "myFlag")) {
+ * jsTestLog("Skipping test because my flag is not enabled");
+ * return;
+ * }
+ *
+ * The advantage of this throwing API is that such a test will start complaining in evergreen
+ * when you delete the feature flag, rather than passing by not actually running any assertions.
+ */
+ function isEnabled(db, featureFlag, user, ignoreFCV) {
+ let status = getStatus(db, featureFlag, user, ignoreFCV);
+ assert(
+ status != FlagStatus.kNotFound,
+ `You asked about a feature flag ${featureFlag} which wasn't present. If this is a ` +
+ "multiversion test and you want the coverage despite the flag not existing on an " +
+ "older version, consider using 'isPresentAndEnabled()' instead of 'isEnabled()'");
+ return status == FlagStatus.kEnabled;
+ }
+
+ /**
+ *
+ * Wrapper around 'getStatus' - see that function for more details on the arguemnts.
+ *
+ * @param 'featureFlag' - the name of the flag you want to check, but *without* the
+ * 'featureFlag' prefix. For example, just "Toaster" instead of "featureFlagToaster."
+ *
+ * @returns true if the provided feature flag is known and also enabled. Returns false otherwise
+ * (either disabled or not known), unlike 'isEnabled()' which would raise an error if the
+ * flag is not found.
+ *
+ * This can be useful if you'd like to have your test conditionally add extra assertions, or
+ * conditionally change the assertion being made, like so:
+ *
+ * // TODO SERVER-XYZ remove 'featureFlagMyFlag'.
+ * if (FeatureFlagUtils.isPresentAndEnabled(db, "MyFlag")) {
+ * // I expect to see some new return value.
+ * } else {
+ * // I expect *not* to see some return value.
+ * }
+ *
+ * Note that this API should always be used with an accompanying TODO like the one in the
+ * example above. This is because it is all too easy to have a test like so which will silently
+ * stop testing anything if we remove the feature flag without updating the test:
+ *
+ * if (FeatureFlagUtils.isPresentAndEnabled(db, "MyFlag")) {
+ * // Assert on something new.
+ * }
+ * // No else clause.
+ *
+ * That code is dangerous because we may forget to delete it when "featureFlagMyFlag" is
+ * removed, and the test would keep passing but stop testing.
+ */
+ function isPresentAndEnabled(db, featureFlag, user, ignoreFCV) {
+ return getStatus(db, featureFlag, user, ignoreFCV) == FlagStatus.kEnabled;
}
-};
+
+ return {
+ FlagStatus: FlagStatus,
+ isEnabled: isEnabled,
+ isPresentAndEnabled: isPresentAndEnabled,
+ getStatus: getStatus,
+ };
+})();
diff --git a/jstests/multiVersion/genericSetFCVUsage/upgrade_downgrade_sharded_cluster.js b/jstests/multiVersion/genericSetFCVUsage/upgrade_downgrade_sharded_cluster.js
index 8463454a8c6..1d17a15ff93 100644
--- a/jstests/multiVersion/genericSetFCVUsage/upgrade_downgrade_sharded_cluster.js
+++ b/jstests/multiVersion/genericSetFCVUsage/upgrade_downgrade_sharded_cluster.js
@@ -49,7 +49,7 @@ function checkConfigVersionDoc() {
// TODO: SERVER-68889 remove this function once 7.0 becomes last LTS
const versionDoc = st.s.getCollection('config.version').findOne();
- if (FeatureFlagUtil.isEnabled(st.s, "StopUsingConfigVersion")) {
+ if (FeatureFlagUtil.isPresentAndEnabled(st.s, "StopUsingConfigVersion")) {
// Check that the version doc doesn't contain any of the deprecatedFields
const deprecatedFields = [
"excluding",
diff --git a/jstests/noPassthrough/timeseries_compression_fail.js b/jstests/noPassthrough/timeseries_compression_fail.js
index 5ab5c79c3fb..4b7ffa85a21 100644
--- a/jstests/noPassthrough/timeseries_compression_fail.js
+++ b/jstests/noPassthrough/timeseries_compression_fail.js
@@ -13,12 +13,6 @@ const dbName = jsTestName();
const db = conn.getDB(dbName);
const coll = db.getCollection('t');
-// Only run test when bucket compression is enabled
-if (!FeatureFlagUtil.isEnabled(db, "TimeseriesBucketCompression")) {
- MongoRunner.stopMongod(conn);
- return;
-}
-
// Assumes each bucket has a limit of 1000 measurements.
const bucketMaxCount = 1000;
const numDocs = bucketMaxCount + 100;
diff --git a/jstests/noPassthrough/timeseries_update_delete_transaction.js b/jstests/noPassthrough/timeseries_update_delete_transaction.js
index c63cb966cf0..3bf3a1dd3c4 100644
--- a/jstests/noPassthrough/timeseries_update_delete_transaction.js
+++ b/jstests/noPassthrough/timeseries_update_delete_transaction.js
@@ -15,12 +15,6 @@ rst.startSet();
rst.initiate();
const testDB = rst.getPrimary().getDB(jsTestName());
-if (!TimeseriesTest.timeseriesUpdatesAndDeletesEnabled(testDB.getMongo())) {
- jsTestLog("Skipping test because the time-series updates and deletes feature flag is disabled");
- rst.stopSet();
- return;
-}
-
const metaFieldName = "meta";
const timeFieldName = "time";
const collectionName = "t";
diff --git a/jstests/sharding/move_primary_basic.js b/jstests/sharding/move_primary_basic.js
index 12ccdf7b2ed..5dc2216b4dd 100644
--- a/jstests/sharding/move_primary_basic.js
+++ b/jstests/sharding/move_primary_basic.js
@@ -107,7 +107,7 @@ jsTest.log('Test that only unsharded collections are moved');
}
// TODO (SERVER-71309): Remove once 7.0 becomes last LTS.
-if (FeatureFlagUtil.isEnabled(config.admin, 'ResilientMovePrimary')) {
+if (FeatureFlagUtil.isPresentAndEnabled(config.admin, 'ResilientMovePrimary')) {
jsTest.log('Test that orphaned documents on recipient causes the operation to fail');
// Insert an orphaned document on shard1.
diff --git a/jstests/sharding/move_primary_clone.js b/jstests/sharding/move_primary_clone.js
index a2ccc7eabac..5f6d75f1abd 100644
--- a/jstests/sharding/move_primary_clone.js
+++ b/jstests/sharding/move_primary_clone.js
@@ -193,7 +193,7 @@ function movePrimaryWithFailpoint(sharded) {
ErrorCodes.InvalidOptions);
} else {
// TODO (SERVER-71309): Remove once 7.0 becomes last LTS.
- if (!FeatureFlagUtil.isEnabled(db, 'ResilientMovePrimary')) {
+ if (!FeatureFlagUtil.isPresentAndEnabled(db, 'ResilientMovePrimary')) {
// If the collections are unsharded, we should fail when any collections being copied
// exist on the target shard.
assert.commandFailed(st.s0.adminCommand({movePrimary: "test1", to: toShard.name}));
diff --git a/jstests/sharding/move_primary_with_writes.js b/jstests/sharding/move_primary_with_writes.js
index a4b168b5338..86aef4084b7 100644
--- a/jstests/sharding/move_primary_with_writes.js
+++ b/jstests/sharding/move_primary_with_writes.js
@@ -289,7 +289,8 @@ st.forEachConnection(shard => {
let cloningDataFPName = "hangBeforeCloningData";
// TODO (SERVER-71309): Remove once 7.0 becomes last LTS.
-if (!FeatureFlagUtil.isEnabled(st.configRS.getPrimary().getDB('admin'), "ResilientMovePrimary")) {
+if (!FeatureFlagUtil.isPresentAndEnabled(st.configRS.getPrimary().getDB('admin'),
+ "ResilientMovePrimary")) {
cloningDataFPName = "hangInCloneStage";
}
diff --git a/jstests/sharding/timeseries_multiple_mongos.js b/jstests/sharding/timeseries_multiple_mongos.js
index e5d75cdc384..af8e154baf1 100644
--- a/jstests/sharding/timeseries_multiple_mongos.js
+++ b/jstests/sharding/timeseries_multiple_mongos.js
@@ -290,8 +290,7 @@ runTest({
numProfilerEntries: {sharded: 1, unsharded: 1},
});
-if (TimeseriesTest.timeseriesUpdatesAndDeletesEnabled(st.shard0) &&
- TimeseriesTest.shardedTimeseriesUpdatesAndDeletesEnabled(st.shard0)) {
+if (TimeseriesTest.shardedTimeseriesUpdatesAndDeletesEnabled(st.shard0)) {
// Tests for updates.
runTest({
shardKey: {[metaField + ".a"]: 1},
diff --git a/jstests/sharding/timeseries_update.js b/jstests/sharding/timeseries_update.js
index 96531a09c56..7846fdaf159 100644
--- a/jstests/sharding/timeseries_update.js
+++ b/jstests/sharding/timeseries_update.js
@@ -35,13 +35,6 @@ if (!TimeseriesTest.shardedtimeseriesCollectionsEnabled(st.shard0)) {
return;
}
-if (!TimeseriesTest.timeseriesUpdatesAndDeletesEnabled(st.shard0)) {
- jsTestLog(
- "Skipping test because the updates and deletes on time-series collection feature flag is disabled");
- st.stop();
- return;
-}
-
const testDB = mongos.getDB(dbName);
testDB.dropDatabase();
assert.commandWorked(mongos.adminCommand({enableSharding: dbName}));
diff --git a/jstests/sharding/timeseries_update_routing.js b/jstests/sharding/timeseries_update_routing.js
index 384882f983a..d2a838c1831 100644
--- a/jstests/sharding/timeseries_update_routing.js
+++ b/jstests/sharding/timeseries_update_routing.js
@@ -33,13 +33,6 @@ if (!TimeseriesTest.shardedtimeseriesCollectionsEnabled(st.shard0)) {
return;
}
-if (!TimeseriesTest.timeseriesUpdatesAndDeletesEnabled(st.shard0)) {
- jsTestLog(
- "Skipping test because the updates and deletes on time-series collection feature flag is disabled");
- st.stop();
- return;
-}
-
if (!TimeseriesTest.shardedTimeseriesUpdatesAndDeletesEnabled(st.shard0)) {
jsTestLog(
"Skipping test because the updates and deletes on sharded time-series collection feature flag is disabled");