diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-09-27 20:09:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-27 20:09:47 +0200 |
commit | ecf05dd7a761d25b3e3474d7e8d4e7bb242bb984 (patch) | |
tree | e067534381e45f30f2412a4e2820296919044f93 | |
parent | a225cb595302af299b98b8d01fe5f0cb06fc6a7d (diff) | |
parent | 3e80931529a1bf6f3d871d51a92abe4106801431 (diff) | |
download | podman-ecf05dd7a761d25b3e3474d7e8d4e7bb242bb984.tar.gz podman-ecf05dd7a761d25b3e3474d7e8d4e7bb242bb984.tar.bz2 podman-ecf05dd7a761d25b3e3474d7e8d4e7bb242bb984.zip |
Merge pull request #15908 from edsantiago/systemd_tty_test
System tests: light cleanup
-rw-r--r-- | test/system/030-run.bats | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/test/system/030-run.bats b/test/system/030-run.bats index 65a1150a3..6847880ab 100644 --- a/test/system/030-run.bats +++ b/test/system/030-run.bats @@ -901,22 +901,35 @@ $IMAGE--c_ok" \ run_podman rm $ctr_name } +# 15895: --privileged + --systemd = hide /dev/ttyNN @test "podman run --privileged as root with systemd will not mount /dev/tty" { skip_if_rootless "this test only makes sense as root" - ctr_name="container-$(random_string 5)" - run_podman run --rm -d --privileged --systemd=always --name "$ctr_name" "$IMAGE" /home/podman/pause + # First, confirm that we _have_ /dev/ttyNN devices on the host. + # ('skip' would be nicer in some sense... but could hide a regression. + # Fedora, RHEL, Debian, Ubuntu, Gentoo, all have /dev/ttyN, so if + # this ever triggers, it means a real problem we should know about.) + assert "$(ls /dev/tty* | grep -vx /dev/tty)" != "" \ + "Expected at least one /dev/ttyN device on host" - TTYs=$(ls /dev/tty*|sed '/^\/dev\/tty$/d') + # Ok now confirm that without --systemd, podman exposes ttyNN devices + run_podman run --rm -d --privileged $IMAGE ./pause + cid="$output" - if [[ $TTYs = "" ]]; then - die "Did not find any /dev/ttyN devices on local host" - else - run_podman exec "$ctr_name" ls /dev/ - assert "$(grep tty <<<$output)" = "tty" "There must be no /dev/ttyN devices in the container" - fi + run_podman exec $cid sh -c 'ls /dev/tty*' + assert "$output" != "/dev/tty" \ + "ls /dev/tty* without systemd; should have lots of ttyN devices" + run_podman stop -t 0 $cid + + # Actual test for 15895: with --systemd, no ttyN devices are passed through + run_podman run --rm -d --privileged --systemd=always $IMAGE ./pause + cid="$output" + + run_podman exec $cid sh -c 'ls /dev/tty*' + assert "$output" = "/dev/tty" \ + "ls /dev/tty* with --systemd=always: should have no ttyN devices" - run_podman stop "$ctr_name" + run_podman stop -t 0 $cid } # vim: filetype=sh |