Skip to content

Commit ec4b329

Browse files
tzolovKehrlann
andauthored
test: upgrade mcp-everything-server to v3 and fix resiliency test race condition (#536)
- Upgrade Docker test server image from v2 to v3 across all test files - Updates all test files to use the latest version of the mcp-everything-server Docker image (v3) for integration testing. - Fix race condition in async client tests by not advertising roots capability during initialization - Prevents server from listing roots during init which could cause timing issues when disconnecting immediately after initialization - Applied fix to AbstractMcpAsyncClientResiliencyTests (both mcp and mcp-test modules) and HttpSseMcpAsyncClientLostConnectionTests Signed-off-by: Christian Tzolov <[email protected]> Co-authored-by: Daniel Garnier-Moiroux <[email protected]>
1 parent 4d779e1 commit ec4b329

15 files changed

+29
-19
lines changed

mcp-spring/mcp-spring-webflux/src/test/java/io/modelcontextprotocol/client/WebClientStreamableHttpAsyncClientTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class WebClientStreamableHttpAsyncClientTests extends AbstractMcpAsyncCli
2121

2222
// Uses the https://github.com/tzolov/mcp-everything-server-docker-image
2323
@SuppressWarnings("resource")
24-
static GenericContainer<?> container = new GenericContainer<>("docker.io/tzolov/mcp-everything-server:v2")
24+
static GenericContainer<?> container = new GenericContainer<>("docker.io/tzolov/mcp-everything-server:v3")
2525
.withCommand("node dist/index.js streamableHttp")
2626
.withLogConsumer(outputFrame -> System.out.println(outputFrame.getUtf8String()))
2727
.withExposedPorts(3001)

mcp-spring/mcp-spring-webflux/src/test/java/io/modelcontextprotocol/client/WebClientStreamableHttpSyncClientTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class WebClientStreamableHttpSyncClientTests extends AbstractMcpSyncClien
2121

2222
// Uses the https://github.com/tzolov/mcp-everything-server-docker-image
2323
@SuppressWarnings("resource")
24-
static GenericContainer<?> container = new GenericContainer<>("docker.io/tzolov/mcp-everything-server:v2")
24+
static GenericContainer<?> container = new GenericContainer<>("docker.io/tzolov/mcp-everything-server:v3")
2525
.withCommand("node dist/index.js streamableHttp")
2626
.withLogConsumer(outputFrame -> System.out.println(outputFrame.getUtf8String()))
2727
.withExposedPorts(3001)

mcp-spring/mcp-spring-webflux/src/test/java/io/modelcontextprotocol/client/WebFluxSseMcpAsyncClientTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class WebFluxSseMcpAsyncClientTests extends AbstractMcpAsyncClientTests {
2828

2929
// Uses the https://github.com/tzolov/mcp-everything-server-docker-image
3030
@SuppressWarnings("resource")
31-
static GenericContainer<?> container = new GenericContainer<>("docker.io/tzolov/mcp-everything-server:v2")
31+
static GenericContainer<?> container = new GenericContainer<>("docker.io/tzolov/mcp-everything-server:v3")
3232
.withCommand("node dist/index.js sse")
3333
.withLogConsumer(outputFrame -> System.out.println(outputFrame.getUtf8String()))
3434
.withExposedPorts(3001)

mcp-spring/mcp-spring-webflux/src/test/java/io/modelcontextprotocol/client/WebFluxSseMcpSyncClientTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class WebFluxSseMcpSyncClientTests extends AbstractMcpSyncClientTests {
2828

2929
// Uses the https://github.com/tzolov/mcp-everything-server-docker-image
3030
@SuppressWarnings("resource")
31-
static GenericContainer<?> container = new GenericContainer<>("docker.io/tzolov/mcp-everything-server:v2")
31+
static GenericContainer<?> container = new GenericContainer<>("docker.io/tzolov/mcp-everything-server:v3")
3232
.withCommand("node dist/index.js sse")
3333
.withLogConsumer(outputFrame -> System.out.println(outputFrame.getUtf8String()))
3434
.withExposedPorts(3001)

mcp-spring/mcp-spring-webflux/src/test/java/io/modelcontextprotocol/client/transport/WebClientStreamableHttpTransportErrorHandlingTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
import org.junit.jupiter.api.AfterEach;
2222
import org.junit.jupiter.api.BeforeEach;
23-
import org.junit.jupiter.api.Disabled;
2423
import org.junit.jupiter.api.Test;
2524
import org.junit.jupiter.api.Timeout;
2625
import org.springframework.web.reactive.function.client.WebClient;

mcp-spring/mcp-spring-webflux/src/test/java/io/modelcontextprotocol/client/transport/WebFluxSseClientTransportTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class WebFluxSseClientTransportTests {
4444
static String host = "http://localhost:3001";
4545

4646
@SuppressWarnings("resource")
47-
static GenericContainer<?> container = new GenericContainer<>("docker.io/tzolov/mcp-everything-server:v2")
47+
static GenericContainer<?> container = new GenericContainer<>("docker.io/tzolov/mcp-everything-server:v3")
4848
.withCommand("node dist/index.js sse")
4949
.withLogConsumer(outputFrame -> System.out.println(outputFrame.getUtf8String()))
5050
.withExposedPorts(3001)

mcp-test/src/main/java/io/modelcontextprotocol/client/AbstractMcpAsyncClientResiliencyTests.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import io.modelcontextprotocol.spec.McpClientTransport;
1111
import io.modelcontextprotocol.spec.McpSchema;
1212
import io.modelcontextprotocol.spec.McpTransport;
13+
import org.junit.jupiter.api.Disabled;
1314
import org.junit.jupiter.api.Test;
1415
import org.slf4j.Logger;
1516
import org.slf4j.LoggerFactory;
@@ -48,7 +49,7 @@ public abstract class AbstractMcpAsyncClientResiliencyTests {
4849

4950
// Uses the https://github.com/tzolov/mcp-everything-server-docker-image
5051
@SuppressWarnings("resource")
51-
static GenericContainer<?> container = new GenericContainer<>("docker.io/tzolov/mcp-everything-server:v2")
52+
static GenericContainer<?> container = new GenericContainer<>("docker.io/tzolov/mcp-everything-server:v3")
5253
.withCommand("node dist/index.js streamableHttp")
5354
.withLogConsumer(outputFrame -> System.out.println(outputFrame.getUtf8String()))
5455
.withNetwork(network)
@@ -134,10 +135,13 @@ McpAsyncClient client(McpClientTransport transport, Function<McpClient.AsyncSpec
134135
AtomicReference<McpAsyncClient> client = new AtomicReference<>();
135136

136137
assertThatCode(() -> {
138+
// Do not advertise roots. Otherwise, the server will list roots during
139+
// initialization. The client responds asynchronously, and there might be a
140+
// rest condition in tests where we disconnect right after initialization.
137141
McpClient.AsyncSpec builder = McpClient.async(transport)
138142
.requestTimeout(getRequestTimeout())
139143
.initializationTimeout(getInitializationTimeout())
140-
.capabilities(McpSchema.ClientCapabilities.builder().roots(true).build());
144+
.capabilities(McpSchema.ClientCapabilities.builder().build());
141145
builder = customizer.apply(builder);
142146
client.set(builder.build());
143147
}).doesNotThrowAnyException();

mcp/src/test/java/io/modelcontextprotocol/client/AbstractMcpAsyncClientResiliencyTests.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import io.modelcontextprotocol.spec.McpClientTransport;
1111
import io.modelcontextprotocol.spec.McpSchema;
1212
import io.modelcontextprotocol.spec.McpTransport;
13+
import org.junit.jupiter.api.Disabled;
1314
import org.junit.jupiter.api.Test;
1415
import org.slf4j.Logger;
1516
import org.slf4j.LoggerFactory;
@@ -49,7 +50,7 @@ public abstract class AbstractMcpAsyncClientResiliencyTests {
4950

5051
// Uses the https://github.com/tzolov/mcp-everything-server-docker-image
5152
@SuppressWarnings("resource")
52-
static GenericContainer<?> container = new GenericContainer<>("docker.io/tzolov/mcp-everything-server:v2")
53+
static GenericContainer<?> container = new GenericContainer<>("docker.io/tzolov/mcp-everything-server:v3")
5354
.withCommand("node dist/index.js streamableHttp")
5455
.withLogConsumer(outputFrame -> System.out.println(outputFrame.getUtf8String()))
5556
.withNetwork(network)
@@ -135,10 +136,13 @@ McpAsyncClient client(McpClientTransport transport, Function<McpClient.AsyncSpec
135136
AtomicReference<McpAsyncClient> client = new AtomicReference<>();
136137

137138
assertThatCode(() -> {
139+
// Do not advertise roots. Otherwise, the server will list roots during
140+
// initialization. The client responds asynchronously, and there might be a
141+
// rest condition in tests where we disconnect right after initialization.
138142
McpClient.AsyncSpec builder = McpClient.async(transport)
139143
.requestTimeout(getRequestTimeout())
140144
.initializationTimeout(getInitializationTimeout())
141-
.capabilities(McpSchema.ClientCapabilities.builder().roots(true).build());
145+
.capabilities(McpSchema.ClientCapabilities.builder().build());
142146
builder = customizer.apply(builder);
143147
client.set(builder.build());
144148
}).doesNotThrowAnyException();

mcp/src/test/java/io/modelcontextprotocol/client/HttpClientStreamableHttpAsyncClientTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class HttpClientStreamableHttpAsyncClientTests extends AbstractMcpAsyncCl
2020

2121
// Uses the https://github.com/tzolov/mcp-everything-server-docker-image
2222
@SuppressWarnings("resource")
23-
static GenericContainer<?> container = new GenericContainer<>("docker.io/tzolov/mcp-everything-server:v2")
23+
static GenericContainer<?> container = new GenericContainer<>("docker.io/tzolov/mcp-everything-server:v3")
2424
.withCommand("node dist/index.js streamableHttp")
2525
.withLogConsumer(outputFrame -> System.out.println(outputFrame.getUtf8String()))
2626
.withExposedPorts(3001)

mcp/src/test/java/io/modelcontextprotocol/client/HttpClientStreamableHttpSyncClientTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class HttpClientStreamableHttpSyncClientTests extends AbstractMcpSyncClie
3232

3333
// Uses the https://github.com/tzolov/mcp-everything-server-docker-image
3434
@SuppressWarnings("resource")
35-
static GenericContainer<?> container = new GenericContainer<>("docker.io/tzolov/mcp-everything-server:v2")
35+
static GenericContainer<?> container = new GenericContainer<>("docker.io/tzolov/mcp-everything-server:v3")
3636
.withCommand("node dist/index.js streamableHttp")
3737
.withLogConsumer(outputFrame -> System.out.println(outputFrame.getUtf8String()))
3838
.withExposedPorts(3001)

0 commit comments

Comments
 (0)