repository: remove redundant flushes from tests

This commit is contained in:
Michael Eischer 2024-04-14 11:49:04 +02:00
parent c65459cd8a
commit b25fc2c89d

View file

@ -170,12 +170,6 @@ func repack(t *testing.T, repo restic.Repository, packs restic.IDSet, blobs rest
} }
} }
func flush(t *testing.T, repo restic.Repository) {
if err := repo.Flush(context.TODO()); err != nil {
t.Fatalf("repo.SaveIndex() %v", err)
}
}
func rebuildIndex(t *testing.T, repo restic.Repository) { func rebuildIndex(t *testing.T, repo restic.Repository) {
err := repo.SetIndex(index.NewMasterIndex()) err := repo.SetIndex(index.NewMasterIndex())
rtest.OK(t, err) rtest.OK(t, err)
@ -239,8 +233,6 @@ func testRepack(t *testing.T, version uint) {
packsBefore, packsAfter) packsBefore, packsAfter)
} }
flush(t, repo)
removeBlobs, keepBlobs := selectBlobs(t, repo, 0.2) removeBlobs, keepBlobs := selectBlobs(t, repo, 0.2)
removePacks := findPacksForBlobs(t, repo, removeBlobs) removePacks := findPacksForBlobs(t, repo, removeBlobs)
@ -311,7 +303,6 @@ func testRepackCopy(t *testing.T, version uint) {
// add a small amount of blobs twice to create multiple pack files // add a small amount of blobs twice to create multiple pack files
createRandomBlobs(t, repo, 10, 0.7, false) createRandomBlobs(t, repo, 10, 0.7, false)
createRandomBlobs(t, repo, 10, 0.7, false) createRandomBlobs(t, repo, 10, 0.7, false)
flush(t, repo)
_, keepBlobs := selectBlobs(t, repo, 0.2) _, keepBlobs := selectBlobs(t, repo, 0.2)
copyPacks := findPacksForBlobs(t, repo, keepBlobs) copyPacks := findPacksForBlobs(t, repo, keepBlobs)