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

Function TestKVStores

integration/operations/kvstores_test.go:18–103  ·  integration/operations/kvstores_test.go::TestKVStores
(t *testing.T)

Source from the content-addressed store, hash-verified

16const configKVStore = "config-kvstore.yaml"
17
18func TestKVStores(t *testing.T) {
19 testKVStores := []struct {
20 name string
21 setupKVStore func(*e2e.Scenario, map[string]any) error
22 kvstoreConfig string
23 }{
24 {
25 name: "memberlist",
26 setupKVStore: func(_ *e2e.Scenario, templateData map[string]any) error {
27 templateData["KVStoreConfig"] = `
28 store: memberlist`
29 return nil
30 },
31 },
32 {
33 name: "etcd",
34 setupKVStore: func(s *e2e.Scenario, templateData map[string]any) error {
35 etcd := e2edb.NewETCD()
36 if err := s.StartAndWaitReady(etcd); err != nil {
37 return err
38 }
39 templateData["KVStoreConfig"] = fmt.Sprintf(`
40 store: etcd
41 etcd:
42 endpoints:
43 - http://%s:%d`, etcd.Name(), etcd.HTTPPort())
44 return nil
45 },
46 },
47 {
48 name: "consul",
49 setupKVStore: func(s *e2e.Scenario, templateData map[string]any) error {
50 consul := e2edb.NewConsul()
51 if err := s.StartAndWaitReady(consul); err != nil {
52 return err
53 }
54 templateData["KVStoreConfig"] = fmt.Sprintf(`
55 store: consul
56 consul:
57 host: http://%s:%d`, consul.Name(), consul.HTTPPort())
58 return nil
59 },
60 },
61 }
62
63 for _, tc := range testKVStores {
64 t.Run(tc.name, func(t *testing.T) {
65 util.RunIntegrationTests(t, util.TestHarnessConfig{
66 ConfigOverlay: configKVStore,
67 PreStartHook: tc.setupKVStore,
68 }, func(h *util.TempoHarness) {
69 h.WaitTracesWritable(t)
70
71 liveStoreA := h.Services[util.ServiceLiveStoreZoneA]
72 liveStoreB := h.Services[util.ServiceLiveStoreZoneB]
73
74 matchers := []*labels.Matcher{
75 {Type: labels.MatchEqual, Name: "state", Value: "ACTIVE"},

Callers

nothing calls this directly

Calls 8

WaitTracesWritableMethod · 0.80
EqualsMethod · 0.80
WriteTraceInfoMethod · 0.80
WaitTracesQueryableMethod · 0.80
APIClientHTTPMethod · 0.80
NameMethod · 0.65
NowMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected