-
Notifications
You must be signed in to change notification settings - Fork 166
Add comprehensive test coverage for remote MCP server health check failures #3084
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3084 +/- ##
==========================================
+ Coverage 57.14% 57.25% +0.11%
==========================================
Files 341 341
Lines 34053 34075 +22
==========================================
+ Hits 19459 19510 +51
+ Misses 12985 12953 -32
- Partials 1609 1612 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jhrozek
left a comment
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.
Good test coverage for the health check failure scenarios!
Summary
This PR adds comprehensive test coverage for remote MCP server health check failure scenarios, ensuring that the health check callback mechanism works correctly when remote servers become unavailable.
Changes
TestTransparentProxy_RemoteServerFailure_5xxStatus- Tests 5xx status codes trigger callbackTestTransparentProxy_RemoteServerFailure_ConnectionRefused- Tests connection failuresTestTransparentProxy_RemoteServerFailure_Timeout- Tests timeout scenariosTestTransparentProxy_RemoteServerFailure_BecomesUnavailable- Tests server becoming unavailable after being healthyTestTransparentProxy_RemoteServerFailure_Different5xxCodes- Table-driven test for various 5xx codes (500, 502, 503, 504)TestTransparentProxy_RemoteServerHealthy_4xxCodes- Verifies 4xx codes are considered healthyTestTransparentProxy_HealthCheckNotRunBeforeInitialization- Ensures health checks skip until initializationTestTransparentProxy_HealthCheckFailureWithNilCallback- Tests graceful handling with nil callbackTechnical Improvements
IsServerInitializedfromint32toatomic.Boolfor thread-safe accessserverInitialized()getter method for better encapsulationTesting
-raceflag enabledhttptest.NewServerto simulate different failure scenariossync.Mutexfor callback trackingRelated
Addresses test coverage gap identified in PR #3077 for remote MCP server health check failure handling.