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
This commit is contained in:
Christian Tzolov 2024-12-12 21:45:44 +01:00
commit a4950c04a5
3 changed files with 3 additions and 6 deletions

View file

@ -40,7 +40,7 @@ public class McpAsyncClient extends DefaultMcpSession {
};
public McpAsyncClient(McpTransport transport) {
this(transport, Duration.ofSeconds(10), new ObjectMapper());
this(transport, Duration.ofSeconds(20), new ObjectMapper());
}
public McpAsyncClient(McpTransport transport, Duration requestTimeout, ObjectMapper objectMapper) {

View file

@ -22,7 +22,6 @@ import java.util.Map;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import reactor.test.StepVerifier;
@ -45,7 +44,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
* @author Christian Tzolov
* @author Dariusz Jędrzejczyk
*/
@Disabled
@Timeout(15) // Giving extra time beyond the client timeout
class McpAsyncClientTests {
@ -53,7 +51,7 @@ class McpAsyncClientTests {
private ServerParameters stdioParams;
private static final Duration TIMEOUT = Duration.ofSeconds(10);
private static final Duration TIMEOUT = Duration.ofSeconds(20);
private static final String TEST_MESSAGE = "Hello MCP Spring AI!";
@ -144,7 +142,6 @@ class McpAsyncClientTests {
}).verifyComplete();
}
@Disabled
@Test
void testMcpAsyncClientState() {
assertThat(mcpAsyncClient).isNotNull();

View file

@ -52,7 +52,7 @@ class McpSyncClientTests {
private ServerParameters stdioParams;
private static final Duration TIMEOUT = Duration.ofSeconds(10);
private static final Duration TIMEOUT = Duration.ofSeconds(20);
private static final String TEST_MESSAGE = "Hello MCP Spring AI!";