Add registry test for manifestlist with the same child manifest twice

This commit is contained in:
Joseph Schorr 2018-11-20 11:22:27 +02:00
parent c079add0df
commit 17d7828f1a

View file

@ -1470,8 +1470,8 @@ def test_push_pull_manifest_remote_layers(v22_protocol, legacy_puller, liveserve
credentials=credentials, expected_failure=Failures.UNKNOWN_TAG)
def test_push_pull_manifest_list_missing_manifest(v22_protocol, basic_images, liveserver_session,
app_reloader, data_model):
def test_push_manifest_list_missing_manifest(v22_protocol, basic_images, liveserver_session,
app_reloader, data_model):
""" Test: Attempt to push a new tag with a manifest list containing an invalid manifest.
"""
if data_model != 'oci_model':
@ -1531,3 +1531,32 @@ def test_push_pull_manifest_list_again(v22_protocol, basic_images, different_ima
# Pull and verify the manifest list.
v22_protocol.pull_list(liveserver_session, 'devtable', 'newrepo', 'latest', manifestlist,
credentials=credentials, options=options)
def test_push_pull_manifest_list_duplicate_manifest(v22_protocol, basic_images, liveserver_session,
app_reloader, data_model):
""" Test: Push a manifest list that contains the same child manifest twice.
"""
if data_model != 'oci_model':
return
credentials = ('devtable', 'password')
options = ProtocolOptions()
# Build the manifest that will go in the list.
blobs = {}
manifest = v22_protocol.build_schema2(basic_images, blobs, options)
# Create and push the manifest list.
builder = DockerSchema2ManifestListBuilder()
builder.add_manifest(manifest, 'amd64', 'linux')
builder.add_manifest(manifest, 'amd32', 'linux')
manifestlist = builder.build()
v22_protocol.push_list(liveserver_session, 'devtable', 'newrepo', 'latest', manifestlist,
[manifest], blobs,
credentials=credentials, options=options)
# Pull and verify the manifest list.
v22_protocol.pull_list(liveserver_session, 'devtable', 'newrepo', 'latest', manifestlist,
credentials=credentials, options=options)