MCPcopy Create free account
hub / github.com/coder/aibridge / TestNewServerProxyManagerTraces

Function TestNewServerProxyManagerTraces

internal/integrationtest/trace_test.go:784–805  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

782}
783
784func TestNewServerProxyManagerTraces(t *testing.T) {
785 t.Parallel()
786
787 sr, tracer := setupTracer(t)
788
789 serverName := "serverName"
790 mockMCP := setupMCPForTestWithName(t, serverName, tracer)
791 tool := mockMCP.ListTools()[0]
792
793 require.Len(t, sr.Ended(), 3)
794 verifyTraces(t, sr, []expectTrace{{"ServerProxyManager.Init", 1, codes.Unset}}, []attribute.KeyValue{})
795
796 attrs := []attribute.KeyValue{
797 attribute.String(tracing.MCPProxyName, serverName),
798 attribute.String(tracing.MCPServerURL, tool.ServerURL),
799 attribute.String(tracing.MCPServerName, serverName),
800 }
801 verifyTraces(t, sr, []expectTrace{{"StreamableHTTPServerProxy.Init", 1, codes.Unset}}, attrs)
802
803 attrs = append(attrs, attribute.Int(tracing.MCPToolCount, len(mockMCP.ListTools())))
804 verifyTraces(t, sr, []expectTrace{{"StreamableHTTPServerProxy.Init.fetchTools", 1, codes.Unset}}, attrs)
805}
806
807func cmpAttrKeyVal(a attribute.KeyValue, b attribute.KeyValue) int {
808 return strings.Compare(string(a.Key), string(b.Key))

Callers

nothing calls this directly

Calls 4

setupTracerFunction · 0.85
setupMCPForTestWithNameFunction · 0.85
verifyTracesFunction · 0.85
ListToolsMethod · 0.65

Tested by

no test coverage detected