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

Function TestCacheKeyForJob

modules/frontend/cache_keys_test.go:12–148  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestCacheKeyForJob(t *testing.T) {
13 tcs := []struct {
14 name string
15 tenant string
16 queryHash uint64
17 req *tempopb.SearchRequest
18 meta *backend.BlockMeta
19 searchPage int
20 pagesToSearch int
21
22 expected string
23 }{
24 {
25 name: "valid!",
26 tenant: "foo",
27 queryHash: 42,
28 req: &tempopb.SearchRequest{
29 Start: 10,
30 End: 20,
31 },
32 meta: &backend.BlockMeta{
33 BlockID: backend.MustParse("00000000-0000-0000-0000-000000000123"),
34 StartTime: time.Unix(15, 0),
35 EndTime: time.Unix(16, 0),
36 },
37 searchPage: 1,
38 pagesToSearch: 2,
39 expected: "sj:foo:42:00000000-0000-0000-0000-000000000123:1:2",
40 },
41 {
42 name: "no query hash means no query cache",
43 queryHash: 0,
44 req: &tempopb.SearchRequest{
45 Start: 10,
46 End: 20,
47 },
48 meta: &backend.BlockMeta{
49 BlockID: backend.MustParse("00000000-0000-0000-0000-000000000123"),
50 StartTime: time.Unix(15, 0),
51 EndTime: time.Unix(16, 0),
52 },
53 searchPage: 1,
54 pagesToSearch: 2,
55 expected: "",
56 },
57 {
58 name: "meta before start time",
59 queryHash: 42,
60 req: &tempopb.SearchRequest{
61 Start: 10,
62 End: 20,
63 },
64 meta: &backend.BlockMeta{
65 BlockID: backend.MustParse("00000000-0000-0000-0000-000000000123"),
66 StartTime: time.Unix(5, 0),
67 EndTime: time.Unix(6, 0),
68 },
69 searchPage: 1,

Callers

nothing calls this directly

Calls 4

MustParseFunction · 0.92
searchJobCacheKeyFunction · 0.85
RunMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…