def test_check_docker_connection_with_errors(mock_docker_client, error, caplog): mock_docker_client.ping.side_effect = error with pytest.raises(SystemExit): docker_utils.check_docker_connection(mock_docker_client) assert 2 == len(caplog.records)
def build(job_dir, conf, config_file, image_tag): image_name = conf.pipeline_options.worker_harness_container_image client = docker.from_env() if config_file: basename = os.path.basename(config_file) image_tag = "{}-{}".format(image_tag, basename) docker_utils.check_docker_connection(client) docker_utils.check_dockerfile_present(job_dir) docker_utils.build_docker_image(job_dir, image_name, image_tag, config_file)
def test_check_docker_connection(mock_docker_client): docker_utils.check_docker_connection(mock_docker_client) mock_docker_client.ping.assert_called_once_with()
def _check_docker_setup(self): self._docker_client = docker.from_env() docker_utils.check_docker_connection(self._docker_client) docker_utils.check_dockerfile_present(self.job_dir)