-
Notifications
You must be signed in to change notification settings - Fork 310
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
Conversation
tzolov
commented
Mar 19, 2025
•
edited by chemicL
Loading
edited by chemicL
- 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>
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
There was a problem hiding this 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); |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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>
Thanks for the suggestions @chemicL . Last commit addresses them all. |
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>