test: add test that checks that --progress works correctly
This commit checks that the `--progress` argument generates the expected output, i.e. with `term` we will not get any osbuild output and the spinner. And with `verbose` we will not get a spinner and the osbuild output.
This commit is contained in:
parent
9a0f2ee7d7
commit
c78ea5f2b2
2 changed files with 23 additions and 0 deletions
|
|
@ -32,6 +32,7 @@ def build_fake_container_fixture(tmpdir_factory, build_container):
|
|||
# do this images may fail with "broken" pipe errors
|
||||
cat - >/dev/null
|
||||
|
||||
echo "osbuild-stdout-output"
|
||||
mkdir -p /output/qcow2
|
||||
echo "fake-disk.qcow2" > /output/qcow2/disk.qcow2
|
||||
|
||||
|
|
|
|||
|
|
@ -72,3 +72,25 @@ def test_container_build_generates_manifest(tmp_path, build_container):
|
|||
fn = f"centos-9-minimal-raw-{arch}/centos-9-minimal-raw-{arch}.osbuild-manifest.json"
|
||||
image_manifest_path = output_dir / fn
|
||||
assert image_manifest_path.exists()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("progress,needle,forbidden", [
|
||||
("verbose", "osbuild-stdout-output", "[|]"),
|
||||
("term", "[|]", "osbuild-stdout-output"),
|
||||
])
|
||||
@pytest.mark.skipif(os.getuid() != 0, reason="needs root")
|
||||
def test_container_with_progress(tmp_path, build_fake_container, progress, needle, forbidden):
|
||||
output_dir = tmp_path / "output"
|
||||
output_dir.mkdir()
|
||||
output = subprocess.check_output([
|
||||
"podman", "run", "-t",
|
||||
"--privileged",
|
||||
"-v", f"{output_dir}:/output",
|
||||
build_fake_container,
|
||||
"build",
|
||||
"minimal-raw",
|
||||
"--distro", "centos-9",
|
||||
f"--progress={progress}",
|
||||
], text=True)
|
||||
assert needle in output
|
||||
assert forbidden not in output
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue