Skip to content

Commit c7bd7ec

Browse files
committed
Fix flaky sessionIsEvictedWhenTheClientAbortsAResponseStream
With a zero initial delay, the Tomcat request thread fired the tool's first tick and could keep processing the virtual-time queue. Then advanceTimeBy() on the test thread returned before the sweeps ran. Delaying the first tick keeps the ticks and sweeps on the test thread. Signed-off-by: Daniel Garnier-Moiroux <git@garnier.wf>
1 parent ff871a4 commit c7bd7ec

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎mcp-test/src/test/java/io/modelcontextprotocol/server/HttpServletStreamableIntegrationTests.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ void sessionIsEvictedWhenTheClientAbortsAResponseStream() {
572572
.tools(McpServerFeatures.AsyncToolSpecification.builder()
573573
.tool(McpSchema.Tool.builder("hangs", EMPTY_JSON_SCHEMA).description("never returns").build())
574574
.callHandler((exchange, request) -> Flux
575-
.interval(Duration.ZERO, toolEmissionInterval, Schedulers.newSingle("test-tool"))
575+
.interval(toolEmissionInterval, toolEmissionInterval, Schedulers.newSingle("test-tool"))
576576
.flatMap(tick -> exchange.loggingNotification(McpSchema.LoggingMessageNotification.builder()
577577
.level(McpSchema.LoggingLevel.INFO)
578578
.data("x".repeat(64 * 1024))

0 commit comments

Comments
 (0)