MCPcopy
hub / github.com/kopia/kopia / MustConnectOpenAnother

Method MustConnectOpenAnother

internal/repotesting/repotesting.go:205–224  ·  view source on GitHub ↗

MustConnectOpenAnother opens another repository backed by the same storage, with independent config and cache options.

(tb testing.TB, openOpts ...func(*repo.Options))

Source from the content-addressed store, hash-verified

203// MustConnectOpenAnother opens another repository backed by the same storage,
204// with independent config and cache options.
205func (e *Environment) MustConnectOpenAnother(tb testing.TB, openOpts ...func(*repo.Options)) repo.Repository {
206 tb.Helper()
207
208 ctx := testlogging.Context(tb)
209
210 config := filepath.Join(testutil.TempDirectory(tb), "kopia.config")
211 connOpts := &repo.ConnectOptions{
212 CachingOptions: content.CachingOptions{
213 CacheDirectory: testutil.TempDirectory(tb),
214 },
215 }
216
217 err := repo.Connect(ctx, config, e.st, e.Password, connOpts)
218 require.NoError(tb, err, "can't connect")
219
220 rep, err := repo.Open(ctx, e.ConfigFile(), e.Password, repoOptions(openOpts))
221 require.NoError(tb, err, "can't open")
222
223 return rep
224}
225
226// VerifyBlobCount verifies that the underlying storage contains the specified number of blobs.
227func (e *Environment) VerifyBlobCount(tb testing.TB, want int) {

Callers 4

TestDeriveKeyFunction · 0.80
TestMaintenanceSafetyMethod · 0.80
openAnotherMethod · 0.80

Calls 7

ConfigFileMethod · 0.95
ContextFunction · 0.92
TempDirectoryFunction · 0.92
ConnectFunction · 0.92
OpenFunction · 0.92
repoOptionsFunction · 0.85
HelperMethod · 0.80

Tested by 4

TestDeriveKeyFunction · 0.64
TestMaintenanceSafetyMethod · 0.64
openAnotherMethod · 0.64