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:
@@ -122,18 +122,10 @@ func TestBtrfsMounts(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
// create temporary directory for mount point
|
||||
mountPoint, err := os.MkdirTemp("", "containerd-btrfs-test")
|
||||
if err != nil {
|
||||
t.Fatal("could not create mount point for btrfs test", err)
|
||||
}
|
||||
defer os.RemoveAll(mountPoint)
|
||||
mountPoint := t.TempDir()
|
||||
t.Log("temporary mount point created", mountPoint)
|
||||
|
||||
root, err := os.MkdirTemp(mountPoint, "TestBtrfsPrepare-")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer os.RemoveAll(root)
|
||||
root := t.TempDir()
|
||||
|
||||
b, c, err := boltSnapshotter(t)(ctx, root)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user