new: uv project with a /livez probe app (#74)
uv project on Python 3.14 with Ruff (incl. DTZ), pyright strict, and `just test/lint` as dev dependencies. The internal probe app serves a constant `/livez`; the public API app doesn't serve it (ADR-0009). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
16aa73251b
commit
586cd91f82
11 files changed
+553
-1
No files matched your search
@@ -0,0 +1,26 @@
|
||||
"""The internal `:8081` listener serves unauthenticated probes the public API never does."""
|
||||
|
||||
from httpx import ASGITransport, AsyncClient
|
||||
|
||||
from hapi.app import create_api_app, create_probe_app
|
||||
|
||||
|
||||
async def test_livez_returns_constant_ok_on_the_probe_listener() -> None:
|
||||
async with AsyncClient(
|
||||
transport=ASGITransport(app=create_probe_app()), base_url="http://probes"
|
||||
) as client:
|
||||
first = await client.get("/livez")
|
||||
second = await client.get("/livez")
|
||||
|
||||
assert first.status_code == 200
|
||||
assert first.json() == {"status": "ok"}
|
||||
assert second.json() == first.json()
|
||||
|
||||
|
||||
async def test_livez_is_not_served_on_the_public_api() -> None:
|
||||
async with AsyncClient(
|
||||
transport=ASGITransport(app=create_api_app()), base_url="http://api"
|
||||
) as client:
|
||||
response = await client.get("/livez")
|
||||
|
||||
assert response.status_code == 404
|
||||
Reference in new issue
Block a user