diff options
author | Robert Guo <robert.guo@mongodb.com> | 2021-05-12 12:36:31 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-05-13 16:37:28 +0000 |
commit | 00c3b89b64e953d9d6907891b53f00c6c2fe23fa (patch) | |
tree | 885014a75ed25352765141135c64108937c8c390 | |
parent | 859d7208223ea0cb03270f6dcc9491a1afbd18fd (diff) | |
download | mongo-00c3b89b64e953d9d6907891b53f00c6c2fe23fa.tar.gz |
SERVER-56744 list feature flags for local usage
-rw-r--r-- | buildscripts/resmokelib/config.py | 3 | ||||
-rw-r--r-- | buildscripts/resmokelib/configure_resmoke.py | 35 | ||||
-rw-r--r-- | buildscripts/resmokelib/run/__init__.py | 7 |
3 files changed, 26 insertions, 19 deletions
diff --git a/buildscripts/resmokelib/config.py b/buildscripts/resmokelib/config.py index 24568f683ef..acc4036eab2 100644 --- a/buildscripts/resmokelib/config.py +++ b/buildscripts/resmokelib/config.py @@ -356,6 +356,9 @@ INSTALL_DIR = None # Whether to run tests for feature flags. RUN_ALL_FEATURE_FLAG_TESTS = None +# List of enabled feature flags. +ENABLED_FEATURE_FLAGS = [] + # The path to the mongo executable used by resmoke.py. MONGO_EXECUTABLE = None diff --git a/buildscripts/resmokelib/configure_resmoke.py b/buildscripts/resmokelib/configure_resmoke.py index 69bb849a497..b0081efc86b 100644 --- a/buildscripts/resmokelib/configure_resmoke.py +++ b/buildscripts/resmokelib/configure_resmoke.py @@ -155,31 +155,29 @@ def _update_config_vars(values): # pylint: disable=too-many-statements,too-many def setup_feature_flags(): _config.RUN_ALL_FEATURE_FLAG_TESTS = config.pop("run_all_feature_flag_tests") - feature_flags = [] + all_feature_flags = [] + enabled_feature_flags = [] try: - feature_flags = open(ALL_FEATURE_FLAG_FILE).read().split() + all_feature_flags = open(ALL_FEATURE_FLAG_FILE).read().split() except FileNotFoundError: # If we ask resmoke to run with all feature flags, the feature flags file # needs to exist. if _config.RUN_ALL_FEATURE_FLAG_TESTS: raise + if _config.RUN_ALL_FEATURE_FLAG_TESTS: + enabled_feature_flags = all_feature_flags[:] + # Specify additional feature flags from the command line. # Set running all feature flag tests to True if this options is specified. additional_feature_flags = config.pop("additional_feature_flags") if additional_feature_flags is not None: - if _config.RUN_ALL_FEATURE_FLAG_TESTS: - feature_flags.extend(additional_feature_flags) - else: - feature_flags = additional_feature_flags - - # `additional_feature_flags` only determines the universal set of feature flags, - # resmoke.py is set to run with "all" feature flags regardless. - _config.RUN_ALL_FEATURE_FLAG_TESTS = True + enabled_feature_flags.extend(additional_feature_flags) - return feature_flags + return enabled_feature_flags, all_feature_flags - all_feature_flags = setup_feature_flags() + _config.ENABLED_FEATURE_FLAGS, all_feature_flags = setup_feature_flags() + not_enabled_feature_flags = list(set(all_feature_flags) - set(_config.ENABLED_FEATURE_FLAGS)) _config.ALWAYS_USE_LOG_FILES = config.pop("always_use_log_files") _config.BASE_PORT = int(config.pop("base_port")) @@ -193,9 +191,8 @@ def _update_config_vars(values): # pylint: disable=too-many-statements,too-many _config.EXCLUDE_WITH_ANY_TAGS.extend( utils.default_if_none(_tags_from_list(config.pop("exclude_with_any_tags")), [])) - # Don't run tests with feature flags if the `run_all_feature_flag_tests` is not specified. - if not _config.RUN_ALL_FEATURE_FLAG_TESTS and all_feature_flags: - _config.EXCLUDE_WITH_ANY_TAGS.extend(all_feature_flags) + # Don't run tests with feature flags that are not enabled. + _config.EXCLUDE_WITH_ANY_TAGS.extend(not_enabled_feature_flags) _config.FAIL_FAST = not config.pop("continue_on_failure") _config.FLOW_CONTROL = config.pop("flow_control") @@ -235,8 +232,8 @@ def _update_config_vars(values): # pylint: disable=too-many-statements,too-many _config.MONGOD_EXECUTABLE = _expand_user(config.pop("mongod_executable")) mongod_set_parameters = config.pop("mongod_set_parameters") - if _config.RUN_ALL_FEATURE_FLAG_TESTS: - feature_flag_dict = {ff: "true" for ff in all_feature_flags} + if _config.ENABLED_FEATURE_FLAGS: + feature_flag_dict = {ff: "true" for ff in _config.ENABLED_FEATURE_FLAGS} mongod_set_parameters.append(str(feature_flag_dict)) _config.MONGOD_SET_PARAMETERS = _merge_set_params(mongod_set_parameters) @@ -254,8 +251,8 @@ def _update_config_vars(values): # pylint: disable=too-many-statements,too-many _config.MONGOS_EXECUTABLE = _expand_user(config.pop("mongos_executable")) mongos_set_parameters = config.pop("mongos_set_parameters") - if _config.RUN_ALL_FEATURE_FLAG_TESTS: - feature_flag_dict = {ff: "true" for ff in all_feature_flags} + if _config.ENABLED_FEATURE_FLAGS: + 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) diff --git a/buildscripts/resmokelib/run/__init__.py b/buildscripts/resmokelib/run/__init__.py index 6fb13da57a3..7453aa6a4cd 100644 --- a/buildscripts/resmokelib/run/__init__.py +++ b/buildscripts/resmokelib/run/__init__.py @@ -1123,6 +1123,13 @@ def to_local_args(input_args=None): # pylint: disable=too-many-branches,too-man if origin_suite is not None: setattr(parsed_args, "suite_files", origin_suite) + # Replace --runAllFeatureFlagTests with an explicit list of feature flags. The former relies on + # all_feature_flags.txt which may not exist in the local dev environment. + run_all_feature_flag_tests = getattr(parsed_args, "run_all_feature_flag_tests", None) + if run_all_feature_flag_tests is not None: + setattr(parsed_args, "additional_feature_flags", config.ENABLED_FEATURE_FLAGS) + del parsed_args.run_all_feature_flag_tests + # The top-level parser has one subparser that contains all subcommand parsers. command_subparser = [ action for action in parser._actions # pylint: disable=protected-access |