Skip to content

refactor: improve MCP client timeout handling and reactive testing #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 19, 2025

Conversation

tzolov
Copy link
Contributor

@tzolov tzolov commented Mar 19, 2025

  • Add configurable initialization timeout separate from request timeout
  • Rename ServletSse* test classes to HttpSse* for better naming consistency
  • Replace direct .block() calls with StepVerifier for better reactive testing
  • Improve error handling and reactive programming patterns throughout tests
  • Chain reactive operations for cleaner test flow

- Add configurable initialization timeout separate from request timeout
- Rename ServletSse* test classes to HttpSse* for better naming consistency
- Replace direct .block() calls with StepVerifier for better reactive testing
- Change ping() method to return Mono instead of Mono
- Improve error handling and reactive programming patterns throughout tests
- Chain reactive operations for cleaner test flow

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
@tzolov tzolov added the client label Mar 19, 2025
@tzolov tzolov added this to the 0.8.0 milestone Mar 19, 2025
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
Copy link
Member

@chemicL chemicL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this will help a bit. Next step is to incorporate the VirtualTimeScheduler to avoid actually timing out after 1s but immediately doing so. I noticed some breaking changes, perhaps it's best to introduce them in a separate PR to highlight in the release notes easier?

@@ -39,17 +40,13 @@ void customErrorHandlerShouldReceiveErrors() {
((StdioClientTransport) mcpTransport).setStdErrorHandler(error -> receivedError.set(error));

String errorMessage = "Test error";
((StdioClientTransport) mcpTransport).getErrorSink().tryEmitNext(errorMessage);
((StdioClientTransport) mcpTransport).getErrorSink().emitNext(errorMessage, null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can yield an NPE

*/
public Object ping() {
return this.delegate.ping().block();
public void ping() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change

*/
public Mono<Object> ping() {
public Mono<Void> ping() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Breaking change

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
@tzolov
Copy link
Contributor Author

tzolov commented Mar 19, 2025

Thanks for the suggestions @chemicL . Last commit addresses them all.

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
@tzolov tzolov merged commit 92ec67a into main Mar 19, 2025
1 of 2 checks passed
@tzolov tzolov deleted the improve-client-tests branch March 19, 2025 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants