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

Function TestTraceIDHandler

modules/frontend/traceid_handlers_test.go:52–240  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

50}
51
52func TestTraceIDHandler(t *testing.T) {
53 // create and split a splitTrace
54 splitTrace := test.MakeTrace(2, []byte{0x01, 0x02})
55 trace1 := &tempopb.Trace{}
56 trace2 := &tempopb.Trace{}
57
58 for i, b := range splitTrace.ResourceSpans {
59 if i%2 == 0 {
60 trace1.ResourceSpans = append(trace1.ResourceSpans, b)
61 } else {
62 trace2.ResourceSpans = append(trace2.ResourceSpans, b)
63 }
64 }
65
66 tests := []struct {
67 name string
68 status1 int
69 status2 int
70 trace1 *tempopb.Trace
71 trace2 *tempopb.Trace
72 err1 error
73 err2 error
74 expectedStatus int
75 expectedTrace *tempopb.Trace
76 }{
77 {
78 name: "empty returns",
79 status1: 200,
80 status2: 200,
81 expectedStatus: 200,
82 expectedTrace: &tempopb.Trace{},
83 },
84 {
85 name: "404",
86 status1: 404,
87 status2: 404,
88 expectedStatus: 404,
89 },
90 {
91 name: "400",
92 status1: 400,
93 status2: 400,
94 expectedStatus: 500,
95 },
96 {
97 name: "500+404",
98 status1: 500,
99 status2: 404,
100 expectedStatus: 500,
101 },
102 {
103 name: "404+500",
104 status1: 404,
105 status2: 500,
106 expectedStatus: 500,
107 },
108 {
109 name: "500+200",

Callers

nothing calls this directly

Calls 15

ContextMethod · 0.95
MakeTraceFunction · 0.92
RoundTripperFuncFuncType · 0.92
SortTraceFunction · 0.92
frontendWithSettingsFunction · 0.85
FailMethod · 0.80
HTTPRequestMethod · 0.65
MarshalMethod · 0.65
SetMethod · 0.65
ResultMethod · 0.65
ReadAllMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected