test(gateway): add unit tests for HealthHandlers#232
Open
eclipse0922 wants to merge 4 commits intoselfpatch:mainfrom
Open
test(gateway): add unit tests for HealthHandlers#232eclipse0922 wants to merge 4 commits intoselfpatch:mainfrom
eclipse0922 wants to merge 4 commits intoselfpatch:mainfrom
Conversation
Adds 14 unit tests covering the three HealthHandlers methods: - handle_health: verifies status field, timestamp, valid JSON body - handle_version_info: verifies sovd_info array, version, base_uri, vendor_info - handle_root: verifies required fields, endpoints list, capabilities, auth-disabled behavior (no auth endpoints, capabilities.authentication=false), and auth-enabled behavior (auth endpoints appear in list) Uses a null GatewayNode and null AuthManager, which is safe because none of these handler methods call ctx_.node() or ctx_.auth_manager(). Closes selfpatch#177 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds dedicated GTest coverage for the gateway’s simplest REST handlers (HealthHandlers), improving confidence in the /health, /, and /version-info responses and ensuring auth/tls capability reporting remains correct.
Changes:
- Added 14 unit tests validating JSON structure and key fields for
handle_health,handle_root, andhandle_version_info. - Added auth-disabled vs auth-enabled expectations for endpoint listing and capabilities in root response.
- Registered the new test target in
CMakeLists.txt, including coverage flags wiring.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/ros2_medkit_gateway/test/test_health_handlers.cpp |
New unit test suite covering health/root/version-info handler response schemas and capability toggles. |
src/ros2_medkit_gateway/CMakeLists.txt |
Adds test_health_handlers target and includes it in coverage instrumentation list. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HealthHandlers(handle_health,handle_root,handle_version_info)status/timestampfields, SOVDsovd_infoarray,vendor_info, endpoint list, capabilitiescapabilities.authentication=false) and auth-enabled behavior (auth endpoints appear)GatewayNodeand nullAuthManager— safe because none of these handlers callctx_.node()orctx_.auth_manager()test_health_handlersto CMakeLists.txt with coverage supportTest plan
colcon test --ctest-args -R test_health_handlersros2_medkit_dev:latestCloses #177
🤖 Generated with Claude Code