aboutsummaryrefslogtreecommitdiff
path: root/utils/utils_test.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-05-25 08:53:15 -0400
committerGitHub <noreply@github.com>2022-05-25 08:53:15 -0400
commit1dcd1c970d3438bd6044cce0aba9b7258cb6849d (patch)
treecaba8a5ca67cb093c456f4f532d03bdff4591d7f /utils/utils_test.go
parentda26439e2976cf1d6da0f9078e9c7eddebbab45c (diff)
parent94e82121bf73c163d86d99fa37b0d64adf996fba (diff)
downloadpodman-1dcd1c970d3438bd6044cce0aba9b7258cb6849d.tar.gz
podman-1dcd1c970d3438bd6044cce0aba9b7258cb6849d.tar.bz2
podman-1dcd1c970d3438bd6044cce0aba9b7258cb6849d.zip
Merge pull request #14308 from n1hility/root-cgroup
Support running podman under a root v2 cgroup
Diffstat (limited to 'utils/utils_test.go')
-rw-r--r--utils/utils_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/utils/utils_test.go b/utils/utils_test.go
new file mode 100644
index 000000000..f34dbdd7e
--- /dev/null
+++ b/utils/utils_test.go
@@ -0,0 +1,26 @@
+//go:build linux || darwin
+// +build linux darwin
+
+package utils
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestCgroupProcess(t *testing.T) {
+ val, err := getCgroupProcess("testdata/cgroup.root", true)
+ assert.Nil(t, err)
+ assert.Equal(t, "/", val)
+
+ _, err = getCgroupProcess("testdata/cgroup.root", false)
+ assert.NotNil(t, err)
+
+ val, err = getCgroupProcess("testdata/cgroup.other", true)
+ assert.Nil(t, err)
+ assert.Equal(t, "/other", val)
+
+ _, err = getCgroupProcess("testdata/cgroup.empty", true)
+ assert.NotNil(t, err)
+}