MCPcopy Create free account
hub / github.com/containerd/cgroups / TestSelfPath

Function TestSelfPath

cgroup1/paths_test.go:39–59  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

37}
38
39func TestSelfPath(t *testing.T) {
40 _, err := v1MountPoint()
41 if err == ErrMountPointNotExist {
42 t.Skip("skipping test that requires cgroup hierarchy")
43 } else if err != nil {
44 t.Fatal(err)
45 }
46 paths, err := ParseCgroupFile("/proc/self/cgroup")
47 if err != nil {
48 t.Fatal(err)
49 }
50 dp := strings.TrimPrefix(paths["devices"], "/")
51 path := NestedPath("test")
52 p, err := path("devices")
53 if err != nil {
54 t.Fatal(err)
55 }
56 if p != filepath.Join("/", dp, "test") {
57 t.Fatalf("expected self path of %q but received %q", filepath.Join("/", dp, "test"), p)
58 }
59}
60
61func TestPidPath(t *testing.T) {
62 _, err := v1MountPoint()

Callers

nothing calls this directly

Calls 3

v1MountPointFunction · 0.85
ParseCgroupFileFunction · 0.85
NestedPathFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…