def test_error_parallel_pull(self, mock_write): project = Project.from_config( name='test', client=self.mock_client, config_data=Config( project_name='', version=V2_0, services=[{ 'name': 'web', 'image': BUSYBOX_IMAGE_WITH_TAG, }], networks=None, volumes=None, secrets=None, configs=None, ), ) self.mock_client.pull.side_effect = OperationFailedError('pull error') with pytest.raises(ProjectError): project.pull(parallel_pull=True) self.mock_client.pull.side_effect = OperationFailedError(b'pull error') with pytest.raises(ProjectError): project.pull(parallel_pull=True)
def process_service(self, service, silent=False): if 'image' not in service.options: # [Developer] I know its peretty bad hack, I can improve on this by having a clone of this object image_with_tag = self.get_repository_name_with_tag(service) log.info('Service (%s) docker image should be (%s)' % (service.name, image_with_tag)) service.options['image'] = image_with_tag repo, tag, _ = parse_repository_tag(service.options['image']) kwargs = { 'tag': tag or 'latest', 'stream': True, 'platform': getattr(service, 'platform', None), } if kwargs['platform'] and version_lt(service.client.api_version, '1.35'): raise OperationFailedError( 'Impossible to perform platform-targeted pulls for API version < 1.35' ) self.try_to_pull_otherwise_build(service, repo, kwargs)