Repository navigation
test(client): add batch send-failure regression test - #386
jeanmatthieu merged 2 commits into
Conversation
|
Thanks for taking a look at this, @Bugraciftci, and for the clear root-cause write-up and tests. This is addressed on the
One gap: If you'd rather not, no problem: once you've had a chance to review the 1.0.0 change, feel free to close this PR. |
8d0083a to
17db2f1
Compare
|
Thanks for the pointer @jeanmatthieu! I've rebased the PR onto |
… of hanging A pending request does not respond to task cancellation, so the suite's `.timeLimit` cannot end a test that awaits a request nobody fails: it cancels the test's task, but `task.value` waits on a separate `Task`. With the cleanup in `sendBatch` removed, `sendFailure()` hung the test run. Await each request through `outcome(within:)` instead, so the regression fails in seconds, and expect the send's `transportError` rather than any `MCPError`, so an unrelated failure that never reaches `sendBatch` does not pass. Answer `initialize` with `#require` and decoding that throws, as `ClientUndecodableResponseTests` does, so a broken handshake records an issue instead of being skipped silently. Written with AI assistance.
|
Thanks @Bugraciftci, the rebase and the new test are exactly what we needed! I made a mistake in my earlier comment, though: the suite's I pushed a small follow-up commit to your branch:
Verified locally on macOS: |
db583c0
into
modelcontextprotocol:rel/1.0.0
Rebases #386 onto
rel/1.0.0, drops the pre-refactorClient.swiftchanges, and adds the missing regression test for #324 next tothrowingBody()inTests/MCPTests/RequestLifecycleTests.swift.Summary
BatchTests.sendFailure()connecting a.handshakeClientoverMockTransport, enablingsetFailSend(true), adding twoPing.request()calls insideclient.withBatch, and asserting bothwithBatchand the two returned requestTasks fail withMCPError.Batchessuite.timeLimit(.minutes(1))so any regression hang is caught directly without artificial sleeps.Verification
swift test --filter BatchTests: 4 tests in 1 suite passed.swift test: 1,420 tests in 144 suites passed (0 failures).Fixes #324.