summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Guo <robert.guo@mongodb.com>2021-11-04 11:00:09 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-11-04 11:23:33 +0000
commit7bff1ee135ec1520ed4ef7265e6705757e6432e7 (patch)
tree10ad17cb321c6a9fc61f409ae76bb48950c3edd4
parentac364ad8d49c2b0e441065c23bf57b5de6fa0f67 (diff)
downloadmongo-7bff1ee135ec1520ed4ef7265e6705757e6432e7.tar.gz
SERVER-61225 fix feature flag definition for standalone fixtures
-rw-r--r--buildscripts/resmokelib/configure_resmoke.py5
-rw-r--r--buildscripts/resmokelib/testing/fixtures/_builder.py10
-rw-r--r--buildscripts/resmokelib/testing/fixtures/fixturelib.py1
-rw-r--r--buildscripts/resmokelib/testing/fixtures/shardedcluster.py6
-rw-r--r--buildscripts/resmokelib/testing/fixtures/standalone.py9
5 files changed, 18 insertions, 13 deletions
diff --git a/buildscripts/resmokelib/configure_resmoke.py b/buildscripts/resmokelib/configure_resmoke.py
index 3b624fdcbc9..60f9ce2acfe 100644
--- a/buildscripts/resmokelib/configure_resmoke.py
+++ b/buildscripts/resmokelib/configure_resmoke.py
@@ -262,12 +262,7 @@ def _update_config_vars(values): # pylint: disable=too-many-statements,too-many
_config.CONFIG_FUZZ_SEED, _config.MONGOD_SET_PARAMETERS)
_config.MONGOS_EXECUTABLE = _expand_user(config.pop("mongos_executable"))
-
mongos_set_parameters = config.pop("mongos_set_parameters")
- if _config.ENABLED_FEATURE_FLAGS and not _config.MIXED_BIN_VERSIONS:
- feature_flag_dict = {ff: "true" for ff in _config.ENABLED_FEATURE_FLAGS}
- mongos_set_parameters.append(str(feature_flag_dict))
-
_config.MONGOS_SET_PARAMETERS = _merge_set_params(mongos_set_parameters)
_config.MONGOCRYPTD_SET_PARAMETERS = _merge_set_params(config.pop("mongocryptd_set_parameters"))
diff --git a/buildscripts/resmokelib/testing/fixtures/_builder.py b/buildscripts/resmokelib/testing/fixtures/_builder.py
index fc4215b807e..e9197d9775b 100644
--- a/buildscripts/resmokelib/testing/fixtures/_builder.py
+++ b/buildscripts/resmokelib/testing/fixtures/_builder.py
@@ -32,6 +32,13 @@ def make_fixture(class_name, logger, job_num, *args, **kwargs):
if class_name not in _FIXTURES:
raise ValueError("Unknown fixture class '%s'" % class_name)
+
+ # Special case MongoDFixture or _MongosFixture for now since we only add one option.
+ # If there's more logic, we should add a builder class for them.
+ if class_name in ["MongoDFixture", "_MongoSFixture"]:
+ return _FIXTURES[class_name](logger, job_num, fixturelib, *args,
+ add_feature_flags=bool(config.ENABLED_FEATURE_FLAGS), **kwargs)
+
return _FIXTURES[class_name](logger, job_num, fixturelib, *args, **kwargs)
@@ -183,9 +190,6 @@ class ReplSetBuilder(FixtureBuilder):
new_fixture_port = old_fixture.port
new_fixture_mongod_options = replset.get_options_for_mongod(replset_node_index)
- if config.ENABLED_FEATURE_FLAGS is not None:
- for ff in config.ENABLED_FEATURE_FLAGS:
- new_fixture_mongod_options["set_parameters"][ff] = True
new_fixture = make_fixture(classes[BinVersionEnum.NEW], mongod_logger, replset.job_num,
mongod_executable=executables[BinVersionEnum.NEW],
diff --git a/buildscripts/resmokelib/testing/fixtures/fixturelib.py b/buildscripts/resmokelib/testing/fixtures/fixturelib.py
index 5451c301ee7..d5c715b6b37 100644
--- a/buildscripts/resmokelib/testing/fixtures/fixturelib.py
+++ b/buildscripts/resmokelib/testing/fixtures/fixturelib.py
@@ -113,6 +113,7 @@ class _FixtureConfig(object): # pylint: disable=too-many-instance-attributes
self.LAST_CONTINUOUS_MONGOD_BINARY = LAST_CONTINUOUS_MONGOD_BINARY
self.LAST_CONTINUOUS_MONGOS_BINARY = LAST_CONTINUOUS_MONGOS_BINARY
self.USE_LEGACY_MULTIVERSION = config.USE_LEGACY_MULTIVERSION
+ self.ENABLED_FEATURE_FLAGS = config.ENABLED_FEATURE_FLAGS
self.EVERGREEN_TASK_ID = config.EVERGREEN_TASK_ID
self.FLOW_CONTROL = config.FLOW_CONTROL
self.FLOW_CONTROL_TICKETS = config.FLOW_CONTROL_TICKETS
diff --git a/buildscripts/resmokelib/testing/fixtures/shardedcluster.py b/buildscripts/resmokelib/testing/fixtures/shardedcluster.py
index fcb23ec47f7..354dfd290f0 100644
--- a/buildscripts/resmokelib/testing/fixtures/shardedcluster.py
+++ b/buildscripts/resmokelib/testing/fixtures/shardedcluster.py
@@ -373,7 +373,7 @@ class _MongoSFixture(interface.Fixture):
# pylint: disable=too-many-arguments
def __init__(self, logger, job_num, fixturelib, dbpath_prefix, mongos_executable=None,
- mongos_options=None):
+ mongos_options=None, add_feature_flags=False):
"""Initialize _MongoSFixture."""
interface.Fixture.__init__(self, logger, job_num, fixturelib)
@@ -388,6 +388,10 @@ class _MongoSFixture(interface.Fixture):
self.mongos_options = self.fixturelib.make_historic(
self.fixturelib.default_if_none(mongos_options, {})).copy()
+ if add_feature_flags:
+ for ff in self.config.ENABLED_FEATURE_FLAGS:
+ self.mongos_options["set_parameters"][ff] = "true"
+
self.mongos = None
self.port = fixturelib.get_next_port(job_num)
self.mongos_options["port"] = self.port
diff --git a/buildscripts/resmokelib/testing/fixtures/standalone.py b/buildscripts/resmokelib/testing/fixtures/standalone.py
index 136569a5f02..111fbce6990 100644
--- a/buildscripts/resmokelib/testing/fixtures/standalone.py
+++ b/buildscripts/resmokelib/testing/fixtures/standalone.py
@@ -17,12 +17,16 @@ class MongoDFixture(interface.Fixture):
def __init__( # pylint: disable=too-many-arguments
self, logger, job_num, fixturelib, mongod_executable=None, mongod_options=None,
- dbpath_prefix=None, preserve_dbpath=False, port=None):
+ add_feature_flags=False, dbpath_prefix=None, preserve_dbpath=False, port=None):
"""Initialize MongoDFixture with different options for the mongod process."""
interface.Fixture.__init__(self, logger, job_num, fixturelib, dbpath_prefix=dbpath_prefix)
self.mongod_options = self.fixturelib.make_historic(
self.fixturelib.default_if_none(mongod_options, {}))
+ if add_feature_flags:
+ for ff in self.config.ENABLED_FEATURE_FLAGS:
+ self.mongod_options["set_parameters"][ff] = "true"
+
if "dbpath" in self.mongod_options and dbpath_prefix is not None:
raise ValueError("Cannot specify both mongod_options.dbpath and dbpath_prefix")
@@ -30,9 +34,6 @@ class MongoDFixture(interface.Fixture):
self.mongod_executable = self.fixturelib.default_if_none(mongod_executable,
self.config.MONGOD_EXECUTABLE)
- self.mongod_options = self.fixturelib.make_historic(
- self.fixturelib.default_if_none(mongod_options, {})).copy()
-
# The dbpath in mongod_options takes precedence over other settings to make it easier for
# users to specify a dbpath containing data to test against.
if "dbpath" not in self.mongod_options: