MCPcopy Create free account
hub / github.com/kopia/kopia / TestLogsMaintenance

Function TestLogsMaintenance

cli/command_logs_test.go:73–107  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

71}
72
73func TestLogsMaintenance(t *testing.T) {
74 t.Parallel()
75
76 runner := testenv.NewInProcRunner(t)
77 e := testenv.NewCLITest(t, testenv.RepoFormatNotImportant, runner)
78
79 e.RunAndExpectSuccess(t, "repo", "create", "filesystem", "--path", e.RepoDir)
80 defer e.RunAndExpectSuccess(t, "repo", "disconnect")
81
82 time.Sleep(time.Second)
83 e.RunAndExpectSuccess(t, "snapshot", "create", testutil.TempDirectory(t))
84 time.Sleep(time.Second)
85 e.RunAndExpectSuccess(t, "snapshot", "create", testutil.TempDirectory(t))
86 time.Sleep(time.Second)
87 e.RunAndExpectSuccess(t, "snapshot", "create", testutil.TempDirectory(t))
88 e.RunAndVerifyOutputLineCount(t, 4, "logs", "list")
89
90 e.RunAndExpectSuccess(t, "maintenance", "set", "--max-retained-log-count=2")
91 e.RunAndVerifyOutputLineCount(t, 5, "logs", "list")
92
93 e.RunAndExpectSuccess(t, "maintenance", "run", "--full")
94
95 // maintenance run will create a new log and keep previous 2 logs
96 e.RunAndVerifyOutputLineCount(t, 3, "logs", "list")
97
98 e.RunAndExpectSuccess(t, "maintenance", "set", "--max-retained-log-age=1ms")
99
100 // maintenance does not run here
101 e.RunAndVerifyOutputLineCount(t, 4, "logs", "list")
102
103 e.RunAndExpectSuccess(t, "maintenance", "run", "--full")
104
105 // maintenance run will create a new log and delete all previous logs
106 e.RunAndVerifyOutputLineCount(t, 1, "logs", "list")
107}
108
109func TestLogsMaintenanceSet(t *testing.T) {
110 t.Parallel()

Callers

nothing calls this directly

Calls 5

RunAndExpectSuccessMethod · 0.95
NewInProcRunnerFunction · 0.92
NewCLITestFunction · 0.92
TempDirectoryFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…