Fix an NPE when trying to pull a manifest without a legacy image via V1

This commit is contained in:
Joseph Schorr 2019-01-10 13:36:05 -05:00
parent d9da838df1
commit b1dd053b02
6 changed files with 68 additions and 4 deletions

View file

@ -1803,3 +1803,22 @@ def test_push_pull_unicode_direct(pusher, puller, unicode_images, liveserver_ses
# Pull the repository to verify.
puller.pull(liveserver_session, 'devtable', 'newrepo', 'latest', unicode_images,
credentials=credentials, options=options)
def test_push_legacy_pull_not_allowed(v22_protocol, v1_protocol, remote_images, liveserver_session,
app_reloader, data_model):
""" Test: Push a V2 Schema 2 manifest and attempt to pull via V1 when there is no assigned legacy
image.
"""
if data_model != 'oci_model':
return
credentials = ('devtable', 'password')
# Push a new repository.
v22_protocol.push(liveserver_session, 'devtable', 'newrepo', 'latest', remote_images,
credentials=credentials)
# Attempt to pull. Should fail with a 404.
v1_protocol.pull(liveserver_session, 'devtable', 'newrepo', 'latest', remote_images,
credentials=credentials, expected_failure=Failures.UNKNOWN_TAG)