repository: add basic test for RepairIndex

This commit is contained in:
Michael Eischer
2024-04-14 11:53:08 +02:00
parent 310db03c0e
commit 8d507c1372
2 changed files with 84 additions and 1 deletions

View File

@@ -125,8 +125,12 @@ func selectBlobs(t *testing.T, repo restic.Repository, p float32) (list1, list2
}
func listPacks(t *testing.T, repo restic.Lister) restic.IDSet {
return listFiles(t, repo, restic.PackFile)
}
func listFiles(t *testing.T, repo restic.Lister, tpe backend.FileType) restic.IDSet {
list := restic.NewIDSet()
err := repo.List(context.TODO(), restic.PackFile, func(id restic.ID, size int64) error {
err := repo.List(context.TODO(), tpe, func(id restic.ID, size int64) error {
list.Insert(id)
return nil
})