diff --git a/test/apiv2/01-basic.at b/test/apiv2/01-basic.at index 6fb1895751..b48a15e7ea 100644 --- a/test/apiv2/01-basic.at +++ b/test/apiv2/01-basic.at @@ -48,13 +48,8 @@ t GET libpod/containers/create 405 # # system info # -# Some day perhaps it will always be runc; for now, cgroupsv2 requires crun -# # FIXME: run 'podman info --format=json', and compare select fields -runtime=runc -if have_cgroupsv2; then - runtime=crun -fi +runtime=crun t GET info 200 \ .OSType=linux \ .DefaultRuntime~.*$runtime \ diff --git a/test/apiv2/25-containersMore.at b/test/apiv2/25-containersMore.at index a7679817ad..6892a80a1e 100644 --- a/test/apiv2/25-containersMore.at +++ b/test/apiv2/25-containersMore.at @@ -17,27 +17,16 @@ t GET libpod/containers/nonesuch/exists 404 t GET libpod/containers/foo/exists 204 # Pause and Unpause the container -if root || have_cgroupsv2; then - t POST libpod/containers/foo/pause 204 +t POST libpod/containers/foo/pause 204 - t GET libpod/containers/foo/json 200 \ - .Id~[0-9a-f]\\{64\\} \ - .State.Status=paused \ - .ImageName=$IMAGE \ - .Config.Cmd[0]=top \ - .Name=foo +t GET libpod/containers/foo/json 200 \ + .Id~[0-9a-f]\\{64\\} \ + .State.Status=paused \ + .ImageName=$IMAGE \ + .Config.Cmd[0]=top \ + .Name=foo - t POST libpod/containers/foo/unpause 204 -else - # cgroupsv1 rootless : pause and unpause are not supported in cgroups v1 rootless - t POST libpod/containers/foo/pause 500 \ - .cause="this container does not have a cgroup" \ - .message~".*pause containers on rootless containers with cgroup V1" - - t POST libpod/containers/foo/unpause 500 \ - .cause="container state improper" \ - .message~".*is not paused, can't unpause: container state improper" -fi +t POST libpod/containers/foo/unpause 204 t GET libpod/containers/foo/json 200 \ .Id~[0-9a-f]\\{64\\} \ diff --git a/test/apiv2/40-pods.at b/test/apiv2/40-pods.at index b50cb1686e..6492515eea 100644 --- a/test/apiv2/40-pods.at +++ b/test/apiv2/40-pods.at @@ -47,14 +47,8 @@ t POST libpod/pods/fakename/start 404 \ .cause="no such pod" \ .message="no pod with name or ID fakename found: no such pod" -if root || have_cgroupsv2; then - t POST libpod/pods/foo/pause 200 -else - # Rootless cgroupsv1 : unsupported - t POST "libpod/pods/foo/pause (rootless cgroups v1)" 500 \ - .cause="this container does not have a cgroup" \ - .message~".*pause pods containing rootless containers with cgroup V1" -fi + +t POST libpod/pods/foo/pause 200 t POST libpod/pods/foo/unpause 200 t POST "libpod/pods/foo/unpause (2nd unpause in a row)" 200 t POST "libpod/pods/fakename/unpause" 404\ @@ -108,28 +102,21 @@ t POST libpod/pods/bar/stop?t=1 200 \ t POST libpod/pods/bar/start 200 -if root || have_cgroupsv2; then - t GET libpod/pods/stats?all=true 200 - is $(jq '. | length' <<<"$output") 3 "stats?all=true: number of records found" +t GET libpod/pods/stats?all=true 200 +is $(jq '. | length' <<<"$output") 3 "stats?all=true: number of records found" - t GET libpod/pods/stats?namesOrIDs=foo 200 - is $(jq '. | length' <<<"$output") 1 "stats?namesOrIDs=foo: number of records found" +t GET libpod/pods/stats?namesOrIDs=foo 200 +is $(jq '. | length' <<<"$output") 1 "stats?namesOrIDs=foo: number of records found" - t GET libpod/pods/stats?namesOrIDs=fakename 404 \ - .cause="no such pod" \ - .message="unable to get list of pods: no pod with name or ID fakename found: no such pod" +t GET libpod/pods/stats?namesOrIDs=fakename 404 \ + .cause="no such pod" \ + .message="unable to get list of pods: no pod with name or ID fakename found: no such pod" - t GET "libpod/pods/stats?all=true&namesOrIDs=foo" 500 \ - .cause="--all, --latest and arguments cannot be used together" \ - .message="--all, --latest and arguments cannot be used together" +t GET "libpod/pods/stats?all=true&namesOrIDs=foo" 500 \ + .cause="--all, --latest and arguments cannot be used together" \ + .message="--all, --latest and arguments cannot be used together" - t DELETE libpod/pods/bar?force=true 200 -else - # Rootless cgroupsv1 : libpod/pods/stats is unsupported - t GET libpod/pods/stats?all=true 500 \ - .cause="pod stats is not supported in rootless mode without cgroups v2" \ - .message~"pod stats is not supported in rootless mode without cgroups v2" -fi +t DELETE libpod/pods/bar?force=true 200 # test the fake name t GET libpod/pods/fakename/top 404 \ @@ -161,10 +148,8 @@ t DELETE libpod/pods/foo 200 t DELETE "libpod/pods/foo (pod has already been deleted)" 404 # Expect this to time out -if root || have_cgroupsv2; then - # Rootless cgroupsv1 : libpod/pods/stats is unsupported - APIV2_TEST_EXPECT_TIMEOUT=5 t GET "libpod/pods/stats?stream=true&delay=1" 999 -fi +# Rootless cgroupsv1 : libpod/pods/stats is unsupported +APIV2_TEST_EXPECT_TIMEOUT=5 t GET "libpod/pods/stats?stream=true&delay=1" 999 podman pod create --name=specgen diff --git a/test/apiv2/test-apiv2 b/test/apiv2/test-apiv2 index 689f9d85b7..3254cd8e76 100755 --- a/test/apiv2/test-apiv2 +++ b/test/apiv2/test-apiv2 @@ -675,12 +675,6 @@ function rootless() { test "$ROOTLESS" = "true" } -# True if cgroups v2 are enabled -function have_cgroupsv2() { - cgroup_type=$(stat -f -c %T /sys/fs/cgroup) - test "$cgroup_type" = "cgroup2fs" -} - # END infrastructure code ############################################################################### # BEGIN sanity checks 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: - # --