def _create_job_config( self, max_executors=_FAKE_MAX_EXECUTORS, max_executors_per_slave=_FAKE_MAX_EXECUTORS_PER_SLAVE, ): atomizer = Atomizer([{'FAKE': 'fake atomizer command'}]) return JobConfig('', '', '', '', atomizer, max_executors, max_executors_per_slave)
def _construct_job_config(self, job_name, job_values): """ Produce a JobConfig object given a dictionary of values parsed from a yaml config file. :param job_name: The name of the job :type job_name: str :param job_values: The dict of config sections for this job as parsed from the yaml file :type job_values: dict :return: A JobConfig object wrapping the normalized data for the specified job :rtype: JobConfig """ # Each value should be transformed from a list of commands to a single command string. setup_build = self._shell_command_list_to_single_command( job_values.get(SETUP_BUILD)) teardown_build = self._shell_command_list_to_single_command( job_values.get(TEARDOWN_BUILD)) command = self._shell_command_list_to_single_command( job_values[COMMANDS]) atomizer = Atomizer(job_values[ATOMIZERS]) max_executors = job_values.get(MAX_EXECUTORS, self.DEFAULT_MAX_EXECUTORS) max_executors_per_slave = job_values.get(MAX_EXECUTORS_PER_SLAVE, self.DEFAULT_MAX_EXECUTORS) return JobConfig(job_name, setup_build, teardown_build, command, atomizer, max_executors, max_executors_per_slave)
def test_teardown_build_runs_teardown(self): job_config = JobConfig('name', 'setup', 'teardown', 'command', 'atomizer', 10, 10) project_type = ProjectType() project_type.job_config = MagicMock(return_value=job_config) project_type.execute_command_in_project = MagicMock(return_value=('', 0)) project_type.teardown_build() project_type.execute_command_in_project.assert_called_with('teardown', timeout=None)
def _create_job_config(self) -> JobConfig: max_executors = max_executors_per_slave = maxsize atomizer = Atomizer([{'FAKE': 'fake atomizer command'}]) return JobConfig('', '', '', '', atomizer, max_executors, max_executors_per_slave)