Update registry tests
This commit is contained in:
parent
e6c2ddfa93
commit
45db1d27e7
3 changed files with 47 additions and 12 deletions
|
|
@ -21,6 +21,7 @@ class V2ProtocolSteps(Enum):
|
|||
BLOB_HEAD_CHECK = 'blob-head-check'
|
||||
GET_MANIFEST = 'get-manifest'
|
||||
PUT_MANIFEST = 'put-manifest'
|
||||
PUT_MANIFEST_LIST = 'put-manifest-list'
|
||||
MOUNT_BLOB = 'mount-blob'
|
||||
CATALOG = 'catalog'
|
||||
LIST_TAGS = 'list-tags'
|
||||
|
|
@ -60,6 +61,9 @@ class V2Protocol(RegistryProtocol):
|
|||
Failures.INVALID_BLOB: 400,
|
||||
Failures.UNSUPPORTED_CONTENT_TYPE: 415,
|
||||
},
|
||||
V2ProtocolSteps.PUT_MANIFEST_LIST: {
|
||||
Failures.INVALID_MANIFEST: 400,
|
||||
}
|
||||
}
|
||||
|
||||
def __init__(self, jwk, schema2=False):
|
||||
|
|
@ -164,7 +168,7 @@ class V2Protocol(RegistryProtocol):
|
|||
assert manifest.digest == manifestlist.digest
|
||||
|
||||
|
||||
def push_list(self, session, namespace, repo_name, tag_names, manifestlist, blobs,
|
||||
def push_list(self, session, namespace, repo_name, tag_names, manifestlist, manifests, blobs,
|
||||
credentials=None, expected_failure=None, options=None):
|
||||
options = options or ProtocolOptions()
|
||||
scopes = options.scopes or ['repository:%s:push,pull' % self.repo_name(namespace, repo_name)]
|
||||
|
|
@ -190,6 +194,17 @@ class V2Protocol(RegistryProtocol):
|
|||
expected_failure):
|
||||
return
|
||||
|
||||
# Push the individual manifests.
|
||||
for manifest in manifests:
|
||||
manifest_headers = {'Content-Type': manifest.media_type}
|
||||
manifest_headers.update(headers)
|
||||
|
||||
self.conduct(session, 'PUT',
|
||||
'/v2/%s/manifests/%s' % (self.repo_name(namespace, repo_name), manifest.digest),
|
||||
data=manifest.bytes,
|
||||
expected_status=(202, expected_failure, V2ProtocolSteps.PUT_MANIFEST),
|
||||
headers=manifest_headers)
|
||||
|
||||
# Push the manifest list.
|
||||
for tag_name in tag_names:
|
||||
manifest_headers = {'Content-Type': manifestlist.media_type}
|
||||
|
|
@ -201,7 +216,7 @@ class V2Protocol(RegistryProtocol):
|
|||
self.conduct(session, 'PUT',
|
||||
'/v2/%s/manifests/%s' % (self.repo_name(namespace, repo_name), tag_name),
|
||||
data=manifestlist.bytes,
|
||||
expected_status=(202, expected_failure, V2ProtocolSteps.PUT_MANIFEST),
|
||||
expected_status=(202, expected_failure, V2ProtocolSteps.PUT_MANIFEST_LIST),
|
||||
headers=manifest_headers)
|
||||
|
||||
return PushResult(manifests=None, headers=headers)
|
||||
|
|
|
|||
Reference in a new issue