Merge pull request #3206 from quay/fix-unicode-schemas
Fix unicode manifests in the backfill
This commit is contained in:
commit
e13baa9041
11 changed files with 200 additions and 8 deletions
|
@ -280,8 +280,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)
|
||||
|
|
|
@ -66,6 +66,7 @@ class ProtocolOptions(object):
|
|||
self.manifest_content_type = None
|
||||
self.accept_mimetypes = '*/*'
|
||||
self.mount_blobs = None
|
||||
self.push_by_manifest_digest = False
|
||||
|
||||
|
||||
@add_metaclass(ABCMeta)
|
||||
|
|
|
@ -69,6 +69,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