test: use T.TempDir
to create temporary test directory
The directory created by `T.TempDir` is automatically removed when the test and all its subtests complete. Reference: https://pkg.go.dev/testing#T.TempDir Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
@@ -455,11 +455,7 @@ func TestCheckpointRestoreWithImagePath(t *testing.T) {
|
||||
}
|
||||
|
||||
// create image path store criu image files
|
||||
crDir, err := os.MkdirTemp("", "test-cr")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer os.RemoveAll(crDir)
|
||||
crDir := t.TempDir()
|
||||
imagePath := filepath.Join(crDir, "cr")
|
||||
// checkpoint task
|
||||
if _, err := task.Checkpoint(ctx, WithCheckpointImagePath(imagePath)); err != nil {
|
||||
|
Reference in New Issue
Block a user