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

Function TestAdd

cgroup1/cgroup_test.go:88–113  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

86}
87
88func TestAdd(t *testing.T) {
89 mock, err := newMock(t)
90 if err != nil {
91 t.Fatal(err)
92 }
93 defer func() {
94 if err := mock.delete(); err != nil {
95 t.Errorf("failed delete: %v", err)
96 }
97 }()
98 control, err := New(StaticPath("test"), &specs.LinuxResources{}, WithHierarchy(mock.hierarchy))
99 if err != nil {
100 t.Error(err)
101 return
102 }
103 if err := control.Add(Process{Pid: 1234}); err != nil {
104 t.Error(err)
105 return
106 }
107 for _, s := range Subsystems() {
108 if err := checkPid(mock, filepath.Join(string(s), "test"), 1234); err != nil {
109 t.Error(err)
110 return
111 }
112 }
113}
114
115func TestAddFilteredSubsystems(t *testing.T) {
116 mock, err := newMock(t)

Callers

nothing calls this directly

Calls 8

newMockFunction · 0.85
NewFunction · 0.85
StaticPathFunction · 0.85
WithHierarchyFunction · 0.85
SubsystemsFunction · 0.85
checkPidFunction · 0.85
deleteMethod · 0.80
AddMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…