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

Function TestEncodings

integration/storage/encodings_test.go:14–59  ·  integration/storage/encodings_test.go::TestEncodings
(t *testing.T)

Source from the content-addressed store, hash-verified

12)
13
14func TestEncodings(t *testing.T) {
15 const repeatedSearchCount = 10
16
17 for _, enc := range encoding.AllEncodingsForWrites() {
18 t.Run(enc.Version(), func(t *testing.T) {
19 util.RunIntegrationTests(t, util.TestHarnessConfig{
20 ConfigOverlay: "./config-encodings.yaml",
21 ConfigTemplateData: map[string]any{
22 "Version": enc.Version(),
23 },
24 Components: util.ComponentsBackendQuerying | util.ComponentsRecentDataQuerying,
25 }, func(h *util.TempoHarness) {
26 h.WaitTracesWritable(t)
27
28 info := tempoUtil.NewTraceInfo(time.Now(), "")
29 require.NoError(t, h.WriteTraceInfo(info, ""))
30
31 h.WaitTracesQueryable(t, 1)
32
33 apiClient := h.APIClientHTTP("")
34 util.QueryAndAssertTrace(t, apiClient, info)
35
36 // search for trace in backend multiple times with different attributes to make sure
37 // we search with different scopes and with attributes from dedicated columns
38 for range repeatedSearchCount {
39 util.SearchTraceQLAndAssertTrace(t, apiClient, info)
40 }
41
42 h.WaitTracesWrittenToBackend(t, 1)
43 h.ForceBackendQuerying(t)
44
45 apiClient = h.APIClientHTTP("")
46 grpcClient, ctx, err := h.APIClientGRPC("")
47 require.NoError(t, err)
48
49 now := time.Now()
50 for range repeatedSearchCount {
51 // search the backend. this works b/c we're passing a start/end AND setting query ingesters within min/max to 0
52 util.SearchTraceQLAndAssertTraceWithRange(t, apiClient, info, now.Add(-time.Hour).Unix(), now.Unix())
53 // find the trace with streaming. using the http server b/c that's what Grafana will do
54 util.SearchStreamAndAssertTrace(t, ctx, grpcClient, info, now.Add(-time.Hour).Unix(), now.Unix())
55 }
56 })
57 })
58 }
59}

Callers

nothing calls this directly

Calls 12

AllEncodingsForWritesFunction · 0.92
WaitTracesWritableMethod · 0.80
WriteTraceInfoMethod · 0.80
WaitTracesQueryableMethod · 0.80
APIClientHTTPMethod · 0.80
ForceBackendQueryingMethod · 0.80
APIClientGRPCMethod · 0.80
VersionMethod · 0.65
NowMethod · 0.65
AddMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected