unit-tests: oci/integration_test.py (#47006)

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
This commit is contained in:
Massimiliano Culpo 2024-10-16 09:09:52 +02:00 committed by GitHub
parent d2f1e29927
commit 64f90c38be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -69,8 +69,8 @@ def test_buildcache_tag(install_mockery, mock_fetch, mutable_mock_env_path):
"""Tests whether we can create an OCI image from a full environment with multiple roots."""
env("create", "test")
with ev.read("test"):
install("--add", "libelf")
install("--add", "trivial-install-test-package")
install("--fake", "--add", "libelf")
install("--fake", "--add", "trivial-install-test-package")
registry = InMemoryOCIRegistry("example.com")
@ -83,7 +83,7 @@ def test_buildcache_tag(install_mockery, mock_fetch, mutable_mock_env_path):
name = ImageReference.from_string("example.com/image:full_env")
with ev.read("test") as e:
specs = e.all_specs()
specs = [x for x in e.all_specs() if not x.external]
manifest, config = get_manifest_and_config(name)
@ -100,7 +100,7 @@ def test_buildcache_tag(install_mockery, mock_fetch, mutable_mock_env_path):
name = ImageReference.from_string("example.com/image:single_spec")
manifest, config = get_manifest_and_config(name)
assert len(manifest["layers"]) == 1
assert len(manifest["layers"]) == len([x for x in libelf.traverse() if not x.external])
def test_buildcache_push_with_base_image_command(mutable_database, tmpdir):
@ -347,6 +347,10 @@ def put_manifest(base_images, checksums, image_ref, tmpdir, extra_config, annota
for s in mpileaks.traverse():
if s.name in without_manifest:
continue
if s.external:
continue
# This should not raise a 404.
manifest, _ = get_manifest_and_config(image.with_tag(default_tag(s)))
@ -358,6 +362,10 @@ def put_manifest(base_images, checksums, image_ref, tmpdir, extra_config, annota
for s in mpileaks.traverse():
if s.name in without_manifest:
continue
if s.external:
continue
expected_digests = {
pkg_to_own_digest[t.name]
for t in s.traverse(deptype=("link", "run"), root=True)