test: Use testing.T.Cleanup to remove tempdirs
This commit is contained in:
parent
eae7366563
commit
f90bf84ba7
31 changed files with 79 additions and 176 deletions
6
internal/cache/testing.go
vendored
6
internal/cache/testing.go
vendored
|
@ -9,12 +9,12 @@ import (
|
|||
|
||||
// TestNewCache returns a cache in a temporary directory which is removed when
|
||||
// cleanup is called.
|
||||
func TestNewCache(t testing.TB) (*Cache, func()) {
|
||||
dir, cleanup := test.TempDir(t)
|
||||
func TestNewCache(t testing.TB) *Cache {
|
||||
dir := test.TempDir(t)
|
||||
t.Logf("created new cache at %v", dir)
|
||||
cache, err := New(restic.NewRandomID().String(), dir)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return cache, cleanup
|
||||
return cache
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue