MCPcopy
hub / github.com/restic/restic / TestRepositoryWithVersion

Function TestRepositoryWithVersion

internal/repository/testing.go:85–106  ·  view source on GitHub ↗
(t testing.TB, version uint)

Source from the content-addressed store, hash-verified

83}
84
85func TestRepositoryWithVersion(t testing.TB, version uint) (*Repository, restic.Unpacked[restic.FileType], backend.Backend) {
86 t.Helper()
87 dir := os.Getenv("RESTIC_TEST_REPO")
88 opts := Options{}
89 var repo *Repository
90 var be backend.Backend
91 if dir != "" {
92 _, err := os.Stat(dir)
93 if err != nil {
94 lbe, err := local.Create(context.TODO(), local.Config{Path: dir}, t.Logf)
95 if err != nil {
96 t.Fatalf("error creating local backend at %v: %v", dir, err)
97 }
98 repo, be = TestRepositoryWithBackend(t, lbe, version, opts)
99 } else {
100 t.Logf("directory at %v already exists, using mem backend", dir)
101 }
102 } else {
103 repo, be = TestRepositoryWithBackend(t, nil, version, opts)
104 }
105 return repo, &internalRepository{repo}, be
106}
107
108func TestFromFixture(t testing.TB, repoFixture string) (*Repository, backend.Backend, func()) {
109 repodir, cleanup := test.Env(t, repoFixture)

Callers 15

TestCheckerModifiedDataFunction · 0.92
testPruneFunction · 0.92
testSaveFunction · 0.92
benchmarkSaveAndEncryptFunction · 0.92
testLoadBlobFunction · 0.92
benchmarkLoadBlobFunction · 0.92
benchmarkLoadUnpackedFunction · 0.92
TestNoDoubleInitFunction · 0.92
TestSaveBlobAsyncFunction · 0.92

Calls 5

CreateFunction · 0.92
FatalfMethod · 0.80
StatMethod · 0.65
LogfMethod · 0.65

Tested by

no test coverage detected