Add a squashing test for images with empty layers

This commit is contained in:
Joseph Schorr 2018-11-26 12:48:20 +02:00
parent 3e4f4ab7f1
commit 0eb84f8077

View file

@ -1575,6 +1575,32 @@ def test_push_pull_manifest_list_duplicate_manifest(v22_protocol, basic_images,
credentials=credentials, options=options)
def test_squashed_images_empty_layer(pusher, images_with_empty_layer, liveserver_session,
liveserver, registry_server_executor, app_reloader):
""" Test: Pulling of squashed images for a manifest with empty layers. """
credentials = ('devtable', 'password')
# Push an image to download.
pusher.push(liveserver_session, 'devtable', 'newrepo', 'latest', images_with_empty_layer,
credentials=credentials)
# Pull the squashed version.
response = liveserver_session.get('/c1/squash/devtable/newrepo/latest', auth=credentials)
assert response.status_code == 200
tar = tarfile.open(fileobj=StringIO(response.content))
# Verify the squashed image.
expected_image_id = 'cdc6d6c0d07d2cbacfc579e49ce0c256c5084b9b2b16c1b1b0c45f26a12a4ba5'
expected_names = ['repositories',
expected_image_id,
'%s/json' % expected_image_id,
'%s/VERSION' % expected_image_id,
'%s/layer.tar' % expected_image_id]
assert tar.getnames() == expected_names
def test_squashed_image_unsupported(v22_protocol, basic_images, liveserver_session, liveserver,
app_reloader, data_model):
""" Test: Attempting to pull a squashed image for a manifest list without an amd64+linux entry.