mirror of
https://github.com/restic/restic.git
synced 2025-10-09 07:33:53 +00:00
test: Use testing.T.Cleanup to remove tempdirs
This commit is contained in:
@@ -10,8 +10,7 @@ import (
|
||||
)
|
||||
|
||||
func TestLayout(t *testing.T) {
|
||||
path, cleanup := rtest.TempDir(t)
|
||||
defer cleanup()
|
||||
path := rtest.TempDir(t)
|
||||
|
||||
var tests = []struct {
|
||||
filename string
|
||||
|
@@ -24,8 +24,7 @@ func TestNoSpacePermanent(t *testing.T) {
|
||||
return nil, fmt.Errorf("not creating tempfile, %w", syscall.ENOSPC)
|
||||
}
|
||||
|
||||
dir, cleanup := rtest.TempDir(t)
|
||||
defer cleanup()
|
||||
dir := rtest.TempDir(t)
|
||||
|
||||
be, err := Open(context.Background(), Config{Path: dir, Connections: 2})
|
||||
rtest.OK(t, err)
|
||||
|
@@ -120,8 +120,7 @@ func removeAll(t testing.TB, dir string) {
|
||||
}
|
||||
|
||||
func TestOpenNotExistingDirectory(t *testing.T) {
|
||||
dir, cleanup := rtest.TempDir(t)
|
||||
defer cleanup()
|
||||
dir := rtest.TempDir(t)
|
||||
|
||||
// local.Open must not create any files dirs in the repo
|
||||
openclose(t, filepath.Join(dir, "repo"))
|
||||
|
Reference in New Issue
Block a user