コード例 #1
0
ファイル: selected_tests.py プロジェクト: shuvalov-mdb/mongo
    def get_evg_task_config(task: Task, build_variant_config: Variant) -> Dict[str, Any]:
        """
        Look up task config of the task to be generated.

        :param task: Task to get info for.
        :param build_variant_config: Config of build variant to collect task info from.
        :return: Task configuration values.
        """
        LOGGER.info("Calculating evg_task_config values for task", task=task.name)
        task_vars = {}
        for run_task_func in POSSIBLE_RUN_TASK_FUNCS:
            task_def = task.find_func_command(run_task_func)
            if task_def:
                task_vars = task_def.get("vars", {})
                break

        task_vars.update({"suite": task.get_suite_name()})

        task_name = task.name[:-4] if task.name.endswith("_gen") else task.name
        return {
            "task_name": task_name,
            "build_variant": build_variant_config.name,
            **task_vars,
            "large_distro_name": build_variant_config.expansion("large_distro_name"),
        }
コード例 #2
0
def translate_run_var(run_var: str, build_variant: Variant) -> Any:
    """
    Translate the given "run_var" into an actual value.

    Run_vars can contain evergreen expansions, in which case, the expansion (and possible default
    value) need to be translated into a value we can use.

    :param run_var: Run var to translate.
    :param build_variant: Build variant configuration.
    :return: Value of run_var.
    """
    match = EXPANSION_RE.search(run_var)
    if match:
        value = build_variant.expansion(match.group("id"))
        if value is None:
            value = match.group("default")
        return value
    return run_var
コード例 #3
0
    def get_evg_task_config(task: Task,
                            build_variant_config: Variant) -> Dict[str, Any]:
        """
        Look up task config of the task to be generated.

        :param task: Task to get info for.
        :param build_variant_config: Config of build variant to collect task info from.
        :return: Task configuration values.
        """
        LOGGER.info("Calculating evg_task_config values for task",
                    task=task.name)
        task_vars = {}
        for run_task_func in POSSIBLE_RUN_TASK_FUNCS:
            task_def = task.find_func_command(run_task_func)
            if task_def:
                task_vars = task_def["vars"]
                break

        suite_name = ResmokeArgs.get_arg(task_vars["resmoke_args"], "suites")
        if suite_name:
            task_vars.update({"suite": suite_name})

        # the suites argument will run all tests in a suite even when individual
        # tests are specified in resmoke_args, so we remove it
        resmoke_args_without_suites = ResmokeArgs.remove_arg(
            task_vars["resmoke_args"], "suites")
        task_vars["resmoke_args"] = resmoke_args_without_suites

        task_name = task.name[:-4] if task.name.endswith("_gen") else task.name
        return {
            "task_name":
            task_name,
            "build_variant":
            build_variant_config.name,
            **task_vars,
            "large_distro_name":
            build_variant_config.expansion("large_distro_name"),
        }