repository: Remove empty cleanup functions in tests
TestRepository and its variants always returned no-op cleanup functions. If they ever do need to do cleanup, using testing.T.Cleanup is easier than passing these functions around.
This commit is contained in:
parent
f90bf84ba7
commit
c0b5ec55ab
19 changed files with 91 additions and 190 deletions
|
@ -12,13 +12,13 @@ import (
|
|||
rtest "github.com/restic/restic/internal/test"
|
||||
)
|
||||
|
||||
func prepareTempdirRepoSrc(t testing.TB, src archiver.TestDir) (tempdir string, repo restic.Repository, cleanup func()) {
|
||||
tempdir = rtest.TempDir(t)
|
||||
repo, removeRepository := repository.TestRepository(t)
|
||||
func prepareTempdirRepoSrc(t testing.TB, src archiver.TestDir) (string, restic.Repository) {
|
||||
tempdir := rtest.TempDir(t)
|
||||
repo := repository.TestRepository(t)
|
||||
|
||||
archiver.TestCreateFiles(t, tempdir, src)
|
||||
|
||||
return tempdir, repo, removeRepository
|
||||
return tempdir, repo
|
||||
}
|
||||
|
||||
type CheckDump func(t *testing.T, testDir string, testDump *bytes.Buffer) error
|
||||
|
@ -72,9 +72,7 @@ func WriteTest(t *testing.T, format string, cd CheckDump) {
|
|||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
tmpdir, repo, cleanup := prepareTempdirRepoSrc(t, tt.args)
|
||||
defer cleanup()
|
||||
|
||||
tmpdir, repo := prepareTempdirRepoSrc(t, tt.args)
|
||||
arch := archiver.New(repo, fs.Track{FS: fs.Local{}}, archiver.Options{})
|
||||
|
||||
back := rtest.Chdir(t, tmpdir)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue