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

Function TestTraceIDHandlerV2

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

Source from the content-addressed store, hash-verified

273}
274
275func TestTraceIDHandlerV2(t *testing.T) {
276 // create and split a splitTrace
277 splitTrace := test.MakeTrace(2, []byte{0x01, 0x02})
278 trace1 := &tempopb.Trace{}
279 trace2 := &tempopb.Trace{}
280
281 for i, b := range splitTrace.ResourceSpans {
282 if i%2 == 0 {
283 trace1.ResourceSpans = append(trace1.ResourceSpans, b)
284 } else {
285 trace2.ResourceSpans = append(trace2.ResourceSpans, b)
286 }
287 }
288
289 tests := []struct {
290 name string
291 status1 int
292 status2 int
293 trace1 *tempopb.Trace
294 trace2 *tempopb.Trace
295 err1 error
296 err2 error
297 expectedStatus int
298 expectedTrace *tempopb.Trace
299 }{
300 {
301 name: "empty returns",
302 status1: 200,
303 status2: 200,
304 expectedStatus: 200,
305 expectedTrace: &tempopb.Trace{},
306 },
307 {
308 name: "404",
309 status1: 404,
310 status2: 404,
311 expectedStatus: 404,
312 },
313 {
314 name: "400",
315 status1: 400,
316 status2: 400,
317 expectedStatus: 500,
318 },
319 {
320 name: "500+200",
321 status1: 500,
322 status2: 200,
323 trace2: trace2,
324 expectedStatus: 500,
325 },
326 {
327 name: "200+500",
328 status1: 200,
329 trace1: trace1,
330 status2: 500,
331 expectedStatus: 500,
332 },

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