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

@ -112,9 +112,7 @@ func TestBackendREST(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
dir, cleanup := rtest.TempDir(t)
defer cleanup()
dir := rtest.TempDir(t)
serverURL, cleanup := runRESTServer(ctx, t, dir)
defer cleanup()
@ -144,9 +142,7 @@ func BenchmarkBackendREST(t *testing.B) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
dir, cleanup := rtest.TempDir(t)
defer cleanup()
dir := rtest.TempDir(t)
serverURL, cleanup := runRESTServer(ctx, t, dir)
defer cleanup()