diff options
author | David Bradford <david.bradford@mongodb.com> | 2021-01-24 21:06:36 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-01-25 19:58:02 +0000 |
commit | 5fad1f69662696c5b789392622aa34d370fb4825 (patch) | |
tree | ad794217d84b03f7aad1522ec82f64c15ee2e15f | |
parent | 951fa2b39e81b4ac88187f9cd715cb20e220367e (diff) | |
download | mongo-5fad1f69662696c5b789392622aa34d370fb4825.tar.gz |
SERVER-53960: Don't generate enterprise tests with burn_in on non-enterprise builds
(cherry picked from commit ba2320f093a1c138e250f27dcaf937f2a635b91b)
-rw-r--r-- | buildscripts/burn_in_tags.py | 26 | ||||
-rw-r--r-- | buildscripts/burn_in_tests.py | 7 | ||||
-rw-r--r-- | buildscripts/ciconfig/evergreen.py | 6 |
3 files changed, 36 insertions, 3 deletions
diff --git a/buildscripts/burn_in_tags.py b/buildscripts/burn_in_tags.py index d4e49681139..4cdcfe524ec 100644 --- a/buildscripts/burn_in_tags.py +++ b/buildscripts/burn_in_tags.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 """Generate burn in tests to run on certain build variants.""" from collections import namedtuple +import logging import os import sys from typing import Any, Dict, List @@ -24,6 +25,11 @@ from buildscripts.burn_in_tests import create_generate_tasks_config, create_test find_changed_tests, GenerateConfig, RepeatConfig, DEFAULT_REPO_LOCATIONS # pylint: enable=wrong-import-position +EXTERNAL_LOGGERS = { + "evergreen", + "git", + "urllib3", +} CONFIG_DIRECTORY = "generated_burn_in_tags_config" CONFIG_FILE = "burn_in_tags_gen.json" EVERGREEN_FILE = "etc/evergreen.yml" @@ -171,10 +177,27 @@ def burn_in(task_expansions: Dict[str, Any], evg_conf: EvergreenProjectConfig, write_file_to_dir(CONFIG_DIRECTORY, CONFIG_FILE, shrub_project.json()) +def _configure_logging(verbose: bool): + """ + Configure logging for the application. + + :param verbose: If True set log level to DEBUG. + """ + level = logging.DEBUG if verbose else logging.INFO + logging.basicConfig( + format="[%(asctime)s - %(name)s - %(levelname)s] %(message)s", + level=level, + stream=sys.stdout, + ) + for log_name in EXTERNAL_LOGGERS: + logging.getLogger(log_name).setLevel(logging.WARNING) + + @click.command() @click.option("--expansion-file", "expansion_file", required=True, help="Location of expansions file generated by evergreen.") -def main(expansion_file: str): +@click.option("--verbose", is_flag=True) +def main(expansion_file: str, verbose: bool): """ Run new or changed tests in repeated mode to validate their stability. @@ -184,6 +207,7 @@ def main(expansion_file: str): \f :param expansion_file: The expansion file containing the configuration params. """ + _configure_logging(verbose) evg_api = RetryingEvergreenApi.get_api(config_file=EVG_CONFIG_FILE) repos = [Repo(x) for x in DEFAULT_REPO_LOCATIONS if os.path.isdir(x)] expansions_file_data = read_config.read_config_file(expansion_file) diff --git a/buildscripts/burn_in_tests.py b/buildscripts/burn_in_tests.py index 7502facf6b2..9a5b1c563eb 100644 --- a/buildscripts/burn_in_tests.py +++ b/buildscripts/burn_in_tests.py @@ -54,7 +54,8 @@ AVG_TEST_SETUP_SEC = 4 * 60 AVG_TEST_TIME_MULTIPLIER = 3 CONFIG_FILE = ".evergreen.yml" DEFAULT_PROJECT = "mongodb-mongo-master" -DEFAULT_REPO_LOCATIONS = [".", "./src/mongo/db/modules/enterprise"] +ENTERPRISE_MODULE_PATH = "src/mongo/db/modules/enterprise" +DEFAULT_REPO_LOCATIONS = [".", f"./{ENTERPRISE_MODULE_PATH}"] REPEAT_SUITES = 2 EVERGREEN_FILE = "etc/evergreen.yml" MIN_AVG_TEST_OVERFLOW_SEC = float(60) @@ -263,7 +264,7 @@ def find_excludes(selector_file: str) -> Tuple[List, List, List]: default_if_none(js_test.get("exclude_tests"), [])) -def filter_tests(tests: Set[str], exclude_tests: [str]) -> Set[str]: +def filter_tests(tests: Set[str], exclude_tests: List[str]) -> Set[str]: """ Exclude tests which have been blacklisted. @@ -667,6 +668,8 @@ def create_tests_by_task(build_variant: str, evg_conf: EvergreenProjectConfig, :return: Tests by task. """ exclude_suites, exclude_tasks, exclude_tests = find_excludes(SELECTOR_FILE) + if not evg_conf.get_variant(build_variant).is_enterprise_build(): + exclude_tests.append(f"{ENTERPRISE_MODULE_PATH}/**/*") changed_tests = filter_tests(changed_tests, exclude_tests) buildscripts.resmokelib.parser.set_run_options() diff --git a/buildscripts/ciconfig/evergreen.py b/buildscripts/ciconfig/evergreen.py index 4731525290d..08915bd1d01 100644 --- a/buildscripts/ciconfig/evergreen.py +++ b/buildscripts/ciconfig/evergreen.py @@ -13,6 +13,8 @@ import yaml import buildscripts.util.runcommand as runcommand +ENTERPRISE_MODULE_NAME = "enterprise" + def parse_evergreen_file(path, evergreen_binary="evergreen"): """Read an Evergreen file and return EvergreenProjectConfig instance.""" @@ -293,6 +295,10 @@ class Variant(object): modules = self.raw.get("modules") return modules if modules is not None else [] + def is_enterprise_build(self) -> bool: + """Determine if this build variant include the enterprise module.""" + return ENTERPRISE_MODULE_NAME in set(self.modules) + @property def run_on(self): """Get build variant run_on parameter as a list of distro names.""" |