Exemplo n.º 1
0
    def calculate_suites_from_evg_stats(
            self, test_stats: HistoricTaskData,
            execution_time_secs: int) -> List[Suite]:
        """
        Divide tests into suites that can be run in less than the specified execution time.

        :param test_stats: Historical test results for task being split.
        :param execution_time_secs: Target execution time of each suite (in seconds).
        :return: List of sub suites calculated.
        """
        tests_runtimes = self.filter_tests(test_stats.get_tests_runtimes())
        if not tests_runtimes:
            LOGGER.debug("No test runtimes after filter, using fallback")
            return self.calculate_fallback_suites()

        self.test_list = [info.test_name for info in tests_runtimes]

        suites = divide_tests_into_suites(
            self.config_options.suite, tests_runtimes, execution_time_secs,
            self.config_options.max_sub_suites,
            self.config_options.max_tests_per_suite)

        self.add_task_hook_overhead(suites, test_stats)

        return suites
Exemplo n.º 2
0
    def calculate_suites_from_evg_stats(self, test_stats: HistoricTaskData,
                                        params: SuiteSplitParameters) -> GeneratedSuite:
        """
        Divide tests into suites that can be run in less than the specified execution time.

        :param test_stats: Historical test results for task being split.
        :param params: Description of how to split the suite.
        :return: List of sub suites calculated.
        """
        execution_time_secs = self.config.target_resmoke_time * 60
        tests_runtimes = self.filter_tests(test_stats.get_tests_runtimes(), params)
        if not tests_runtimes:
            LOGGER.debug("No test runtimes after filter, using fallback")
            return self.calculate_fallback_suites(params)

        test_lists = self.split_strategy(tests_runtimes, execution_time_secs,
                                         self.config.max_sub_suites,
                                         self.config.max_tests_per_suite)

        return self.test_lists_to_suite(test_lists, params, tests_runtimes, test_stats)