mirror of
https://github.com/restic/restic.git
synced 2025-10-09 19:10:25 +00:00
test: Use testing.T.Cleanup to remove tempdirs
This commit is contained in:
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func newTestSuite(t testing.TB) *test.Suite {
|
||||
dir, cleanup := rtest.TempDir(t)
|
||||
dir := rtest.TempDir(t)
|
||||
|
||||
return &test.Suite{
|
||||
// NewConfig returns a config for a new temporary backend that will be used in tests.
|
||||
@@ -43,13 +43,6 @@ func newTestSuite(t testing.TB) *test.Suite {
|
||||
cfg := config.(rclone.Config)
|
||||
return rclone.Open(cfg, nil)
|
||||
},
|
||||
|
||||
// CleanupFn removes data created during the tests.
|
||||
Cleanup: func(config interface{}) error {
|
||||
t.Logf("cleanup dir %v", dir)
|
||||
cleanup()
|
||||
return nil
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -12,9 +12,7 @@ import (
|
||||
|
||||
// restic should detect rclone exiting.
|
||||
func TestRcloneExit(t *testing.T) {
|
||||
dir, cleanup := rtest.TempDir(t)
|
||||
defer cleanup()
|
||||
|
||||
dir := rtest.TempDir(t)
|
||||
cfg := NewConfig()
|
||||
cfg.Remote = dir
|
||||
be, err := Open(cfg, nil)
|
||||
|
Reference in New Issue
Block a user