debian-forge-cli/test/test_container.py
Michael Vogt bdb32554ff test: add new test_container_builds_image_librepo test
This commit adds a (smoke) integration test for librepo based
manifests. It needs a flanking test that also ensures that
--use-librepo really generates librepo sources.
2025-01-17 13:29:01 +00:00

26 lines
801 B
Python

import os
import subprocess
import pytest
@pytest.mark.parametrize("use_librepo", [False, True])
@pytest.mark.skipif(os.getuid() != 0, reason="needs root")
def test_container_builds_image(tmp_path, build_container, use_librepo):
output_dir = tmp_path / "output"
output_dir.mkdir()
subprocess.check_call([
"podman", "run",
"--privileged",
"-v", f"{output_dir}:/output",
build_container,
"build",
"minimal-raw",
"--distro", "centos-9",
f"--use-librepo={use_librepo}",
])
arch = "x86_64"
assert (output_dir / f"centos-9-minimal-raw-{arch}/xz/disk.raw.xz").exists()
# XXX: ensure no other leftover dirs
dents = os.listdir(output_dir)
assert len(dents) == 1, f"too many dentries in output dir: {dents}"