tests/int: add a case for cgroupv2 mount
This checks that in-container view of /sys/fs/cgroup does not
contain any extra cgroups (which was the case for rootless
before the previous commit).
@@ -236,3 +236,18 @@ function setup() {
check_cpu_weight 42
}
+
+@test "runc run (cgroupv2 mount inside container)" {
+ requires cgroups_v2
+ [[ "$ROOTLESS" -ne 0 ]] && requires rootless_cgroup
+
+ set_cgroups_path
+
+ runc run -d --console-socket "$CONSOLE_SOCKET" test_cgroups_unified
+ [ "$status" -eq 0 ]
+
+ # Make sure we don't have any extra cgroups inside
+ runc exec test_cgroups_unified find /sys/fs/cgroup/ -type d
+ [ "$status" -eq 0 ]
+ [ "$(wc -l <<<"$output")" -eq 1 ]
+}
