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:
greatroar
2022-12-11 10:41:22 +01:00
parent f90bf84ba7
commit c0b5ec55ab
19 changed files with 91 additions and 190 deletions

View File

@@ -328,14 +328,13 @@ var (
depth = 3
)
func createFilledRepo(t testing.TB, snapshots int, dup float32, version uint) (restic.Repository, func()) {
repo, cleanup := repository.TestRepositoryWithVersion(t, version)
func createFilledRepo(t testing.TB, snapshots int, dup float32, version uint) restic.Repository {
repo := repository.TestRepositoryWithVersion(t, version)
for i := 0; i < 3; i++ {
restic.TestCreateSnapshot(t, repo, snapshotTime.Add(time.Duration(i)*time.Second), depth, dup)
}
return repo, cleanup
return repo
}
func TestIndexSave(t *testing.T) {
@@ -343,8 +342,7 @@ func TestIndexSave(t *testing.T) {
}
func testIndexSave(t *testing.T, version uint) {
repo, cleanup := createFilledRepo(t, 3, 0, version)
defer cleanup()
repo := createFilledRepo(t, 3, 0, version)
err := repo.LoadIndex(context.TODO())
if err != nil {