Skip to content

Commit f19d122

Browse files
authored
Fix ordering flake in carriageReturnTerminatesAMessage test (#1264)
Signed-off-by: Daniel Garnier-Moiroux <[email protected]>
1 parent 6a35a9e commit f19d122

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎mcp-test/src/test/java/io/modelcontextprotocol/modern/server/transport/StdioMcpTransportTests.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -669,10 +669,10 @@ void carriageReturnTerminatesAMessage() throws Exception {
669669
.getBytes(StandardCharsets.UTF_8));
670670
this.clientOut.flush();
671671

672-
var firstResponse = readLineWithTimeout();
673-
var secondResponse = readLineWithTimeout();
674-
assertThatJson(firstResponse).isEqualTo(emptyResult(1));
675-
assertThatJson(secondResponse).isEqualTo(emptyResult(2));
672+
// Requests are handled concurrently, so responses may arrive in either order.
673+
assertThat(List.of(readLineWithTimeout(), readLineWithTimeout())).satisfiesExactlyInAnyOrder(
674+
response -> assertThatJson(response).isEqualTo(emptyResult(1)),
675+
response -> assertThatJson(response).isEqualTo(emptyResult(2)));
676676
}
677677

678678
@Test

0 commit comments

Comments
 (0)