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

Function TestCreate

cgroup1/cgroup_test.go:31–60  ·  view source on GitHub ↗

using t.Error in test were defers do cleanup on the filesystem

(t *testing.T)

Source from the content-addressed store, hash-verified

29// using t.Error in test were defers do cleanup on the filesystem
30
31func TestCreate(t *testing.T) {
32 mock, err := newMock(t)
33 if err != nil {
34 t.Fatal(err)
35 }
36 defer func() {
37 if err := mock.delete(); err != nil {
38 t.Errorf("failed delete: %v", err)
39 }
40 }()
41 control, err := New(StaticPath("test"), &specs.LinuxResources{}, WithHierarchy(mock.hierarchy))
42 if err != nil {
43 t.Error(err)
44 return
45 }
46 if control == nil {
47 t.Error("control is nil")
48 return
49 }
50 for _, s := range Subsystems() {
51 if _, err := os.Stat(filepath.Join(mock.root, string(s), "test")); err != nil {
52 if os.IsNotExist(err) {
53 t.Errorf("group %s was not created", s)
54 return
55 }
56 t.Errorf("group %s was not created correctly %s", s, err)
57 return
58 }
59 }
60}
61
62func TestStat(t *testing.T) {
63 mock, err := newMock(t)

Callers

nothing calls this directly

Calls 7

newMockFunction · 0.85
NewFunction · 0.85
StaticPathFunction · 0.85
WithHierarchyFunction · 0.85
SubsystemsFunction · 0.85
deleteMethod · 0.80
StatMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…