ui/progress: unexport NoopPrinter and add New* function

This commit is contained in:
Michael Eischer
2026-06-13 16:53:57 +02:00
parent e8ed2434cd
commit 0bbfb072af
13 changed files with 41 additions and 35 deletions
+3 -3
View File
@@ -989,7 +989,7 @@ func TestRestorerSparseOverwrite(t *testing.T) {
type printerMock struct {
s restoreui.State
progress.NoopPrinter
progress.Printer
}
func (p *printerMock) Update(_ restoreui.State, _ time.Duration) {
@@ -1102,7 +1102,7 @@ func TestRestorerOverwriteBehavior(t *testing.T) {
for _, test := range tests {
t.Run("", func(t *testing.T) {
mock := &printerMock{}
mock := &printerMock{Printer: progress.NewNoopPrinter()}
progress := restoreui.NewProgress(mock, 0)
tempdir := saveSnapshotsAndOverwrite(t, baseSnapshot, overwriteSnapshot, Options{}, Options{Overwrite: test.Overwrite, Progress: progress})
@@ -1154,7 +1154,7 @@ func TestRestorerOverwritePartial(t *testing.T) {
},
}
mock := &printerMock{}
mock := &printerMock{Printer: progress.NewNoopPrinter()}
progress := restoreui.NewProgress(mock, 0)
saveSnapshotsAndOverwrite(t, baseSnapshot, overwriteSnapshot, Options{}, Options{Overwrite: OverwriteAlways, Progress: progress})
progress.Finish()
+2 -1
View File
@@ -13,6 +13,7 @@ import (
"github.com/restic/restic/internal/repository"
rtest "github.com/restic/restic/internal/test"
"github.com/restic/restic/internal/ui/progress"
restoreui "github.com/restic/restic/internal/ui/restore"
)
@@ -87,7 +88,7 @@ func testRestorerProgressBar(t *testing.T, dryRun bool) {
},
}, noopGetGenericAttributes)
mock := &printerMock{}
mock := &printerMock{Printer: progress.NewNoopPrinter()}
progress := restoreui.NewProgress(mock, 0)
res := NewRestorer(repo, sn, Options{Progress: progress, DryRun: dryRun})