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

Function TestHandleGetTrace

modules/frontend/mcp_tools_test.go:285–322  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

283}
284
285func TestHandleGetTrace(t *testing.T) {
286 server, callAndTestResults := testFrontend()
287
288 tests := []struct {
289 name string
290 request mcp.CallToolRequest
291 expected expectedResult
292 }{
293 {
294 name: "valid trace ID",
295 request: callToolRequest(map[string]any{
296 "trace_id": "12345678abcdef90",
297 }),
298 expected: expectedResult{
299 path: "/api/v2/traces/12345678abcdef90",
300 params: map[string]string{},
301 meta: map[string]any{
302 "type": "trace",
303 "encoding": "json",
304 "version": "2",
305 },
306 },
307 },
308 {
309 name: "no trace ID",
310 request: callToolRequest(map[string]any{}),
311 expected: expectedResult{
312 err: "required argument \"trace_id\" not found",
313 },
314 },
315 }
316
317 for _, tt := range tests {
318 t.Run(tt.name, func(t *testing.T) {
319 callAndTestResults(t, tt.request, server.handleGetTrace, tt.expected)
320 })
321 }
322}
323
324func TestHandleGetAttributeNames(t *testing.T) {
325 server, callAndTestResults := testFrontend()

Callers

nothing calls this directly

Calls 3

testFrontendFunction · 0.85
callToolRequestFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected