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:
Oleksandr Bezdieniezhnykh
2026-03-30 01:17:53 +03:00
parent 5a968edcba
commit 86b8f076b7
11 changed files with 2130 additions and 307 deletions
-20
View File
@@ -4,26 +4,6 @@ import requests
_DETECT_TIMEOUT = 60
def test_ft_n_06_loader_unreachable_during_init_health(
http_client, mock_loader_url, image_small
):
h0 = http_client.get("/health")
h0.raise_for_status()
if h0.json().get("aiAvailability") != "None":
pytest.skip("engine already warm")
requests.post(
f"{mock_loader_url}/mock/config", json={"mode": "error"}, timeout=10
).raise_for_status()
files = {"file": ("n06.jpg", image_small, "image/jpeg")}
r = http_client.post("/detect", files=files, timeout=_DETECT_TIMEOUT)
assert r.status_code != 500
h = http_client.get("/health")
assert h.status_code == 200
d = h.json()
assert d["status"] == "healthy"
assert d.get("errorMessage") is None
def test_nft_res_01_loader_outage_after_init(
warm_engine, http_client, mock_loader_url, image_small
):