Skip to content

Commit a4950c0

Browse files
committed
test: increase MCP client timeout to 20s and enable tests
- Doubles the default timeout from 10s to 20s in McpAsyncClient - Updates corresponding timeout values in test classes - Enables previously disabled async client tests
1 parent c41f3fe commit a4950c0

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

spring-ai-mcp-core/src/main/java/org/springframework/ai/mcp/client/McpAsyncClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class McpAsyncClient extends DefaultMcpSession {
4040
};
4141

4242
public McpAsyncClient(McpTransport transport) {
43-
this(transport, Duration.ofSeconds(10), new ObjectMapper());
43+
this(transport, Duration.ofSeconds(20), new ObjectMapper());
4444
}
4545

4646
public McpAsyncClient(McpTransport transport, Duration requestTimeout, ObjectMapper objectMapper) {

spring-ai-mcp-core/src/test/java/org/springframework/ai/mcp/client/McpAsyncClientTests.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.fasterxml.jackson.databind.ObjectMapper;
2323
import org.junit.jupiter.api.AfterEach;
2424
import org.junit.jupiter.api.BeforeEach;
25-
import org.junit.jupiter.api.Disabled;
2625
import org.junit.jupiter.api.Test;
2726
import org.junit.jupiter.api.Timeout;
2827
import reactor.test.StepVerifier;
@@ -45,15 +44,14 @@
4544
* @author Christian Tzolov
4645
* @author Dariusz Jędrzejczyk
4746
*/
48-
@Disabled
4947
@Timeout(15) // Giving extra time beyond the client timeout
5048
class McpAsyncClientTests {
5149

5250
private McpAsyncClient mcpAsyncClient;
5351

5452
private ServerParameters stdioParams;
5553

56-
private static final Duration TIMEOUT = Duration.ofSeconds(10);
54+
private static final Duration TIMEOUT = Duration.ofSeconds(20);
5755

5856
private static final String TEST_MESSAGE = "Hello MCP Spring AI!";
5957

@@ -144,7 +142,6 @@ void testListResources() {
144142
}).verifyComplete();
145143
}
146144

147-
@Disabled
148145
@Test
149146
void testMcpAsyncClientState() {
150147
assertThat(mcpAsyncClient).isNotNull();

spring-ai-mcp-core/src/test/java/org/springframework/ai/mcp/client/McpSyncClientTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class McpSyncClientTests {
5252

5353
private ServerParameters stdioParams;
5454

55-
private static final Duration TIMEOUT = Duration.ofSeconds(10);
55+
private static final Duration TIMEOUT = Duration.ofSeconds(20);
5656

5757
private static final String TEST_MESSAGE = "Hello MCP Spring AI!";
5858

0 commit comments

Comments
 (0)