Skip to content

Commit

Permalink
fixup! podman will not give us a real pty :(
Browse files Browse the repository at this point in the history
  • Loading branch information
mvo5 committed Dec 11, 2024
1 parent 313b4f7 commit 41b9d74
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/test_progress.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

0 comments on commit 41b9d74

Please sign in to comment.