(t *testing.T)
| 45 | } |
| 46 | |
| 47 | func 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 |
| 65 | func TestIgnoreUnitExistsWhenPidNegativeOne(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…