Skip to content

Commit

Permalink
cluster: remove created directories after fio test in `tiup cluster c…
Browse files Browse the repository at this point in the history
…heck` (#2511)

* remove checkDir

* update to dir

* use iteration
  • Loading branch information
djshow832 authored Feb 18, 2025
1 parent 5454848 commit 6552f30
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pkg/cluster/task/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,19 @@ func (c *CheckSys) runFIO(ctx context.Context) (outRR []byte, outRW []byte, outL
testWd := filepath.Join(checkDir, "tiup-fio-test")
fioBin := filepath.Join(CheckToolsPathDir, "bin", "fio")

notExistDir := testWd
for {
parent := filepath.Dir(notExistDir)
if len(parent) <= 1 {
break
}
results := operator.CheckDirIsExist(ctx, e, parent)
if len(results) > 0 {
break
}
notExistDir = parent
}

var stderr []byte

// rand read
Expand Down Expand Up @@ -309,7 +322,7 @@ func (c *CheckSys) runFIO(ctx context.Context) (outRR []byte, outRW []byte, outL
// cleanup
_, stderr, err = e.Execute(
ctx,
fmt.Sprintf("rm -rf %s", testWd),
fmt.Sprintf("rm -rf %s", notExistDir),
false,
)
if err != nil {
Expand Down

0 comments on commit 6552f30

Please sign in to comment.