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 <christian.tzolov@broadcom.com> Co-authored-by: Daniel Garnier-Moiroux <git@garnier.wf>
This commit is contained in:
parent
4d779e139c
commit
ec4b329699
1 changed files with 29 additions and 19 deletions
|
|
@ -10,6 +10,7 @@ import eu.rekawek.toxiproxy.model.ToxicDirection;
|
|||
import io.modelcontextprotocol.spec.McpClientTransport;
|
||||
import io.modelcontextprotocol.spec.McpSchema;
|
||||
import io.modelcontextprotocol.spec.McpTransport;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -48,7 +49,7 @@ public abstract class AbstractMcpAsyncClientResiliencyTests {
|
|||
|
||||
// Uses the https://github.com/tzolov/mcp-everything-server-docker-image
|
||||
@SuppressWarnings("resource")
|
||||
static GenericContainer<?> container = new GenericContainer<>("docker.io/tzolov/mcp-everything-server:v2")
|
||||
static GenericContainer<?> container = new GenericContainer<>("docker.io/tzolov/mcp-everything-server:v3")
|
||||
.withCommand("node dist/index.js streamableHttp")
|
||||
.withLogConsumer(outputFrame -> System.out.println(outputFrame.getUtf8String()))
|
||||
.withNetwork(network)
|
||||
|
|
@ -134,10 +135,13 @@ public abstract class AbstractMcpAsyncClientResiliencyTests {
|
|||
AtomicReference<McpAsyncClient> client = new AtomicReference<>();
|
||||
|
||||
assertThatCode(() -> {
|
||||
// Do not advertise roots. Otherwise, the server will list roots during
|
||||
// initialization. The client responds asynchronously, and there might be a
|
||||
// rest condition in tests where we disconnect right after initialization.
|
||||
McpClient.AsyncSpec builder = McpClient.async(transport)
|
||||
.requestTimeout(getRequestTimeout())
|
||||
.initializationTimeout(getInitializationTimeout())
|
||||
.capabilities(McpSchema.ClientCapabilities.builder().roots(true).build());
|
||||
.capabilities(McpSchema.ClientCapabilities.builder().build());
|
||||
builder = customizer.apply(builder);
|
||||
client.set(builder.build());
|
||||
}).doesNotThrowAnyException();
|
||||
|
|
|
|||
Loading…
Reference in a new issue