Change OCI data model to use a content retriever for the various manifest operations

This commit is contained in:
Joseph Schorr 2018-11-19 12:24:04 +02:00
parent cbfb6054e5
commit 82ee21bfbd
5 changed files with 61 additions and 46 deletions

View file

@ -50,7 +50,8 @@ def test_lookup_manifest_dead_tag(initialized_db):
def _populate_blob(content):
digest = str(sha256_digest(content))
location = ImageStorageLocation.get(name='local_us')
blob = store_blob_record_and_temp_link('devtable', 'newrepo', digest, location, len(content), 120)
blob = store_blob_record_and_temp_link('devtable', 'newrepo', digest, location,
len(content), 120)
storage.put_content(['local_us'], get_layer_path(blob), content)
return blob, digest
@ -205,9 +206,14 @@ def test_get_or_create_manifest_list(initialized_db):
v2_builder.add_layer(random_digest, len(random_data))
v2_manifest = v2_builder.build()
# Write the manifests as blobs.
_populate_blob(v1_manifest.bytes)
_populate_blob(v2_manifest.bytes)
# Write the manifests.
v1_created = get_or_create_manifest(repository, v1_manifest, storage)
assert v1_created
assert v1_created.manifest.digest == v1_manifest.digest
v2_created = get_or_create_manifest(repository, v2_manifest, storage)
assert v2_created
assert v2_created.manifest.digest == v2_manifest.digest
# Build the manifest list.
list_builder = DockerSchema2ManifestListBuilder()