def test_delete_images(self, mocked_execute): """Tests thart delete_images deletes images.""" images = ['myimage1', 'myimage2'] docker.delete_images(images) mocked_execute.assert_has_calls([ call(['docker', 'rmi', '-f'] + images), call(['docker', 'builder', 'prune', '-f']) ])
def test_delete_images(self, mocked_execute): # pylint: disable=no-self-use """Tests that get_project_image_name works as intended.""" images = ['image'] docker.delete_images(images) expected_calls = [ mock.call(['docker', 'rmi', '-f'] + images), mock.call(['docker', 'builder', 'prune', '-f']) ] mocked_execute.assert_has_calls(expected_calls)
def delete_unneeded_docker_images(config): """Deletes unneeded docker images if running in an environment with low disk space.""" if not config.low_disk_space: return logging.info('Deleting builder docker images to save disk space.') project_image = docker.get_project_image_name(config.project_name) images = [ project_image, docker.BASE_RUNNER_TAG, docker.MSAN_LIBS_BUILDER_TAG, ] docker.delete_images(images)
def delete_unneeded_docker_images(config): """Deletes unneeded docker images if running in an environment with low disk space.""" if not config.low_disk_space: return logging.info('Deleting builder docker images to save disk space.') project_image = docker.get_project_image_name(config.oss_fuzz_project_name) images = [ project_image, docker.BASE_BUILDER_TAG, docker.BASE_BUILDER_TAG + '-go', docker.BASE_BUILDER_TAG + '-jvm', docker.BASE_BUILDER_TAG + '-python', docker.BASE_BUILDER_TAG + '-rust', docker.BASE_BUILDER_TAG + '-swift', ] docker.delete_images(images)