Skip to content

Commit 6041286

Browse files
TMHSDigitalclaude
andcommitted
Accept a nil Serve error in TestGoneClientStopsQueuedCalls (#240)
On Linux the test's input reached EOF before the failed write cancelled the session, so Serve returned nil after the cancelled call finished, which is correct. The test now accepts nil or context.Canceled; what it checks is that Serve returns promptly. Refs #240 Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent bcf9885 commit 6041286

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎internal/mcp/mcp_test.go‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,10 @@ func TestGoneClientStopsQueuedCalls(t *testing.T) {
365365
go func() { done <- (&Server{Tools: []Tool{block}}).Serve(context.Background(), in, brokenWriter{}) }()
366366
select {
367367
case err := <-done:
368-
if !errors.Is(err, context.Canceled) {
369-
t.Errorf("Serve returned %v, want context.Canceled from the failed write", err)
368+
// nil when the input's end is read before the failed write cancels
369+
// the session; either way the queued call did not run on.
370+
if err != nil && !errors.Is(err, context.Canceled) {
371+
t.Errorf("Serve returned %v, want nil or context.Canceled", err)
370372
}
371373
case <-time.After(5 * time.Second):
372374
t.Fatal("Serve kept running queued calls after its client was gone")

0 commit comments

Comments
 (0)