MCPcopy
hub / github.com/kopia/kopia / verifyCached

Function verifyCached

internal/cache/persistent_lru_cache_test.go:324–336  ·  view source on GitHub ↗
(ctx context.Context, t *testing.T, pc *cache.PersistentCache, key string, want []byte)

Source from the content-addressed store, hash-verified

322}
323
324func verifyCached(ctx context.Context, t *testing.T, pc *cache.PersistentCache, key string, want []byte) {
325 t.Helper()
326
327 var tmp gather.WriteBuffer
328 defer tmp.Close()
329
330 if want == nil {
331 require.False(t, pc.TestingGetFull(ctx, key, &tmp))
332 } else {
333 require.True(t, pc.TestingGetFull(ctx, key, &tmp))
334 require.Equalf(t, want, tmp.ToByteSlice(), "invalid cached result for '%s'", key)
335 }
336}
337
338func verifyNotCached(ctx context.Context, t *testing.T, pc *cache.PersistentCache, key string) {
339 t.Helper()

Calls 4

CloseMethod · 0.95
ToByteSliceMethod · 0.95
HelperMethod · 0.80
TestingGetFullMethod · 0.80

Tested by

no test coverage detected