From 0bb0720348c055222c04b105fe44e40c68e6a3a2 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sun, 19 May 2024 14:41:11 +0200 Subject: [PATCH] test cleanups --- internal/archiver/testing.go | 3 +-- internal/repository/repack_test.go | 5 ----- internal/repository/repair_pack_test.go | 2 -- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/internal/archiver/testing.go b/internal/archiver/testing.go index a186a4ee5..278c6a448 100644 --- a/internal/archiver/testing.go +++ b/internal/archiver/testing.go @@ -11,7 +11,6 @@ import ( "testing" "time" - "github.com/restic/restic/internal/crypto" "github.com/restic/restic/internal/debug" "github.com/restic/restic/internal/fs" "github.com/restic/restic/internal/restic" @@ -239,7 +238,7 @@ func TestEnsureFileContent(ctx context.Context, t testing.TB, repo restic.BlobLo return } - content := make([]byte, crypto.CiphertextLength(len(file.Content))) + content := make([]byte, len(file.Content)) pos := 0 for _, id := range node.Content { part, err := repo.LoadBlob(ctx, restic.DataBlob, id, content[pos:]) diff --git a/internal/repository/repack_test.go b/internal/repository/repack_test.go index e0f1b4254..f47f32881 100644 --- a/internal/repository/repack_test.go +++ b/internal/repository/repack_test.go @@ -199,11 +199,6 @@ func rebuildIndex(t *testing.T, repo restic.Repository) { } func reloadIndex(t *testing.T, repo restic.Repository) { - err := repo.SetIndex(index.NewMasterIndex()) - if err != nil { - t.Fatal(err) - } - if err := repo.LoadIndex(context.TODO(), nil); err != nil { t.Fatalf("error loading new index: %v", err) } diff --git a/internal/repository/repair_pack_test.go b/internal/repository/repair_pack_test.go index 28a5525a2..0d6d340f4 100644 --- a/internal/repository/repair_pack_test.go +++ b/internal/repository/repair_pack_test.go @@ -8,7 +8,6 @@ import ( "github.com/restic/restic/internal/backend" backendtest "github.com/restic/restic/internal/backend/test" - "github.com/restic/restic/internal/index" "github.com/restic/restic/internal/repository" "github.com/restic/restic/internal/restic" "github.com/restic/restic/internal/test" @@ -118,7 +117,6 @@ func testRepairBrokenPack(t *testing.T, version uint) { rtest.OK(t, repository.RepairPacks(context.TODO(), repo, toRepair, &progress.NoopPrinter{})) // reload index - rtest.OK(t, repo.SetIndex(index.NewMasterIndex())) rtest.OK(t, repo.LoadIndex(context.TODO(), nil)) packsAfter := listPacks(t, repo)