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

Function TestTraceAnthropic

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

Source from the content-addressed store, hash-verified

43}
44
45func TestTraceAnthropic(t *testing.T) {
46 t.Parallel()
47
48 expectNonStreaming := []expectTrace{
49 {"Intercept", 1, codes.Unset},
50 {"Intercept.CreateInterceptor", 1, codes.Unset},
51 {"Intercept.RecordInterception", 1, codes.Unset},
52 {"Intercept.ProcessRequest", 1, codes.Unset},
53 {"Intercept.RecordInterceptionEnded", 1, codes.Unset},
54 {"Intercept.RecordPromptUsage", 1, codes.Unset},
55 {"Intercept.RecordTokenUsage", 1, codes.Unset},
56 {"Intercept.RecordToolUsage", 1, codes.Unset},
57 {"Intercept.RecordModelThought", 1, codes.Unset},
58 {"Intercept.ProcessRequest.Upstream", 1, codes.Unset},
59 }
60
61 expectStreaming := []expectTrace{
62 {"Intercept", 1, codes.Unset},
63 {"Intercept.CreateInterceptor", 1, codes.Unset},
64 {"Intercept.RecordInterception", 1, codes.Unset},
65 {"Intercept.ProcessRequest", 1, codes.Unset},
66 {"Intercept.RecordInterceptionEnded", 1, codes.Unset},
67 {"Intercept.RecordPromptUsage", 1, codes.Unset},
68 {"Intercept.RecordTokenUsage", 2, codes.Unset},
69 {"Intercept.RecordToolUsage", 1, codes.Unset},
70 {"Intercept.RecordModelThought", 1, codes.Unset},
71 {"Intercept.ProcessRequest.Upstream", 1, codes.Unset},
72 }
73
74 cases := []struct {
75 name string
76 fixture []byte
77 streaming bool
78 bedrock bool
79 expect []expectTrace
80 }{
81 {
82 name: "trace_anthr_non_streaming",
83 expect: expectNonStreaming,
84 fixture: fixtures.AntSingleBuiltinTool,
85 },
86 {
87 name: "trace_bedrock_non_streaming",
88 bedrock: true,
89 expect: expectNonStreaming,
90 fixture: fixtures.AntSingleBuiltinTool,
91 },
92 {
93 name: "trace_anthr_streaming",
94 streaming: true,
95 expect: expectStreaming,
96 fixture: fixtures.AntSingleBuiltinTool,
97 },
98 {
99 name: "trace_bedrock_streaming",
100 streaming: true,
101 bedrock: true,
102 expect: expectStreaming,

Callers

nothing calls this directly

Calls 13

ParseFunction · 0.92
setupTracerFunction · 0.85
newMockUpstreamFunction · 0.85
newFixtureResponseFunction · 0.85
withTracerFunction · 0.85
withProviderFunction · 0.85
newBridgeTestServerFunction · 0.85
verifyTracesFunction · 0.85
RequestMethod · 0.80
makeRequestMethod · 0.80
RecordedInterceptionsMethod · 0.80
GetMethod · 0.80

Tested by

no test coverage detected