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

Function TestFailureModes

integration/operations/failure_modes_test.go:12–55  ·  integration/operations/failure_modes_test.go::TestFailureModes
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestFailureModes(t *testing.T) {
13 util.RunIntegrationTests(t, util.TestHarnessConfig{
14 Components: util.ComponentsRecentDataQuerying | util.ComponentsBackendQuerying,
15 }, func(h *util.TempoHarness) {
16 h.WaitTracesWritable(t)
17
18 info := tempoUtil.NewTraceInfo(time.Now(), "")
19 require.NoError(t, h.WriteTraceInfo(info, ""))
20
21 h.WaitTracesQueryable(t, 1)
22
23 apiClient := h.APIClientHTTP("")
24 util.QueryAndAssertTrace(t, apiClient, info)
25
26 // stop one live store. data should still be queryable
27 liveStoreB := h.Services[util.ServiceLiveStoreZoneB]
28 err := liveStoreB.Stop()
29 require.NoError(t, err)
30
31 _, err = apiClient.QueryTraceV2(info.HexID())
32 require.NoError(t, err)
33
34 // stop the second live store. querying should fail
35 liveStoreA := h.Services[util.ServiceLiveStoreZoneA]
36 err = liveStoreA.Stop()
37 require.NoError(t, err)
38 _, err = apiClient.QueryTraceV2(info.HexID())
39 require.Error(t, err)
40
41 h.WaitTracesWrittenToBackend(t, 1)
42
43 // stop the block builder now that the trace is in the backend. ingestion should still work
44 blockBuilder := h.Services[util.ServiceBlockBuilder]
45 err = blockBuilder.Stop()
46 require.NoError(t, err)
47 require.NoError(t, h.WriteTraceInfo(tempoUtil.NewTraceInfo(time.Now(), ""), ""))
48
49 // restart the query frontend to do backend querying only. querying should work again
50 h.ForceBackendQuerying(t)
51 apiClient = h.APIClientHTTP("")
52 _, err = apiClient.SearchTraceQLWithRange("{}", time.Now().Add(-time.Hour).Unix(), time.Now().Unix())
53 require.NoError(t, err)
54 })
55}

Callers

nothing calls this directly

Calls 13

HexIDMethod · 0.95
WaitTracesWritableMethod · 0.80
WriteTraceInfoMethod · 0.80
WaitTracesQueryableMethod · 0.80
APIClientHTTPMethod · 0.80
QueryTraceV2Method · 0.80
ForceBackendQueryingMethod · 0.80
NowMethod · 0.65
StopMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected