Skip to content

Commit ebd13cf

Browse files
committed
Fix failingHandlerFailsTheCallAndCancelsTheOthers flakes
Signed-off-by: Daniel Garnier-Moiroux <git@garnier.wf>
1 parent 8df9e9d commit ebd13cf

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎mcp-test/src/test/java/io/modelcontextprotocol/modern/client/McpAsyncClientInputTests.java‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949

5050
import static org.assertj.core.api.Assertions.assertThat;
5151
import static org.assertj.core.api.Assertions.assertThatThrownBy;
52+
import static org.awaitility.Awaitility.await;
5253

5354
/**
5455
* {@link McpAsyncClient} answering the modern server's input requests.
@@ -267,7 +268,9 @@ void failingHandlerFailsTheCallAndCancelsTheOthers() {
267268
assertThatThrownBy(() -> client.tool("everything").call().block(TIMEOUT))
268269
.isInstanceOf(IllegalStateException.class)
269270
.hasMessage("dialog closed");
270-
assertThat(consentCancelled).isTrue();
271+
// Cancellation runs asynchronously. Under high load (e.g. CI), the signal may not
272+
// be instantaneous
273+
await().atMost(TIMEOUT).pollDelay(Duration.ZERO).untilTrue(consentCancelled);
271274
assertThat(this.transport.requests()).hasSize(1);
272275
}
273276

0 commit comments

Comments
 (0)