From ed1f769176272b4e715a3f24fdca564aa1ec42f2 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 2 Feb 2023 19:18:49 +0100 Subject: [PATCH] test: adapt test to work on cgroupv1 when running on a cgroupv1 host validate that the memory controller is mounted ro. Signed-off-by: Giuseppe Scrivano --- test/system/030-run.bats | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/system/030-run.bats b/test/system/030-run.bats index e6ad64bb0a..37d36568d6 100644 --- a/test/system/030-run.bats +++ b/test/system/030-run.bats @@ -1017,8 +1017,17 @@ EOF } @test "podman run --net=host --cgroupns=host with read only cgroupfs" { - # verify that the last /sys/fs/cgroup mount is read-only - run_podman run --net=host --cgroupns=host --rm $IMAGE sh -c "grep ' / /sys/fs/cgroup ' /proc/self/mountinfo | tail -n 1 | grep '/sys/fs/cgroup ro'" + skip_if_rootless_cgroupsv1 + + if is_cgroupsv1; then + # verify that the memory controller is mounted read-only + run_podman run --net=host --cgroupns=host --rm $IMAGE cat /proc/self/mountinfo + assert "$output" =~ "/sys/fs/cgroup/memory ro.* cgroup cgroup" + else + # verify that the last /sys/fs/cgroup mount is read-only + run_podman run --net=host --cgroupns=host --rm $IMAGE sh -c "grep ' / /sys/fs/cgroup ' /proc/self/mountinfo | tail -n 1" + assert "$output" =~ "/sys/fs/cgroup ro" + fi } # vim: filetype=sh