diff --git a/test/test_progress.py b/test/test_progress.py index 6fb67033f..279f4fbf5 100644 --- a/test/test_progress.py +++ b/test/test_progress.py @@ -1,5 +1,8 @@ +import os import subprocess +import pytest + # pylint: disable=unused-import from test_opts import container_storage_fixture from containerbuild import build_container_fixture, build_fake_container_fixture @@ -31,3 +34,23 @@ def test_progress_debug(tmp_path, container_storage, build_fake_container): assert res.stderr.count("Build complete") == 1 assert res.stderr.count("Stop progressbar") == 1 assert res.stdout.strip() == "" + + +@pytest.mark.skipif(os.getuid() != 0, reason="needs root") +def test_progress_term(tmp_path, container_storage, build_fake_container): + output_path = tmp_path / "output" + output_path.mkdir(exist_ok=True) + + # XXX: we cannot use RawTerminal mode (which Pb requires) with podman, + # except when using "--log-driver=passthrough-tty" + bib_cmdline = bib_cmd(container_storage, output_path, build_fake_container) + # XXX: HACK + bib_cmdline.insert(3, "--log-driver=passthrough-tty") + bib_cmdline.append("--progress=term") + # simulate running in a pty + cmdline = ["systemd-run", "--pty"] + bib_cmdline + res = subprocess.run(cmdline, capture_output=True, text=True, check=False) + assert res.returncode == 0 + # XXX: systemd-run --pty will give us stderr as stdout :/ + print(res.stdout) + assert "[|] Manifest generation step" in res.stdout