mirror of
https://github.com/kopia/kopia.git
synced 2025-12-23 22:57:50 -05:00
fix(cli): allow running quick maintenance with epoch manager (#4198)
* allow running quick maintenance with epoch manager * run full maintenance to cleanup logs * separate logs maintenance set params test
This commit is contained in:
@@ -90,14 +90,24 @@ func TestLogsMaintenance(t *testing.T) {
|
||||
e.RunAndExpectSuccess(t, "maintenance", "set", "--max-retained-log-count=2")
|
||||
e.RunAndVerifyOutputLineCount(t, 5, "logs", "list")
|
||||
|
||||
e.RunAndExpectSuccess(t, "maintenance", "run")
|
||||
e.RunAndExpectSuccess(t, "maintenance", "run", "--full")
|
||||
e.RunAndVerifyOutputLineCount(t, 3, "logs", "list")
|
||||
|
||||
e.RunAndExpectSuccess(t, "maintenance", "set", "--max-retained-log-age=1ms")
|
||||
e.RunAndVerifyOutputLineCount(t, 4, "logs", "list")
|
||||
|
||||
e.RunAndExpectSuccess(t, "maintenance", "run")
|
||||
e.RunAndExpectSuccess(t, "maintenance", "run", "--full")
|
||||
e.RunAndVerifyOutputLineCount(t, 1, "logs", "list")
|
||||
}
|
||||
|
||||
func TestLogsMaintenanceSet(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
runner := testenv.NewInProcRunner(t)
|
||||
e := testenv.NewCLITest(t, testenv.RepoFormatNotImportant, runner)
|
||||
|
||||
e.RunAndExpectSuccess(t, "repo", "create", "filesystem", "--path", e.RepoDir)
|
||||
defer e.RunAndExpectSuccess(t, "repo", "disconnect")
|
||||
|
||||
e.RunAndExpectSuccess(t, "maintenance", "set",
|
||||
"--max-retained-log-age=22h",
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/kopia/kopia/repo"
|
||||
"github.com/kopia/kopia/repo/maintenance"
|
||||
"github.com/kopia/kopia/snapshot/snapshotmaintenance"
|
||||
@@ -28,12 +26,7 @@ func (c *commandMaintenanceRun) setup(svc appServices, parent commandParent) {
|
||||
func (c *commandMaintenanceRun) run(ctx context.Context, rep repo.DirectRepositoryWriter) error {
|
||||
mode := maintenance.ModeQuick
|
||||
|
||||
_, supportsEpochManager, err := rep.ContentManager().EpochManager(ctx)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "EpochManager")
|
||||
}
|
||||
|
||||
if c.maintenanceRunFull || supportsEpochManager {
|
||||
if c.maintenanceRunFull {
|
||||
mode = maintenance.ModeFull
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user