Skip to content

Commit

Permalink
remove temporary paths at one place
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana committed Feb 26, 2022
1 parent e929e82 commit c33ec02
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pkg/dperf/perf.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ func mustGetUUID() string {

func (d *DrivePerf) runTests(ctx context.Context, path string) (dr *DrivePerfResult) {
tmpPath := filepath.Join(path, ".writable-check.tmp")
defer func() {
if dr.Error == nil {
os.RemoveAll(dr.Path)
}
}()

writeThroughput, err := d.runWriteTest(ctx, tmpPath)
if err != nil {
Expand Down Expand Up @@ -101,6 +96,10 @@ func (d *DrivePerf) Run(ctx context.Context, paths ...string) ([]*DrivePerfResul
wg.Wait()
}

for _, res := range results {
os.RemoveAll(res.Path)
}

sort.Slice(results, func(i, j int) bool {
return results[i].ReadThroughput > results[j].ReadThroughput
})
Expand Down

0 comments on commit c33ec02

Please sign in to comment.