Check for rootless before checking cgroups version in spec_test.
@@ -36,15 +36,17 @@ func doCommonSkipChecks(t *testing.T) {
t.Skip("seccomp, which is enabled by default, is only supported on Linux")
}
- isUnified, err := cgroups.IsCgroup2UnifiedMode()
+ if rootless.IsRootless() {
+ isCgroupV2, err := cgroups.IsCgroup2UnifiedMode()
if err != nil {
t.Errorf("unexpected error: %v", err)
}
- if rootless.IsRootless() && !isUnified {
+ if !isCgroupV2 {
t.Skip("cgroups v1 cannot be used when rootless")
}
}
+}
// TestPIDsLimit verifies the given pid-limit is correctly defined in the spec
func TestPIDsLimit(t *testing.T) {
