From 36c16331f6617158721243a2be1042cc12c67cff Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Thu, 10 Sep 2026 12:33:16 +0200 Subject: [PATCH 1/2] test/system: remove cgroupv2 check Since podman 6 we only support cgroupv2 systems. Therefore we no longer need this check in the tests and we can simplify them. Signed-off-by: Paul Holzinger --- test/system/030-run.bats | 22 +++------- test/system/065-cp.bats | 4 -- test/system/080-pause.bats | 12 ------ test/system/180-blkio.bats | 23 +++-------- test/system/200-pod.bats | 13 +----- test/system/280-update.bats | 71 +++++++++++---------------------- test/system/600-completion.bats | 20 +--------- test/system/610-format.bats | 20 ++-------- test/system/helpers.bash | 11 ----- 9 files changed, 40 insertions(+), 156 deletions(-) diff --git a/test/system/030-run.bats b/test/system/030-run.bats index 50264902e2..f069c6b066 100644 --- a/test/system/030-run.bats +++ b/test/system/030-run.bats @@ -80,12 +80,7 @@ EOF # bats test_tags=ci:parallel @test "podman run --memory=0 runtime option" { run_podman run --memory=0 --rm $IMAGE echo hello - if is_rootless && ! is_cgroupsv2; then - is "${lines[0]}" "Resource limits are not supported and ignored on cgroups V1 rootless systems" "--memory is not supported" - is "${lines[1]}" "hello" "--memory is ignored" - else - is "$output" "hello" "failed to run when --memory is set to 0" - fi + is "$output" "hello" "failed to run when --memory is set to 0" } # 'run --preserve-fds' passes a number of additional file descriptors into the container @@ -1177,17 +1172,10 @@ EOF local dev_maj_min=$(stat -c %Hr:%Lr /dev/nullb0) # this test is a triple check on blkio flags since they seem to sneak by the tests - if is_cgroupsv2; then - run_podman run -dt --device-read-bps=/dev/nullb0:1M $IMAGE top - cid=$output - run_podman exec -it $output cat /sys/fs/cgroup/io.max - is "$output" ".*$dev_maj_min rbps=1048576 wbps=max riops=max wiops=max" "throttle devices passed successfully.*" - else - run_podman run -dt --device-read-bps=/dev/nullb0:1M $IMAGE top - cid=$output - run_podman exec -it $output cat /sys/fs/cgroup/blkio/blkio.throttle.read_bps_device - is "$output" ".*$dev_maj_min 1048576" "throttle devices passed successfully.*" - fi + run_podman run -dt --device-read-bps=/dev/nullb0:1M $IMAGE top + cid=$output + run_podman exec -it $output cat /sys/fs/cgroup/io.max + is "$output" ".*$dev_maj_min rbps=1048576 wbps=max riops=max wiops=max" "throttle devices passed successfully.*" run_podman container rm -f -t0 $cid } diff --git a/test/system/065-cp.bats b/test/system/065-cp.bats index 5a96d41439..d532471dfe 100644 --- a/test/system/065-cp.bats +++ b/test/system/065-cp.bats @@ -157,10 +157,6 @@ load helpers } @test "podman cp file from/to host while --pid=host" { - if is_rootless && ! is_cgroupsv2; then - skip "'podman cp --pid=host' (rootless) only works with cgroups v2" - fi - srcdir=$PODMAN_TMPDIR/cp-pid-equals-host mkdir -p $srcdir touch $srcdir/hostfile diff --git a/test/system/080-pause.bats b/test/system/080-pause.bats index 8dc18648c1..e462540a6a 100644 --- a/test/system/080-pause.bats +++ b/test/system/080-pause.bats @@ -10,10 +10,6 @@ load helpers.systemd # as this command takes locks of all containers and parallel containers may # block for a while. @test "podman pause/unpause" { - if is_rootless && ! is_cgroupsv2; then - skip "'podman pause' (rootless) only works with cgroups v2" - fi - cname="c-$(safename)" run_podman run -d --name $cname $IMAGE \ sh -c 'while :;do date +%s;sleep 1;done' @@ -68,10 +64,6 @@ load helpers.systemd # CANNOT BE PARALLELIZED! (because of unpause --all) @test "podman unpause --all" { - if is_rootless && ! is_cgroupsv2; then - skip "'podman pause' (rootless) only works with cgroups v2" - fi - cname="c-$(safename)" cname_notrunning="c-notrunning-$(safename)" @@ -91,10 +83,6 @@ load helpers.systemd # bats test_tags=ci:parallel @test "podman pause/unpause with HealthCheck interval" { - if is_rootless && ! is_cgroupsv2; then - skip "'podman pause' (rootless) only works with cgroups v2" - fi - local ctrname="c-$(safename)" local msg="healthmsg-$(random_string)" diff --git a/test/system/180-blkio.bats b/test/system/180-blkio.bats index eab0e31e51..fa7b54a507 100644 --- a/test/system/180-blkio.bats +++ b/test/system/180-blkio.bats @@ -47,23 +47,10 @@ function teardown() { echo bfq > /sys/block/$(basename ${lodevice})/queue/scheduler # run podman - if is_cgroupsv2; then - if [ ! -f /sys/fs/cgroup/system.slice/io.bfq.weight ]; then - skip "Kernel does not support BFQ IO scheduler" - fi - run_podman run --device ${lodevice}:${lodevice} --blkio-weight-device ${lodevice}:123 --rm $IMAGE \ - /bin/sh -c "cat /sys/fs/cgroup/\$(sed -e 's/0:://' < /proc/self/cgroup)/io.bfq.weight" - is "${lines[1]}" "${lomajmin}\s\+123" - else - if [ ! -f /sys/fs/cgroup/blkio/system.slice/blkio.bfq.weight_device ]; then - skip "Kernel does not support BFQ IO scheduler" - fi - if [ $(podman_runtime) = "crun" ]; then - # As of crun 1.2, crun doesn't support blkio.bfq.weight_device - skip "crun doesn't support blkio.bfq.weight_device" - fi - run_podman run --device ${lodevice}:${lodevice} --blkio-weight-device ${lodevice}:123 --rm $IMAGE \ - /bin/sh -c "cat /sys/fs/cgroup/blkio/blkio.bfq.weight_device" - is "${lines[1]}" "${lomajmin}\s\+123" + if [ ! -f /sys/fs/cgroup/system.slice/io.bfq.weight ]; then + skip "Kernel does not support BFQ IO scheduler" fi + run_podman run --device ${lodevice}:${lodevice} --blkio-weight-device ${lodevice}:123 --rm $IMAGE \ + /bin/sh -c "cat /sys/fs/cgroup/\$(sed -e 's/0:://' < /proc/self/cgroup)/io.bfq.weight" + is "${lines[1]}" "${lomajmin}\s\+123" } diff --git a/test/system/200-pod.bats b/test/system/200-pod.bats index 5018538069..3833f9e453 100644 --- a/test/system/200-pod.bats +++ b/test/system/200-pod.bats @@ -771,12 +771,7 @@ function thingy_with_unique_id() { result="$output" assert "$result" =~ "/" ".CgroupPath is a valid path" - if is_cgroupsv2; then - cgroup_path=/sys/fs/cgroup/$result - else - cgroup_path=/sys/fs/cgroup/memory/$result - fi - + cgroup_path=/sys/fs/cgroup/$result if test ! -e $cgroup_path; then die "the cgroup $cgroup_path does not exist" fi @@ -793,11 +788,7 @@ function thingy_with_unique_id() { # validate that cgroup limits are in place after a restart # issue #19175 - if is_cgroupsv2; then - memory_limit_file=$cgroup_path/memory.max - else - memory_limit_file=$cgroup_path/memory.limit_in_bytes - fi + memory_limit_file=$cgroup_path/memory.max assert "$(< $memory_limit_file)" = "268435456" "Contents of $memory_limit_file" run_podman pod rm -t 0 -f $podid diff --git a/test/system/280-update.bats b/test/system/280-update.bats index e83d5db5f7..52ffa6d864 100644 --- a/test/system/280-update.bats +++ b/test/system/280-update.bats @@ -17,55 +17,41 @@ function teardown() { @test "podman update - test all options" { - local cgv=1 - if is_cgroupsv2; then - cgv=2; - fi - # Need a block device for blkio-weight-device testing local pass_loop_device= if ! is_rootless; then - if is_cgroupsv2; then - lofile=${PODMAN_TMPDIR}/disk.img - fallocate -l 1k ${lofile} - LOOPDEVICE=$(losetup --show -f $lofile) - pass_loop_device="--device $LOOPDEVICE" + lofile=${PODMAN_TMPDIR}/disk.img + fallocate -l 1k ${lofile} + LOOPDEVICE=$(losetup --show -f $lofile) + pass_loop_device="--device $LOOPDEVICE" - # Get maj:min (tr needed because losetup seems to use %2d) - lomajmin=$(losetup -l --noheadings --output MAJ:MIN $LOOPDEVICE | tr -d ' ') - fi + # Get maj:min (tr needed because losetup seems to use %2d) + lomajmin=$(losetup -l --noheadings --output MAJ:MIN $LOOPDEVICE | tr -d ' ') fi # Shortcuts to make the table narrower local -a gig=(0 1073741824 2147483648 3221225472) local devicemax="1:5 rbps=10485760 wbps=31457280 riops=2000 wiops=4000" - local mm=memory/memory # Format: - # --