@@ -18,7 +18,6 @@ package cgroups
1818
1919import (
2020 "fmt"
21- "io/ioutil"
2221 "os"
2322 "path/filepath"
2423 "strconv"
@@ -30,7 +29,7 @@ import (
3029// using t.Error in test were defers do cleanup on the filesystem
3130
3231func TestCreate (t * testing.T ) {
33- mock , err := newMock ()
32+ mock , err := newMock (t )
3433 if err != nil {
3534 t .Fatal (err )
3635 }
@@ -57,7 +56,7 @@ func TestCreate(t *testing.T) {
5756}
5857
5958func TestStat (t * testing.T ) {
60- mock , err := newMock ()
59+ mock , err := newMock (t )
6160 if err != nil {
6261 t .Fatal (err )
6362 }
@@ -79,7 +78,7 @@ func TestStat(t *testing.T) {
7978}
8079
8180func TestAdd (t * testing.T ) {
82- mock , err := newMock ()
81+ mock , err := newMock (t )
8382 if err != nil {
8483 t .Fatal (err )
8584 }
@@ -102,7 +101,7 @@ func TestAdd(t *testing.T) {
102101}
103102
104103func TestAddFilteredSubsystems (t * testing.T ) {
105- mock , err := newMock ()
104+ mock , err := newMock (t )
106105 if err != nil {
107106 t .Fatal (err )
108107 }
@@ -159,7 +158,7 @@ func TestAddFilteredSubsystems(t *testing.T) {
159158}
160159
161160func TestAddTask (t * testing.T ) {
162- mock , err := newMock ()
161+ mock , err := newMock (t )
163162 if err != nil {
164163 t .Fatal (err )
165164 }
@@ -182,7 +181,7 @@ func TestAddTask(t *testing.T) {
182181}
183182
184183func TestAddTaskFilteredSubsystems (t * testing.T ) {
185- mock , err := newMock ()
184+ mock , err := newMock (t )
186185 if err != nil {
187186 t .Fatal (err )
188187 }
@@ -224,7 +223,7 @@ func TestAddTaskFilteredSubsystems(t *testing.T) {
224223}
225224
226225func TestListPids (t * testing.T ) {
227- mock , err := newMock ()
226+ mock , err := newMock (t )
228227 if err != nil {
229228 t .Fatal (err )
230229 }
@@ -259,7 +258,7 @@ func TestListPids(t *testing.T) {
259258}
260259
261260func TestListTasksPids (t * testing.T ) {
262- mock , err := newMock ()
261+ mock , err := newMock (t )
263262 if err != nil {
264263 t .Fatal (err )
265264 }
@@ -294,7 +293,7 @@ func TestListTasksPids(t *testing.T) {
294293}
295294
296295func readValue (mock * mockCgroup , path string ) (string , error ) {
297- data , err := ioutil .ReadFile (filepath .Join (mock .root , path ))
296+ data , err := os .ReadFile (filepath .Join (mock .root , path ))
298297 if err != nil {
299298 return "" , err
300299 }
@@ -346,7 +345,7 @@ func mockNewNotInRdma(subsystems []Subsystem, path Path, resources *specs.LinuxR
346345}
347346
348347func TestLoad (t * testing.T ) {
349- mock , err := newMock ()
348+ mock , err := newMock (t )
350349 if err != nil {
351350 t .Fatal (err )
352351 }
@@ -367,7 +366,7 @@ func TestLoad(t *testing.T) {
367366}
368367
369368func TestLoadWithMissingSubsystems (t * testing.T ) {
370- mock , err := newMock ()
369+ mock , err := newMock (t )
371370 if err != nil {
372371 t .Fatal (err )
373372 }
@@ -401,7 +400,7 @@ func TestLoadWithMissingSubsystems(t *testing.T) {
401400}
402401
403402func TestDelete (t * testing.T ) {
404- mock , err := newMock ()
403+ mock , err := newMock (t )
405404 if err != nil {
406405 t .Fatal (err )
407406 }
@@ -417,7 +416,7 @@ func TestDelete(t *testing.T) {
417416}
418417
419418func TestCreateSubCgroup (t * testing.T ) {
420- mock , err := newMock ()
419+ mock , err := newMock (t )
421420 if err != nil {
422421 t .Fatal (err )
423422 }
@@ -455,7 +454,7 @@ func TestCreateSubCgroup(t *testing.T) {
455454}
456455
457456func TestFreezeThaw (t * testing.T ) {
458- mock , err := newMock ()
457+ mock , err := newMock (t )
459458 if err != nil {
460459 t .Fatal (err )
461460 }
@@ -484,7 +483,7 @@ func TestFreezeThaw(t *testing.T) {
484483}
485484
486485func TestSubsystems (t * testing.T ) {
487- mock , err := newMock ()
486+ mock , err := newMock (t )
488487 if err != nil {
489488 t .Fatal (err )
490489 }
@@ -507,7 +506,7 @@ func TestSubsystems(t *testing.T) {
507506
508507func TestCpusetParent (t * testing.T ) {
509508 const expected = "0-3"
510- mock , err := newMock ()
509+ mock , err := newMock (t )
511510 if err != nil {
512511 t .Fatal (err )
513512 }
0 commit comments