From aea7b8bb32a1a5d1eb5312986af44fade2cb60de Mon Sep 17 00:00:00 2001 From: Daniel Garnier-Moiroux Date: Thu, 22 Oct 2026 18:51:25 +0200 Subject: [PATCH] Fix ordering flak in `carriageReturnTerminatesAMessage` test Signed-off-by: Daniel Garnier-Moiroux --- .../modern/server/transport/StdioMcpTransportTests.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mcp-test/src/test/java/io/modelcontextprotocol/modern/server/transport/StdioMcpTransportTests.java b/mcp-test/src/test/java/io/modelcontextprotocol/modern/server/transport/StdioMcpTransportTests.java index 293632f7d..b0cd9a490 100644 --- a/mcp-test/src/test/java/io/modelcontextprotocol/modern/server/transport/StdioMcpTransportTests.java +++ b/mcp-test/src/test/java/io/modelcontextprotocol/modern/server/transport/StdioMcpTransportTests.java @@ -669,10 +669,10 @@ void carriageReturnTerminatesAMessage() throws Exception { .getBytes(StandardCharsets.UTF_8)); this.clientOut.flush(); - var firstResponse = readLineWithTimeout(); - var secondResponse = readLineWithTimeout(); - assertThatJson(firstResponse).isEqualTo(emptyResult(1)); - assertThatJson(secondResponse).isEqualTo(emptyResult(2)); + // Requests are handled concurrently, so responses may arrive in either order. + assertThat(List.of(readLineWithTimeout(), readLineWithTimeout())).satisfiesExactlyInAnyOrder( + response -> assertThatJson(response).isEqualTo(emptyResult(1)), + response -> assertThatJson(response).isEqualTo(emptyResult(2))); } @Test