mirror of
https://github.com/azaion/detections.git
synced 2026-04-22 09:06:31 +00:00
Update health endpoint and refine test documentation
- Modified the health endpoint to return "None" for AI availability when inference is not initialized, improving clarity on system status. - Enhanced the test documentation to include handling of skipped tests, emphasizing the need for investigation before proceeding. - Updated test assertions to ensure proper execution order and prevent premature engine initialization. - Refactored test cases to streamline performance testing and improve readability, removing unnecessary complexity. These changes aim to enhance the robustness of the health check and improve the overall testing framework.
This commit is contained in:
@@ -23,8 +23,10 @@ class TestHealthEngineStep01PreInit:
|
||||
data = _get_health(http_client)
|
||||
assert time.monotonic() - t0 < 2.0
|
||||
assert data["status"] == "healthy"
|
||||
if data["aiAvailability"] != "None":
|
||||
pytest.skip("engine already initialized by earlier tests")
|
||||
assert data["aiAvailability"] == "None", (
|
||||
f"engine already initialized (aiAvailability={data['aiAvailability']}); "
|
||||
"pre-init tests must run before any test that triggers warm_engine"
|
||||
)
|
||||
assert data.get("errorMessage") is None
|
||||
|
||||
|
||||
@@ -33,8 +35,10 @@ class TestHealthEngineStep01PreInit:
|
||||
class TestHealthEngineStep02LazyInit:
|
||||
def test_ft_p_14_lazy_initialization(self, http_client, image_small):
|
||||
before = _get_health(http_client)
|
||||
if before["aiAvailability"] != "None":
|
||||
pytest.skip("engine already initialized by earlier tests")
|
||||
assert before["aiAvailability"] == "None", (
|
||||
f"engine already initialized (aiAvailability={before['aiAvailability']}); "
|
||||
"lazy-init test must run before any test that triggers warm_engine"
|
||||
)
|
||||
files = {"file": ("lazy.jpg", image_small, "image/jpeg")}
|
||||
r = http_client.post("/detect", files=files, timeout=_DETECT_TIMEOUT)
|
||||
r.raise_for_status()
|
||||
|
||||
Reference in New Issue
Block a user