Exemplo n.º 1
0
def _get_evg_task_config(
    selected_tests_variant_expansions: Dict[str, str],
    task: Task,
    build_variant_config: Variant,
) -> Dict[str, Any]:
    """
    Look up task config of the task to be generated.

    :param selected_tests_variant_expansions: Expansions of the selected-tests variant.
    :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)
    if task.is_generate_resmoke_task:
        task_vars = task.generate_resmoke_tasks_command["vars"]
    else:
        task_vars = task.run_tests_command["vars"]
        task_vars.update({"fallback_num_sub_suites": "1"})

    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

    selected_tests_task_config = _get_selected_tests_task_config(
        selected_tests_variant_expansions)

    return {
        "task_name": task.name,
        "build_variant": build_variant_config.name,
        **task_vars,
        **selected_tests_task_config
    }
Exemplo n.º 2
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"),
        }
Exemplo n.º 3
0
def _get_evg_task_configuration(
    evg_conf: EvergreenProjectConfig,
    build_variant: str,
    task_name: str,
    test_list_info: dict,
):
    """
    Look up task config of the task to be generated.

    :param evg_conf: Evergreen configuration.
    :param build_variant: Build variant to collect task info from.
    :param task_name: Name of task to get info for.
    :param test_list_info: The value for a given task_name in the tests_by_task dict.
    return: Task configuration values.
    """
    evg_build_variant = evg_conf.get_variant(build_variant)
    task = evg_build_variant.get_task(task_name)
    if task.is_generate_resmoke_task:
        task_vars = task.generate_resmoke_tasks_command["vars"]
    else:
        task_vars = task.run_tests_command["vars"]
        task_vars.update({"fallback_num_sub_suites": "1"})

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

    resmoke_args_without_suites = ResmokeArgs.remove_arg(
        task_vars["resmoke_args"], "suites")
    task_vars["resmoke_args"] = resmoke_args_without_suites

    return {
        "task_name": task_name,
        "build_variant": build_variant,
        "selected_tests_to_run": set(test_list_info["tests"]),
        **task_vars
    }