(self)
| 302 | @requires_api_version('1.25') |
| 303 | class PruneImagesTest(BaseAPIIntegrationTest): |
| 304 | def test_prune_images(self): |
| 305 | try: |
| 306 | self.client.remove_image('hello-world') |
| 307 | except docker.errors.APIError: |
| 308 | pass |
| 309 | |
| 310 | # Ensure busybox does not get pruned |
| 311 | ctnr = self.client.create_container(TEST_IMG, ['sleep', '9999']) |
| 312 | self.tmp_containers.append(ctnr) |
| 313 | |
| 314 | self.client.pull('hello-world', tag='latest') |
| 315 | self.tmp_imgs.append('hello-world') |
| 316 | img_id = self.client.inspect_image('hello-world')['Id'] |
| 317 | result = self.client.prune_images() |
| 318 | assert img_id not in [ |
| 319 | img.get('Deleted') for img in result.get('ImagesDeleted') or [] |
| 320 | ] |
| 321 | result = self.client.prune_images({'dangling': False}) |
| 322 | assert result['SpaceReclaimed'] > 0 |
| 323 | assert 'hello-world:latest' in [ |
| 324 | img.get('Untagged') for img in result['ImagesDeleted'] |
| 325 | ] |
| 326 | assert img_id in [ |
| 327 | img.get('Deleted') for img in result['ImagesDeleted'] |
| 328 | ] |
| 329 | |
| 330 | |
| 331 | class SaveLoadImagesTest(BaseAPIIntegrationTest): |
nothing calls this directly
no test coverage detected