Skip to content

Commit

Permalink
test: remove (*FileTestUtil).Cleanup()
Browse files Browse the repository at this point in the history
NewFileTestUtil now uses t.TempDir() to create temporary directory so
manual cleanup is no longer necessary.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
  • Loading branch information
Juneezee committed May 19, 2022
1 parent 2ff9964 commit 10ed0d1
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/koordlet/resmanager/cgroup_reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ func TestCgroupResourceReconcile_calculateResources(t *testing.T) {
assert.NoError(t, err)
defer func() { stop <- struct{}{} }()

_ = system.NewFileTestUtil(t)
system.NewFileTestUtil(t)

got, got1, got2 := m.calculateResources(tt.args.nodeCfg, tt.args.node, tt.args.podMetas)
assertCgroupResourceEqual(t, tt.want, got)
Expand Down
2 changes: 1 addition & 1 deletion pkg/koordlet/resmanager/resctrl_reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ func Test_getPodCgroupNewTaskIds(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
_ = system.NewFileTestUtil(t)
system.NewFileTestUtil(t)

testingPrepareContainerCgroupCPUTasks(t,
tt.fields.containerParentDir, tt.fields.containerTasksStr)
Expand Down
4 changes: 0 additions & 4 deletions pkg/util/system/util_test_tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ func NewFileTestUtil(t *testing.T) *FileTestUtil {
return &FileTestUtil{TempDir: tempDir, t: t}
}

func (c *FileTestUtil) Cleanup() {
os.RemoveAll(c.TempDir)
}

func (c *FileTestUtil) MkDirAll(dirRelativePath string) {
dir := path.Join(c.TempDir, dirRelativePath)
if err := os.MkdirAll(dir, 0777); err != nil {
Expand Down

0 comments on commit 10ed0d1

Please sign in to comment.