summaryrefslogtreecommitdiff
path: root/pkg/spec
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/spec')
-rw-r--r--pkg/spec/spec_test.go16
1 files changed, 9 insertions, 7 deletions
diff --git a/pkg/spec/spec_test.go b/pkg/spec/spec_test.go
index 54d964a3a..2f91e1b21 100644
--- a/pkg/spec/spec_test.go
+++ b/pkg/spec/spec_test.go
@@ -36,13 +36,15 @@ func doCommonSkipChecks(t *testing.T) {
t.Skip("seccomp, which is enabled by default, is only supported on Linux")
}
- isUnified, err := cgroups.IsCgroup2UnifiedMode()
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
-
- if rootless.IsRootless() && !isUnified {
- t.Skip("cgroups v1 cannot be used when rootless")
+ if rootless.IsRootless() {
+ isCgroupV2, err := cgroups.IsCgroup2UnifiedMode()
+ if err != nil {
+ t.Errorf("unexpected error: %v", err)
+ }
+
+ if !isCgroupV2 {
+ t.Skip("cgroups v1 cannot be used when rootless")
+ }
}
}