Packaging tests
===============
-Packaging tests used pytest, docker and each directory with subdirectory *packaging*
+Packaging tests used pytest, docker and each directory with subdirectory *.packaging*
is called as *component*.
Run tests for all components:
pytest tests/packaging --collect-only
-Run test for specific component (*doc/packaging*):
+Run test for specific component (*doc/.packaging*):
.. code-block::
- pytest -r fEsxX tests/packaging -k test_collect[debian_10-doc/packaging]
+ pytest -r fEsxX tests/packaging -k test_collect[debian_10-doc/.packaging]
.. note::
For debug add argument :code:`-s`.
-daemon/packaging component
---------------------------
+daemon/.packaging component
+---------------------------
This is special component that is used by all others components.
For each distribution and version are created two docker images with this component.
Others components
-----------------
-All others components are based on *daemon/packaging* component (docker image).
+All others components are based on *daemon/.packaging* component (docker image).
When component needs new building dependencies, new running dependencies
or some scripts that change build or run phase (see `File structure of each component`_),
new docker image is created.
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
-EXCLUDED_TEST_DIRS = ['tests/unit/packaging', 'tests/packaging',
- 'tests/integration/deckard/contrib/libfaketime/packaging']
client = docker.from_env()
dockerf.write('FROM {}\n'.format(from_image))
dockerf.write('WORKDIR /root/kresd\n')
- if self.module == 'daemon/packaging':
+ if self.module == 'daemon/.packaging':
dockerf.write('COPY . /root/kresd\n')
# when this file doesn't exists, tzdata needs user interaction
dockerf.write('RUN if [ ! -f /etc/localtime ];' +
for rootpath, dirs, _ in os.walk(path):
- if (os.path.basename(rootpath) == 'packaging'):
+ if (os.path.basename(rootpath) == '.packaging'):
fdir = os.path.relpath(rootpath, path)
if exclude is not None:
if fdir not in exclude:
def list_tests_dirs():
- """return all 'packaging' directories without directories included in EXCLUDED_TEST_DIRS"""
- return list_dirs(pytest.KR_ROOT_DIR, EXCLUDED_TEST_DIRS)
+ """return all 'packaging' directories"""
+ return list_dirs(pytest.KR_ROOT_DIR)
def list_distro_vers(distro_root):
MODULES = list_tests_dirs()
-DISTROS = list_distro_vers(os.path.join(pytest.KR_ROOT_DIR, 'daemon/packaging'))
+DISTROS = list_distro_vers(os.path.join(pytest.KR_ROOT_DIR, 'daemon/.packaging'))
DISTROS_NAMES = ['{0}_{1}'.format(distro['name'], distro['version']) for distro in DISTROS]
if img is None:
logger.warning('Unknown distro {}'.format(distro['name']))
else:
- img.module = 'daemon/packaging'
+ img.module = 'daemon/.packaging'
tmpdir = tmpdir_factory.mktemp(distro['name']+distro['version'])
img.build(tmpdir, tag=pytest.KR_PREFIX+distro['name']+distro['version']+'-build')
img.build_run(tmpdir, img.build_id,
pytest.skip('Unsupported linux distribution ({0} {1}:{2})'.format(buildenv.distro, buildenv.version, module))
try:
- if module == 'daemon/packaging':
+ if module == 'daemon/.packaging':
# use main "run image" without changes
logging.info('Use main "run image"')
ch = ContainerHandler(buildenv.run_id)
buildmod.module = module
buildmod.build(tmp_path, from_image=buildenv.build_id,
tag=pytest.KR_PREFIX+buildmod.distro+buildmod.version+'-' +
- module+'-build')
+ module.replace('/.packaging', '')+'-build')
if buildmod is not None:
# new build image was made, create new module specific "run image"
logger.info('Create module specific "run image" from Dockerfile')
buildmod.build_run(tmp_path, buildmod.build_id,
tag=pytest.KR_PREFIX+buildmod.distro+buildmod.version+'-' +
- module+'-run', from_image=buildenv.run_id)
+ module.replace('/.packaging', '')+'-run', from_image=buildenv.run_id)
ch = ContainerHandler(buildmod.run_id)
ch.run()
elif os.path.isfile(os.path.join(distro_dir, 'pre-run.sh')) \