aboutsummaryrefslogtreecommitdiff
path: root/pkg/spec/spec_test.go
diff options
context:
space:
mode:
authorDanila Kiver <danila.kiver@mail.ru>2019-09-15 21:28:13 +0300
committerDanila Kiver <danila.kiver@mail.ru>2019-09-15 21:28:13 +0300
commitc06661f041f0fcef4bed0f44feecef1e1a5abe3e (patch)
tree60e1dfaf2163c298aef74a05479b6f8d6ea5f76b /pkg/spec/spec_test.go
parent8ac57b48e1220490716d7281b140c2d96746fb02 (diff)
downloadpodman-c06661f041f0fcef4bed0f44feecef1e1a5abe3e.tar.gz
podman-c06661f041f0fcef4bed0f44feecef1e1a5abe3e.tar.bz2
podman-c06661f041f0fcef4bed0f44feecef1e1a5abe3e.zip
Check for rootless before checking cgroups version in spec_test.
Signed-off-by: Danila Kiver <danila.kiver@mail.ru>
Diffstat (limited to 'pkg/spec/spec_test.go')
-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")
+ }
}
}