using t.Error in test were defers do cleanup on the filesystem
(t *testing.T)
| 29 | // using t.Error in test were defers do cleanup on the filesystem |
| 30 | |
| 31 | func 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 | |
| 62 | func TestStat(t *testing.T) { |
| 63 | mock, err := newMock(t) |
nothing calls this directly
no test coverage detected
searching dependent graphs…