MCPcopy
hub / github.com/docker/docker-py / test_build_with_cache_from

Method test_build_with_cache_from

tests/integration/api_build_test.py:223–256  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

221
222 @requires_api_version('1.25')
223 def test_build_with_cache_from(self):
224 script = io.BytesIO('\n'.join([
225 'FROM busybox',
226 'ENV FOO=bar',
227 'RUN touch baz',
228 'RUN touch bax',
229 ]).encode('ascii'))
230
231 stream = self.client.build(fileobj=script, tag='build1')
232 self.tmp_imgs.append('build1')
233 for _chunk in stream:
234 pass
235
236 stream = self.client.build(
237 fileobj=script, tag='build2', cache_from=['build1'],
238 decode=True
239 )
240 self.tmp_imgs.append('build2')
241 counter = 0
242 for chunk in stream:
243 if 'Using cache' in chunk.get('stream', ''):
244 counter += 1
245 assert counter == 3
246 self.client.remove_image('build2')
247
248 counter = 0
249 stream = self.client.build(
250 fileobj=script, tag='build2', cache_from=['nosuchtag'],
251 decode=True
252 )
253 for chunk in stream:
254 if 'Using cache' in chunk.get('stream', ''):
255 counter += 1
256 assert counter == 0
257
258 @requires_api_version('1.29')
259 def test_build_container_with_target(self):

Callers

nothing calls this directly

Calls 4

joinMethod · 0.80
remove_imageMethod · 0.80
buildMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected