From 3d2410ed505d9699e9a27e24a43c4643d839e1b1 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Fri, 10 May 2024 17:11:08 +0200 Subject: [PATCH] Replace some repo.RemoveUnpacked usages These will eventually be blocked as they do not delete Snapshots. --- internal/checker/checker_test.go | 8 ++++---- internal/restic/lock_test.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/checker/checker_test.go b/internal/checker/checker_test.go index 62401aa19..baec88628 100644 --- a/internal/checker/checker_test.go +++ b/internal/checker/checker_test.go @@ -91,11 +91,11 @@ func TestCheckRepo(t *testing.T) { } func TestMissingPack(t *testing.T) { - repo, _, cleanup := repository.TestFromFixture(t, checkerTestData) + repo, be, cleanup := repository.TestFromFixture(t, checkerTestData) defer cleanup() packID := restic.TestParseID("657f7fb64f6a854fff6fe9279998ee09034901eded4e6db9bcee0e59745bbce6") - test.OK(t, repo.RemoveUnpacked(context.TODO(), restic.PackFile, packID)) + test.OK(t, be.Remove(context.TODO(), backend.Handle{Type: restic.PackFile, Name: packID.String()})) chkr := checker.New(repo, false) hints, errs := chkr.LoadIndex(context.TODO(), nil) @@ -117,13 +117,13 @@ func TestMissingPack(t *testing.T) { } func TestUnreferencedPack(t *testing.T) { - repo, _, cleanup := repository.TestFromFixture(t, checkerTestData) + repo, be, cleanup := repository.TestFromFixture(t, checkerTestData) defer cleanup() // index 3f1a only references pack 60e0 packID := "60e0438dcb978ec6860cc1f8c43da648170ee9129af8f650f876bad19f8f788e" indexID := restic.TestParseID("3f1abfcb79c6f7d0a3be517d2c83c8562fba64ef2c8e9a3544b4edaf8b5e3b44") - test.OK(t, repo.RemoveUnpacked(context.TODO(), restic.IndexFile, indexID)) + test.OK(t, be.Remove(context.TODO(), backend.Handle{Type: restic.IndexFile, Name: indexID.String()})) chkr := checker.New(repo, false) hints, errs := chkr.LoadIndex(context.TODO(), nil) diff --git a/internal/restic/lock_test.go b/internal/restic/lock_test.go index fb9345fbc..012341821 100644 --- a/internal/restic/lock_test.go +++ b/internal/restic/lock_test.go @@ -312,7 +312,7 @@ func TestLockRefreshStale(t *testing.T) { } func TestLockRefreshStaleMissing(t *testing.T) { - repo := repository.TestRepository(t) + repo, be := repository.TestRepositoryWithVersion(t, 0) restic.TestSetLockTimeout(t, 5*time.Millisecond) lock, err := restic.NewLock(context.TODO(), repo) @@ -320,7 +320,7 @@ func TestLockRefreshStaleMissing(t *testing.T) { lockID := checkSingleLock(t, repo) // refresh must fail if lock was removed - rtest.OK(t, repo.RemoveUnpacked(context.TODO(), restic.LockFile, lockID)) + rtest.OK(t, be.Remove(context.TODO(), backend.Handle{Type: restic.LockFile, Name: lockID.String()})) time.Sleep(time.Millisecond) err = lock.RefreshStaleLock(context.TODO()) rtest.Assert(t, err == restic.ErrRemovedLock, "unexpected error, expected %v, got %v", restic.ErrRemovedLock, err)