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

Function testCacheSingle

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

Source from the content-addressed store, hash-verified

41}
42
43func testCacheSingle(t *testing.T, cache cache.Cache, keys []string, chunks []chunkenc.Chunk) {
44 for range 100 {
45 index := rand.Intn(len(keys))
46 key := keys[index]
47
48 found, bufs, missingKeys := cache.Fetch(context.Background(), []string{key})
49 require.Len(t, found, 1)
50 require.Len(t, bufs, 1)
51 require.Len(t, missingKeys, 0)
52
53 c, err := chunkenc.FromData(chunkenc.EncXOR, bufs[0])
54 require.NoError(t, err)
55 require.Equal(t, chunks[index], c)
56 }
57}
58
59func testCacheMultiple(t *testing.T, cache cache.Cache, keys []string, chunks []chunkenc.Chunk) {
60 // test getting them all

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