2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-23 13:17:42 +00:00

Fix test for Repack

This commit is contained in:
Alexander Neumann 2016-05-11 23:00:21 +02:00
parent 122a0944a6
commit d5f42201c5
2 changed files with 6 additions and 4 deletions

View File

@ -41,6 +41,8 @@ func Repack(repo *Repository, packs, keepBlobs backend.IDSet) error {
} }
debug.Log("Repack", " saved blob %v", blob.ID.Str()) debug.Log("Repack", " saved blob %v", blob.ID.Str())
keepBlobs.Delete(blob.ID)
} }
} }

View File

@ -158,14 +158,14 @@ func TestRepack(t *testing.T) {
removeBlobs, keepBlobs := selectBlobs(t, repo, 0.2) removeBlobs, keepBlobs := selectBlobs(t, repo, 0.2)
packs := findPacksForBlobs(t, repo, keepBlobs) removePacks := findPacksForBlobs(t, repo, removeBlobs)
repack(t, repo, packs, keepBlobs) repack(t, repo, removePacks, keepBlobs)
rebuildIndex(t, repo) rebuildIndex(t, repo)
reloadIndex(t, repo) reloadIndex(t, repo)
packsAfter = listPacks(t, repo) packsAfter = listPacks(t, repo)
for id := range packs { for id := range removePacks {
if packsAfter.Has(id) { if packsAfter.Has(id) {
t.Errorf("pack %v still present although it should have been repacked and removed", id.Str()) t.Errorf("pack %v still present although it should have been repacked and removed", id.Str())
} }
@ -178,7 +178,7 @@ func TestRepack(t *testing.T) {
t.Errorf("unable to find blob %v in repo", id.Str()) t.Errorf("unable to find blob %v in repo", id.Str())
} }
if packs.Has(pb.PackID) { if removePacks.Has(pb.PackID) {
t.Errorf("lookup returned pack ID %v that should've been removed", pb.PackID) t.Errorf("lookup returned pack ID %v that should've been removed", pb.PackID)
} }
} }