def test_registry_get_config_digest(registry_v2_manifest: RegistryV2Manifest):
    """Test image configuration digest retrieval."""
    formattedsha256 = FormattedSHA256(
        "8f1196ff19e7b5c5861de192ae77e8d7a692fcbca2dd3174d324980f72ab49bf")
    assert registry_v2_manifest.get_config_digest() == formattedsha256
    assert (registry_v2_manifest.get_config_digest(
        ImageName.parse("ignored")) == formattedsha256)
def test_registry_override_config(registry_v2_manifest: RegistryV2Manifest,
                                  formattedsha256: FormattedSHA256):
    """Test overriding manifest values."""
    size = 1234
    registry_v2_manifest.set_config_digest(formattedsha256, size)
    assert registry_v2_manifest.get_config_digest() == formattedsha256
    assert registry_v2_manifest.json["config"]["size"] == size
def test_registry_get_layers(registry_v2_manifest: RegistryV2Manifest):
    """Test manifest layer retrieval."""
    layers = [
        "sha256:6c8c72249e560701aa1da4cd40192274a8c0419ddb8e4a553aa02b5a1acdb863",
        "sha256:1403b179e2c9df4f57e9ea94e32882739c6b3d75ed756d4e67fcc424288c29cc",
    ]
    assert registry_v2_manifest.get_layers() == layers
    assert registry_v2_manifest.get_layers(
        ImageName.parse("ignored")) == layers
示例#4
0
 async def get_manifest(self,
                        image_name: ImageName = None,
                        **kwargs) -> Manifest:
     if not self.manifest:
         manifest = get_test_data(self.request, __name__,
                                  "stub_manifest.json")
         self.manifest = RegistryV2Manifest(manifest)
     return self.manifest
def test_cast_from_manifest(manifest_list_registry: bytes):
    """Test down-casting."""
    registry_v2_manifest = RegistryV2Manifest(manifest_list_registry)

    manifest_list = RegistryV2ManifestList.from_manifest(registry_v2_manifest)
    assert len(manifest_list.get_manifests()) == 2
def registry_v2_manifest(manifest_registry: bytes) -> RegistryV2Manifest:
    """Provides a RegistryV2Manifest instance for the sample registry manifest."""
    # Do not use caching; get a new instance for each test
    return RegistryV2Manifest(manifest_registry)
def registry_v2_manifest(manifest_registry):
    # Do not use caching; get a new instance for each test
    return RegistryV2Manifest(manifest_registry)