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

Function TestPidPath

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

Source from the content-addressed store, hash-verified

59}
60
61func TestPidPath(t *testing.T) {
62 _, err := v1MountPoint()
63 if err == ErrMountPointNotExist {
64 t.Skip("skipping test that requires cgroup hierarchy")
65 } else if err != nil {
66 t.Fatal(err)
67 }
68 paths, err := ParseCgroupFile("/proc/self/cgroup")
69 if err != nil {
70 t.Fatal(err)
71 }
72 dp := strings.TrimPrefix(paths["devices"], "/")
73 path := PidPath(os.Getpid())
74 p, err := path("devices")
75 if err != nil {
76 t.Fatal(err)
77 }
78 if p != filepath.Join("/", dp) {
79 t.Fatalf("expected self path of %q but received %q", filepath.Join("/", dp), p)
80 }
81}
82
83func TestRootPath(t *testing.T) {
84 p, err := RootPath(Cpu)

Callers

nothing calls this directly

Calls 3

v1MountPointFunction · 0.85
ParseCgroupFileFunction · 0.85
PidPathFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…