MCPcopy
hub / github.com/grafana/tempo / testCacheSingle

Function testCacheSingle

pkg/cache/background_test.go:49–60  ·  view source on GitHub ↗
(t *testing.T, cache cache.Cache, keys []string, bufs [][]byte)

Source from the content-addressed store, hash-verified

47}
48
49func testCacheSingle(t *testing.T, cache cache.Cache, keys []string, bufs [][]byte) {
50 for i := 0; i < 100; i++ {
51 index := rand.Intn(len(keys))
52 key := keys[index]
53
54 found, foundBufs, missingKeys := cache.Fetch(context.Background(), []string{key})
55 require.Len(t, found, 1)
56 require.Len(t, foundBufs, 1)
57 require.Len(t, missingKeys, 0)
58 require.Equal(t, bufs[index], foundBufs[0])
59 }
60}
61
62func testCacheMultiple(t *testing.T, cache cache.Cache, keys []string, bufs [][]byte) {
63 // test getting them all

Callers 1

TestBackgroundFunction · 0.85

Calls 3

FetchMethod · 0.65
LenMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected