MCPcopy Create free account
hub / github.com/cortexproject/cortex / testCacheMultiple

Function testCacheMultiple

pkg/chunk/cache/cache_test.go:59–73  ·  view source on GitHub ↗
(t *testing.T, cache cache.Cache, keys []string, chunks []chunkenc.Chunk)

Source from the content-addressed store, hash-verified

57}
58
59func testCacheMultiple(t *testing.T, cache cache.Cache, keys []string, chunks []chunkenc.Chunk) {
60 // test getting them all
61 found, bufs, missingKeys := cache.Fetch(context.Background(), keys)
62 require.Len(t, found, len(keys))
63 require.Len(t, bufs, len(keys))
64 require.Len(t, missingKeys, 0)
65
66 result := []chunkenc.Chunk{}
67 for i := range found {
68 c, err := chunkenc.FromData(chunkenc.EncXOR, bufs[i])
69 require.NoError(t, err)
70 result = append(result, c)
71 }
72 require.Equal(t, chunks, result)
73}
74
75func testCacheMiss(t *testing.T, cache cache.Cache) {
76 for range 100 {

Callers 2

TestBackgroundFunction · 0.85
testCacheFunction · 0.85

Calls 3

FetchMethod · 0.65
EqualMethod · 0.65
LenMethod · 0.45

Tested by

no test coverage detected