MCPcopy
hub / github.com/restic/restic / testEdgeCaseRepo

Function testEdgeCaseRepo

cmd/restic/cmd_prune_integration_test.go:217–243  ·  view source on GitHub ↗
(t *testing.T, tarfile string, optionsCheck CheckOptions, optionsPrune PruneOptions, checkOK, pruneOK bool)

Source from the content-addressed store, hash-verified

215}
216
217func testEdgeCaseRepo(t *testing.T, tarfile string, optionsCheck CheckOptions, optionsPrune PruneOptions, checkOK, pruneOK bool) {
218 env, cleanup := withTestEnvironment(t)
219 defer cleanup()
220
221 datafile := filepath.Join("testdata", tarfile)
222 rtest.SetupTarTestFixture(t, env.base, datafile)
223
224 if checkOK {
225 testRunCheck(t, env.gopts)
226 } else {
227 rtest.Assert(t, withTermStatus(t, env.gopts, func(ctx context.Context, gopts global.Options) error {
228 _, err := runCheck(context.TODO(), optionsCheck, gopts, nil, gopts.Term)
229 return err
230 }) != nil,
231 "check should have reported an error")
232 }
233
234 if pruneOK {
235 testRunPrune(t, env.gopts, optionsPrune)
236 testRunCheck(t, env.gopts)
237 } else {
238 rtest.Assert(t, withTermStatus(t, env.gopts, func(ctx context.Context, gopts global.Options) error {
239 return runPrune(context.TODO(), optionsPrune, gopts, gopts.Term)
240 }) != nil,
241 "prune should have reported an error")
242 }
243}
244
245func TestPruneRepackSmallerThanSmoke(t *testing.T) {
246 env, cleanup := withTestEnvironment(t)

Callers 1

TestEdgeCaseReposFunction · 0.85

Calls 7

withTestEnvironmentFunction · 0.85
testRunCheckFunction · 0.85
withTermStatusFunction · 0.85
runCheckFunction · 0.85
testRunPruneFunction · 0.85
runPruneFunction · 0.85
JoinMethod · 0.65

Tested by

no test coverage detected