1
0
mirror of https://github.com/projectatomic/atomic.git synced 2026-02-06 21:45:24 +01:00
Files
atomic/Atomic/objects/layer.py
Yu Qi Zhang 14e878dbfc Fix tests for f26
Fix test failures after updating papr to test with f26 atomic/cloud
images instead of f25, with the following changes:

1. Remove dependency on docker hub tester image. Instead, mimic
what ostree/rpm-ostree does and use a recursive .papr.sh script
to install the necessary packages to the base f26 image in the
fedora registry. This fixes tests on the atomic host since python3.6
is being used, and prevents future tests from testing the wrong
version. (Note this is slightly slower due to having to install
packages during the test rather than using a pre-built image).

2. Fix some pylint errors, and mask others for now

3. Fix failing integration tests due to inter-test interference

4. Remove unnecessary deepcopy in container filter

5. Add compatibility for both c-s-s and d-s-s in storage

6. Update expected sha256 values for dockertar test

Remaining issues:

1. test_storage should possibly be reworked. The current test
setup is conflicting with the new default of overlay as a driver.
For now, the test for generated d-s-s is disabled.

2. some storage commands are still using "docker-storage-setup"
instead of "container-storage-setup". There is a backward
compatible check in place that should be reworked in the future

3. some masked pylint errors should be further investigated

4. keep the dockerfile for the project atomic tester image for now
(bump to 26), since its a little easier and faster to set up with

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>

Closes: #1076
Approved by: baude
2017-08-23 18:33:48 +00:00

66 lines
2.0 KiB
Python

from Atomic.util import output_json
from Atomic.client import no_shaw
class Layer(object): # pylint: disable=eq-without-hash
def __init__(self, img_input):
self.id = None
self.name = None
self.version = None
self.release = None
self.repotags = None
self.parent = None
self.remote = False
self.digest = None
self.backend = None
if type(img_input) is dict:
pass
else:
self._instantiate_from_image_object(img_input)
def _instantiate_from_image_object(self, img_obj):
self.id = img_obj.id
self.name = img_obj.get_label('Name') or img_obj.name or img_obj.image
self.remote = img_obj.remote
self.version = img_obj.version
self.release = img_obj.release
self.repotags = img_obj.repotags
# This needs to be resolved for future docker versions
self.parent = img_obj.parent
self.digest = img_obj.digest
self.backend = img_obj.backend
return self
def _instantiate_from_dict(self):
return self
def __eq__(self, other):
if self.long_version == other.long_version:
return True
return False
def __ne__(self, other):
if self.long_version != other.long_version:
return True
return False
def dump(self):
# helper function to dump out known variables/values in pretty-print style
class_vars = dict(vars(self))
foo = {x: class_vars[x] for x in class_vars if not callable(getattr(self, x)) and not x.startswith('__')
and not x.endswith('_backend')}
output_json(foo)
@property
def long_version(self):
_version = ""
if self.version:
_version += "{}".format(self.version)
if self.release:
if self.version:
_version += "-"
_version += "{}".format(self.release)
if not _version:
return no_shaw(self.id or self.digest)
return _version