Update registry tests to test schema 2 manifest pushes and pulls
Note that tests for manifest *lists* will be in a following commit
This commit is contained in:
parent
7b9f56eff3
commit
e752a9a73f
5 changed files with 171 additions and 98 deletions
|
@ -101,10 +101,6 @@ class V1Protocol(RegistryProtocol):
|
|||
return None
|
||||
|
||||
tag_image_id = image_ids[tag_name]
|
||||
if not options.munge_shas:
|
||||
# Ensure we have a matching image ID.
|
||||
known_ids = {image.id for image in images}
|
||||
assert tag_image_id in known_ids
|
||||
|
||||
# Retrieve the ancestry of the tagged image.
|
||||
image_prefix = '/v1/images/%s/' % tag_image_id
|
||||
|
@ -160,15 +156,19 @@ class V1Protocol(RegistryProtocol):
|
|||
if image.config is not None:
|
||||
image_json_data['config'] = image.config
|
||||
|
||||
if image.created is not None:
|
||||
image_json_data['created'] = image.created
|
||||
|
||||
image_json = json.dumps(image_json_data)
|
||||
response = self.conduct(session, 'PUT', '/v1/images/%s/json' % image.id,
|
||||
json_data=image_json_data, headers=headers,
|
||||
data=image_json, headers=headers,
|
||||
expected_status=(200, expected_failure,
|
||||
V1ProtocolSteps.PUT_IMAGE_JSON))
|
||||
if response.status_code != 200:
|
||||
return
|
||||
|
||||
# PUT /v1/images/{imageID}/checksum (old style)
|
||||
old_checksum = compute_tarsum(StringIO(image.bytes), json.dumps(image_json_data))
|
||||
old_checksum = compute_tarsum(StringIO(image.bytes), image_json)
|
||||
checksum_headers = {'X-Docker-Checksum': old_checksum}
|
||||
checksum_headers.update(headers)
|
||||
|
||||
|
@ -180,7 +180,7 @@ class V1Protocol(RegistryProtocol):
|
|||
data=StringIO(image.bytes), headers=headers)
|
||||
|
||||
# PUT /v1/images/{imageID}/checksum (new style)
|
||||
checksum = compute_simple(StringIO(image.bytes), json.dumps(image_json_data))
|
||||
checksum = compute_simple(StringIO(image.bytes), image_json)
|
||||
checksum_headers = {'X-Docker-Checksum-Payload': checksum}
|
||||
checksum_headers.update(headers)
|
||||
|
||||
|
@ -200,7 +200,7 @@ class V1Protocol(RegistryProtocol):
|
|||
'/v1/repositories/%s/images' % self.repo_name(namespace, repo_name),
|
||||
expected_status=204, headers=headers)
|
||||
|
||||
return PushResult(checksums=None, manifests=None, headers=headers)
|
||||
return PushResult(manifests=None, headers=headers)
|
||||
|
||||
def delete(self, session, namespace, repo_name, tag_names, credentials=None,
|
||||
expected_failure=None, options=None):
|
||||
|
|
Reference in a new issue