Skip to content

Commit

Permalink
draft/wip fix content pull tests
Browse files Browse the repository at this point in the history
  • Loading branch information
git-hyagi committed Apr 26, 2024
1 parent d340c15 commit 95cc460
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pulp_container/app/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def make_response(self, key, base_key):
return None
entry = json.loads(entry)
response_type = entry.pop("type", None)
if binary := entry.pop("data", None):
if binary := entry.pop("content", None):
# raw binary data were translated to their hexadecimal representation and saved in
# the cache as a regular string; now, it is necessary to translate the data back
# to its original representation that will be returned in the HTTP response BODY:
Expand Down
4 changes: 2 additions & 2 deletions pulp_container/app/tasks/sync_stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,14 +575,14 @@ async def _get_blob_size_data(self, blob_data, blob_url, is_layer):
is_layer (bool): Boolean to identify if this is a layer blob (the size should be
retrived from manifest) or a config blob
"""
if is_layer:
if is_layer and "blobSum" not in blob_data:
return blob_data.get("size"), None
else:
downloader = self.remote.get_downloader(url=blob_url)
response = await downloader.run(extra_data={"headers": V2_ACCEPT_HEADERS})
with open(response.path, "rb") as content_file:
raw_data = content_file.read()
return len(raw_data), raw_data
return response.artifact_attributes['size'], raw_data

async def create_signatures(self, man_dc, signature_source):
"""
Expand Down
3 changes: 2 additions & 1 deletion pulp_container/tests/functional/api/test_pull_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,8 @@ def test_pull_image_from_repository(self):
self.assertEqual(local_image[0]["Id"], remote_image[0]["Id"])

new_artifact_count = self.artifacts_api.list().count
self.assertGreater(new_artifact_count, self.artifact_count)
# with the artifactless blobs the number of articts will decrease
self.assertGreater(new_artifact_count, self.artifact_count-1)

registry.rmi(REGISTRY_V2_REPO_HELLO_WORLD)

Expand Down

0 comments on commit 95cc460

Please sign in to comment.