minio/internal/disk
Eng Zer Jun 0a3b1ad4eb
test: use `T.TempDir` to create temporary test directory (#15400)
This commit replaces `ioutil.TempDir` with `t.TempDir` in tests. The
directory created by `t.TempDir` is automatically removed when the test
and all its subtests complete.

Prior to this commit, temporary directory created using `ioutil.TempDir`
needs to be removed manually by calling `os.RemoveAll`, which is omitted
in some tests. The error handling boilerplate e.g.
	defer func() {
		if err := os.RemoveAll(dir); err != nil {
			t.Fatal(err)
		}
	}
is also tedious, but `t.TempDir` handles this for us nicely.

Reference: https://pkg.go.dev/testing#T.TempDir

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-07-25 12:37:26 -07:00
..
directio_darwin.go rename all remaining packages to internal/ (#12418) 2021-06-01 14:59:40 -07:00
directio_unix.go add gocritic/ruleguard checks back again, cleanup code. (#13665) 2021-11-16 09:28:29 -08:00
directio_unsupported.go fix: enable go1.17 github ci/cd (#12997) 2021-08-18 18:35:22 -07:00
disk.go rename all remaining packages to internal/ (#12418) 2021-06-01 14:59:40 -07:00
disk_test.go test: use `T.TempDir` to create temporary test directory (#15400) 2022-07-25 12:37:26 -07:00
disk_unix.go fix: enable go1.17 github ci/cd (#12997) 2021-08-18 18:35:22 -07:00
disk_windows.go fix: enable go1.17 github ci/cd (#12997) 2021-08-18 18:35:22 -07:00
fdatasync_linux.go use O_DIRECT for all ReadFileStream (#13324) 2021-09-29 16:40:28 -07:00
fdatasync_unix.go use O_DIRECT for all ReadFileStream (#13324) 2021-09-29 16:40:28 -07:00
fdatasync_unsupported.go use O_DIRECT for all ReadFileStream (#13324) 2021-09-29 16:40:28 -07:00
root_disk.go rename all remaining packages to internal/ (#12418) 2021-06-01 14:59:40 -07:00
stat_bsd.go fix: enable go1.17 github ci/cd (#12997) 2021-08-18 18:35:22 -07:00
stat_freebsd.go fix: enable go1.17 github ci/cd (#12997) 2021-08-18 18:35:22 -07:00
stat_linux.go fix: enable go1.17 github ci/cd (#12997) 2021-08-18 18:35:22 -07:00
stat_linux_32bit.go fix: enable go1.17 github ci/cd (#12997) 2021-08-18 18:35:22 -07:00
stat_linux_s390x.go fix: enable go1.17 github ci/cd (#12997) 2021-08-18 18:35:22 -07:00
stat_netbsd.go fix: enable go1.17 github ci/cd (#12997) 2021-08-18 18:35:22 -07:00
stat_openbsd.go fix: enable go1.17 github ci/cd (#12997) 2021-08-18 18:35:22 -07:00
stat_solaris.go fix: enable go1.17 github ci/cd (#12997) 2021-08-18 18:35:22 -07:00
stat_windows.go fix: enable go1.17 github ci/cd (#12997) 2021-08-18 18:35:22 -07:00
type_bsd.go fix: enable go1.17 github ci/cd (#12997) 2021-08-18 18:35:22 -07:00
type_linux.go fix: enable go1.17 github ci/cd (#12997) 2021-08-18 18:35:22 -07:00
type_windows.go run gofumpt cleanup across code-base (#14015) 2022-01-02 09:15:06 -08:00