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

Function TestErrorsWhenUnitAlreadyExists

cgroup2/manager_test.go:47–62  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

45}
46
47func TestErrorsWhenUnitAlreadyExists(t *testing.T) {
48 checkCgroupMode(t)
49
50 cmd, group := setupForNewSystemd(t)
51 proc := cmd.Process
52
53 _, err := NewSystemd("", group, proc.Pid, &Resources{})
54 require.NoError(t, err, "Failed to init new cgroup manager")
55
56 _, err = NewSystemd("", group, proc.Pid, &Resources{})
57 if err == nil {
58 t.Fatal("Expected recreating cgroup manager should fail")
59 } else if !isUnitExists(err) {
60 t.Fatalf("Failed to init cgroup manager with unexpected error: %s", err)
61 }
62}
63
64// kubelet relies on this behavior to make sure a slice exists
65func TestIgnoreUnitExistsWhenPidNegativeOne(t *testing.T) {

Callers

nothing calls this directly

Calls 4

checkCgroupModeFunction · 0.85
setupForNewSystemdFunction · 0.85
isUnitExistsFunction · 0.85
NewSystemdFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…