-
Notifications
You must be signed in to change notification settings - Fork 703
test: health check test #4495
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?
test: health check test #4495
Conversation
WalkthroughA new health-check payload helper function is added to validate backend status and endpoints, then integrated into three VLLM test configurations to execute health checks before other payloads. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks❌ Failed checks (2 warnings, 1 inconclusive)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
tests/utils/payload_builder.py (2)
286-286: Remove redundant import.
BasePayloadis already imported at the top of the file (line 7), so this local import is unnecessary.Apply this diff:
- from tests.utils.payloads import BasePayload - class BackendHealthPayload(BasePayload):
313-319: Consider adding a shorter timeout for health checks.Health checks typically benefit from shorter timeouts (e.g., 10-15 seconds) rather than the default 60 seconds from
BasePayload. This would allow faster failure detection if the backend is unresponsive.You could add a
timeoutparameter to the function and pass it to the payload:def backend_health_check_payload( port: int = 8080, expected_log: Optional[List[str]] = None, timeout: int = 15, ): """Create a backend health check payload that validates system status health endpoint.""" class BackendHealthPayload(BasePayload): endpoint: str = "/health" method: str = "GET" def response_handler(self, response): response.raise_for_status() data = response.json() # Check status is "ready" status = data.get("status", "") if status != "ready": raise AssertionError( f"Backend health status is '{status}', expected 'ready'" ) # Check that endpoints are listed endpoints = data.get("endpoints", {}) if not endpoints: raise AssertionError("Backend health check returned no endpoints") # Return summary for validation return ( f"Backend healthy: status={status}, endpoints={list(endpoints.keys())}" ) return BackendHealthPayload( body={}, port=port, repeat_count=1, expected_log=expected_log or [], expected_response=["Backend healthy"], timeout=timeout, )
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
tests/serve/test_vllm.py(4 hunks)tests/utils/payload_builder.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
tests/serve/test_vllm.py (1)
tests/utils/payload_builder.py (1)
backend_health_check_payload(281-319)
tests/utils/payload_builder.py (1)
tests/utils/payloads.py (6)
BasePayload(29-98)response_handler(54-56)response_handler(154-155)response_handler(176-177)response_handler(217-218)response_handler(247-249)
🪛 Ruff (0.14.5)
tests/utils/payload_builder.py
299-301: Avoid specifying long messages outside the exception class
(TRY003)
306-306: Avoid specifying long messages outside the exception class
(TRY003)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: sglang (amd64)
- GitHub Check: vllm (amd64)
- GitHub Check: trtllm (amd64)
- GitHub Check: operator (amd64)
- GitHub Check: operator (arm64)
- GitHub Check: Build and Test - dynamo
🔇 Additional comments (2)
tests/utils/payload_builder.py (1)
288-311: LGTM! Well-structured health check validation.The inner class pattern is appropriate here, and the validation logic correctly checks both the status field and the presence of endpoints. The GET method is correct for a health endpoint.
Note: Static analysis flagged the exception messages (lines 299-301, 306) as potentially verbose, but for test code where clarity is important, these descriptive messages are actually helpful for debugging.
tests/serve/test_vllm.py (1)
17-17: LGTM! Clean integration of health checks.The import is correctly added, and the health check payload is consistently placed as the first request in three VLLM test configurations. This ensures the backend is healthy before running subsequent test requests. The consistent use of port 8081 across all configurations is appropriate.
Also applies to: 47-47, 61-61, 74-74
Overview:
Details:
Where should the reviewer start?
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.