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

Function TestInjectMuxVars

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

Source from the content-addressed store, hash-verified

21}
22
23func TestInjectMuxVars(t *testing.T) {
24 ctx := context.Background()
25 req := &http.Request{
26 Method: "GET",
27 URL: &url.URL{Path: "/test"},
28 }
29
30 vars := map[string]string{
31 "traceID": "test-trace-id",
32 "tagName": "test-tag",
33 }
34
35 newReq, newCtx := injectMuxVars(ctx, req, vars)
36
37 // Verify vars are set in the request
38 actualVars := mux.Vars(newReq)
39 require.Equal(t, "test-trace-id", actualVars["traceID"])
40 require.Equal(t, "test-tag", actualVars["tagName"])
41
42 require.Equal(t, newReq.Context(), newCtx)
43}
44
45func TestHandleSearch(t *testing.T) {
46 server, callAndTestResults := testFrontend()

Callers

nothing calls this directly

Calls 3

injectMuxVarsFunction · 0.85
ContextMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected