repository: unify repository initialization in tests

Tests should use a helper from internal/repository/testing.go to
construct a Repository object.
This commit is contained in:
Michael Eischer
2024-02-24 21:45:24 +01:00
parent 3ba1fa3cee
commit dc441c57a7
5 changed files with 27 additions and 46 deletions

View File

@@ -15,11 +15,9 @@ import (
var repoFixture = filepath.Join("..", "repository", "testdata", "test-repo.tar.gz")
func TestRepositoryForAllIndexes(t *testing.T) {
repodir, cleanup := rtest.Env(t, repoFixture)
repo, cleanup := repository.TestFromFixture(t, repoFixture)
defer cleanup()
repo := repository.TestOpenLocal(t, repodir)
expectedIndexIDs := restic.NewIDSet()
rtest.OK(t, repo.List(context.TODO(), restic.IndexFile, func(id restic.ID, size int64) error {
expectedIndexIDs.Insert(id)