Skip to content

Commit 3d5bd76

Browse files
committed
reorder to previous
1 parent 0eba5b8 commit 3d5bd76

3 files changed

Lines changed: 35 additions & 36 deletions

File tree

internal/integrationtest/bridge_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,6 @@ func TestErrorHandling(t *testing.T) {
11191119

11201120
resp := bridgeServer.makeRequest(t, http.MethodPost, tc.path, fix.Request())
11211121
t.Cleanup(func() { _ = resp.Body.Close() })
1122-
bridgeServer.Close()
11231122

11241123
tc.responseHandlerFn(resp)
11251124
bridgeServer.Recorder.VerifyAllInterceptionsEnded(t)

internal/integrationtest/mockmcp.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,6 @@ type mockMCP struct {
3131
calls *callAccumulator
3232
}
3333

34-
// callAccumulator tracks all tool invocations by name and each instance's arguments.
35-
type callAccumulator struct {
36-
calls map[string][]any
37-
callsMu sync.Mutex
38-
toolErrors map[string]string
39-
}
40-
4134
// getCallsByTool returns recorded arguments for a given tool name.
4235
func (m *mockMCP) getCallsByTool(name string) []any {
4336
return m.calls.getCallsByTool(name)
@@ -91,6 +84,13 @@ func newNoopMCPManager() mcp.ServerProxier {
9184
return mcp.NewServerProxyManager(nil, noop.NewTracerProvider().Tracer(""))
9285
}
9386

87+
// callAccumulator tracks all tool invocations by name and each instance's arguments.
88+
type callAccumulator struct {
89+
calls map[string][]any
90+
callsMu sync.Mutex
91+
toolErrors map[string]string
92+
}
93+
9494
func newCallAccumulator() *callAccumulator {
9595
return &callAccumulator{
9696
calls: make(map[string][]any),

internal/integrationtest/mockupstream.go

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,34 @@ type upstreamResponse struct {
3535
OnRequest func(r *http.Request, body []byte)
3636
}
3737

38+
// newFixtureResponse creates an upstreamResponse from a parsed fixture archive.
39+
// It reads whichever of 'streaming' and 'non-streaming' sections exist;
40+
// not every fixture has both (e.g. error fixtures may only define one).
41+
func newFixtureResponse(fix fixtures.Fixture) upstreamResponse {
42+
var resp upstreamResponse
43+
if fix.Has(fixtures.SectionStreaming) {
44+
resp.Streaming = fix.Streaming()
45+
}
46+
if fix.Has(fixtures.SectionNonStreaming) {
47+
resp.Blocking = fix.NonStreaming()
48+
}
49+
return resp
50+
}
51+
52+
// newFixtureToolResponse creates an upstreamResponse from the tool-call fixture files.
53+
// It reads whichever of 'streaming/tool-call' and 'non-streaming/tool-call'
54+
// sections exist.
55+
func newFixtureToolResponse(fix fixtures.Fixture) upstreamResponse {
56+
var resp upstreamResponse
57+
if fix.Has(fixtures.SectionStreamingToolCall) {
58+
resp.Streaming = fix.StreamingToolCall()
59+
}
60+
if fix.Has(fixtures.SectionNonStreamToolCall) {
61+
resp.Blocking = fix.NonStreamingToolCall()
62+
}
63+
return resp
64+
}
65+
3866
// receivedRequest captures the details of a single request handled by mockUpstream.
3967
type receivedRequest struct {
4068
Method string
@@ -70,34 +98,6 @@ type mockUpstream struct {
7098
responses []upstreamResponse
7199
}
72100

73-
// newFixtureResponse creates an upstreamResponse from a parsed fixture archive.
74-
// It reads whichever of 'streaming' and 'non-streaming' sections exist;
75-
// not every fixture has both (e.g. error fixtures may only define one).
76-
func newFixtureResponse(fix fixtures.Fixture) upstreamResponse {
77-
var resp upstreamResponse
78-
if fix.Has(fixtures.SectionStreaming) {
79-
resp.Streaming = fix.Streaming()
80-
}
81-
if fix.Has(fixtures.SectionNonStreaming) {
82-
resp.Blocking = fix.NonStreaming()
83-
}
84-
return resp
85-
}
86-
87-
// newFixtureToolResponse creates an upstreamResponse from the tool-call fixture files.
88-
// It reads whichever of 'streaming/tool-call' and 'non-streaming/tool-call'
89-
// sections exist.
90-
func newFixtureToolResponse(fix fixtures.Fixture) upstreamResponse {
91-
var resp upstreamResponse
92-
if fix.Has(fixtures.SectionStreamingToolCall) {
93-
resp.Streaming = fix.StreamingToolCall()
94-
}
95-
if fix.Has(fixtures.SectionNonStreamToolCall) {
96-
resp.Blocking = fix.NonStreamingToolCall()
97-
}
98-
return resp
99-
}
100-
101101
// receivedRequests returns a copy of all requests received so far.
102102
func (ms *mockUpstream) receivedRequests() []receivedRequest {
103103
ms.mu.Lock()

0 commit comments

Comments
 (0)