Add tests for manifest lists and fix some issues encountered while testing

This commit is contained in:
Joseph Schorr 2018-11-13 19:05:45 +02:00
parent 9994f0ae61
commit 7a794e29c0
9 changed files with 311 additions and 98 deletions

View file

@ -4,6 +4,10 @@ from six import add_metaclass
@add_metaclass(ABCMeta)
class ManifestInterface(object):
""" Defines the interface for the various manifests types supported. """
@abstractproperty
def schema_version(self):
""" The version of the schema, or None for lists. """
@abstractproperty
def digest(self):
""" The digest of the manifest, including type prefix. """

View file

@ -183,6 +183,11 @@ class DockerSchema2ManifestList(ManifestInterface):
except ValidationError as ve:
raise MalformedSchema2ManifestList('manifest data does not match schema: %s' % ve)
@property
def schema_version(self):
""" The version of the schema, or None for lists. """
return None
@property
def digest(self):
""" The digest of the manifest, including type prefix. """
@ -241,7 +246,6 @@ class DockerSchema2ManifestList(ManifestInterface):
platform = manifest_ref._manifest_data[DOCKER_SCHEMA2_MANIFESTLIST_PLATFORM_KEY]
architecture = platform[DOCKER_SCHEMA2_MANIFESTLIST_ARCHITECTURE_KEY]
os = platform[DOCKER_SCHEMA2_MANIFESTLIST_OS_KEY]
if architecture != 'amd64' or os != 'linux':
continue