Fix handling of manifests with unicode in the backfill
Also adds a bunch of tests around manifests to ensure we get the same information in and out
This commit is contained in:
parent
a66a4d6a10
commit
fa58f3b1d2
9 changed files with 176 additions and 7 deletions
|
@ -279,8 +279,9 @@ class V2Protocol(RegistryProtocol):
|
|||
if options.manifest_content_type is not None:
|
||||
manifest_headers['Content-Type'] = options.manifest_content_type
|
||||
|
||||
tag_or_digest = tag_name if not options.push_by_manifest_digest else manifest.digest
|
||||
self.conduct(session, 'PUT',
|
||||
'/v2/%s/manifests/%s' % (self.repo_name(namespace, repo_name), tag_name),
|
||||
'/v2/%s/manifests/%s' % (self.repo_name(namespace, repo_name), tag_or_digest),
|
||||
data=manifest.bytes,
|
||||
expected_status=(put_code, expected_failure, V2ProtocolSteps.PUT_MANIFEST),
|
||||
headers=manifest_headers)
|
||||
|
|
|
@ -65,6 +65,7 @@ class ProtocolOptions(object):
|
|||
self.skip_head_checks = False
|
||||
self.manifest_content_type = None
|
||||
self.mount_blobs = None
|
||||
self.push_by_manifest_digest = False
|
||||
|
||||
|
||||
@add_metaclass(ABCMeta)
|
||||
|
|
|
@ -66,6 +66,25 @@ def test_basic_push_pull_by_manifest(manifest_protocol, basic_images, liveserver
|
|||
credentials=credentials)
|
||||
|
||||
|
||||
def test_basic_push_by_manifest_digest(manifest_protocol, basic_images, liveserver_session,
|
||||
app_reloader):
|
||||
""" Test: Basic push-by-manifest and pull-by-manifest of an image to a new repository. """
|
||||
credentials = ('devtable', 'password')
|
||||
|
||||
# Push a new repository.
|
||||
options = ProtocolOptions()
|
||||
options.push_by_manifest_digest = True
|
||||
|
||||
result = manifest_protocol.push(liveserver_session, 'devtable', 'newrepo', 'latest', basic_images,
|
||||
credentials=credentials, options=options)
|
||||
|
||||
# Pull the repository by digests to verify.
|
||||
digests = [str(manifest.digest) for manifest in result.manifests.values()]
|
||||
manifest_protocol.pull(liveserver_session, 'devtable', 'newrepo', digests, basic_images,
|
||||
credentials=credentials)
|
||||
|
||||
|
||||
|
||||
def test_push_invalid_credentials(pusher, basic_images, liveserver_session, app_reloader):
|
||||
""" Test: Ensure we get auth errors when trying to push with invalid credentials. """
|
||||
invalid_credentials = ('devtable', 'notcorrectpassword')
|
||||
|
|
Reference in a new issue