(self)
| 212 | |
| 213 | @requires_api_version('1.25') |
| 214 | def test_build_with_cache_from(self): |
| 215 | script = io.BytesIO('\n'.join([ |
| 216 | 'FROM busybox', |
| 217 | 'ENV FOO=bar', |
| 218 | 'RUN touch baz', |
| 219 | 'RUN touch bax', |
| 220 | ]).encode('ascii')) |
| 221 | |
| 222 | stream = self.client.build(fileobj=script, tag='build1') |
| 223 | self.tmp_imgs.append('build1') |
| 224 | for _chunk in stream: |
| 225 | pass |
| 226 | |
| 227 | stream = self.client.build( |
| 228 | fileobj=script, tag='build2', cache_from=['build1'], |
| 229 | decode=True |
| 230 | ) |
| 231 | self.tmp_imgs.append('build2') |
| 232 | counter = 0 |
| 233 | for chunk in stream: |
| 234 | if 'Using cache' in chunk.get('stream', ''): |
| 235 | counter += 1 |
| 236 | assert counter == 3 |
| 237 | self.client.remove_image('build2') |
| 238 | |
| 239 | counter = 0 |
| 240 | stream = self.client.build( |
| 241 | fileobj=script, tag='build2', cache_from=['nosuchtag'], |
| 242 | decode=True |
| 243 | ) |
| 244 | for chunk in stream: |
| 245 | if 'Using cache' in chunk.get('stream', ''): |
| 246 | counter += 1 |
| 247 | assert counter == 0 |
| 248 | |
| 249 | @requires_api_version('1.29') |
| 250 | def test_build_container_with_target(self): |
nothing calls this directly
no test coverage detected