ui/progress: unexport NoopPrinter and add New* function

This commit is contained in:
Michael Eischer
2026-06-05 14:48:44 +02:00
parent e8ed2434cd
commit 0bbfb072af
13 changed files with 41 additions and 35 deletions
+2 -2
View File
@@ -70,10 +70,10 @@ func TestPruneMaxUnusedDuplicate(t *testing.T) {
usedBlobs.Insert(blob)
}
return nil
}, &progress.NoopPrinter{})
}, progress.NewNoopPrinter())
rtest.OK(t, err)
rtest.OK(t, plan.Execute(context.TODO(), &progress.NoopPrinter{}))
rtest.OK(t, plan.Execute(context.TODO(), progress.NewNoopPrinter()))
rsize := plan.Stats().Size
remainingUnusedSize := rsize.Duplicate + rsize.Unused - rsize.Remove - rsize.Repackrm
+4 -4
View File
@@ -41,10 +41,10 @@ func testPrune(t *testing.T, opts repository.PruneOptions, errOnUnused bool) {
usedBlobs.Insert(blob)
}
return nil
}, &progress.NoopPrinter{})
}, progress.NewNoopPrinter())
rtest.OK(t, err)
rtest.OK(t, plan.Execute(context.TODO(), &progress.NoopPrinter{}))
rtest.OK(t, plan.Execute(context.TODO(), progress.NewNoopPrinter()))
repo = repository.TestOpenBackend(t, be)
repository.TestCheckRepo(t, repo)
@@ -165,9 +165,9 @@ func TestPruneSmall(t *testing.T) {
usedBlobs.Insert(blob)
}
return nil
}, &progress.NoopPrinter{})
}, progress.NewNoopPrinter())
rtest.OK(t, err)
rtest.OK(t, plan.Execute(context.TODO(), &progress.NoopPrinter{}))
rtest.OK(t, plan.Execute(context.TODO(), progress.NewNoopPrinter()))
stats := plan.Stats()
rtest.Equals(t, stats.Size.Used/blobSize, uint64(numBlobsCreated), fmt.Sprintf("total size of blobs should be %d but is %d",
+1 -1
View File
@@ -162,7 +162,7 @@ func repack(t *testing.T, repo restic.Repository, be backend.Backend, packs rest
func rebuildAndReloadIndex(t *testing.T, repo *repository.Repository) {
rtest.OK(t, repository.RepairIndex(context.TODO(), repo, repository.RepairIndexOptions{
ReadAllPacks: true,
}, &progress.NoopPrinter{}))
}, progress.NewNoopPrinter()))
rtest.OK(t, repo.LoadIndex(context.TODO(), nil))
}
+1 -1
View File
@@ -33,7 +33,7 @@ func testRebuildIndex(t *testing.T, readAllPacks bool, damage func(t *testing.T,
repo = repository.TestOpenBackend(t, be)
rtest.OK(t, repository.RepairIndex(context.TODO(), repo, repository.RepairIndexOptions{
ReadAllPacks: readAllPacks,
}, &progress.NoopPrinter{}))
}, progress.NewNoopPrinter()))
repository.TestCheckRepo(t, repo)
}
+2 -2
View File
@@ -106,7 +106,7 @@ func testRepairBrokenPack(t *testing.T, version uint) {
buf, err := backendtest.LoadAll(context.TODO(), be, h)
rtest.OK(t, err)
rtest.OK(t, be.Remove(context.TODO(), h))
rtest.OK(t, repository.RepairIndex(context.TODO(), repo, repository.RepairIndexOptions{}, &progress.NoopPrinter{}))
rtest.OK(t, repository.RepairIndex(context.TODO(), repo, repository.RepairIndexOptions{}, progress.NewNoopPrinter()))
rtest.OK(t, be.Save(context.TODO(), h, backend.NewByteReader(buf, be.Hasher())))
@@ -130,7 +130,7 @@ func testRepairBrokenPack(t *testing.T, version uint) {
toRepair, damagedBlobs := test.damage(t, random, repo, be, packsBefore)
rtest.OK(t, repository.RepairPacks(context.TODO(), repo, toRepair, &progress.NoopPrinter{}))
rtest.OK(t, repository.RepairPacks(context.TODO(), repo, toRepair, progress.NewNoopPrinter()))
// reload index
rtest.OK(t, repo.LoadIndex(context.TODO(), nil))