test: Use testing.T.Cleanup to remove tempdirs

This commit is contained in:
greatroar 2022-12-09 13:42:33 +01:00
parent eae7366563
commit f90bf84ba7
31 changed files with 79 additions and 176 deletions

View file

@ -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
},
}
}