feat: Improve stackchain-dashboard health and reliability #28
|
|
@ -21,6 +21,12 @@ app.add_middleware(
|
||||||
app.include_router(frontend_router)
|
app.include_router(frontend_router)
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/healthz")
|
||||||
|
def health() -> dict[str, str]:
|
||||||
|
"""Return process liveness without depending on Gitea."""
|
||||||
|
return {"status": "ok", "service": "stackchain-dashboard"}
|
||||||
|
|
||||||
|
|
||||||
@app.get("/api/v1/context")
|
@app.get("/api/v1/context")
|
||||||
async def context() -> JSONResponse:
|
async def context() -> JSONResponse:
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
6
tests/test_health.py
Normal file
6
tests/test_health.py
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
from src.main import app, health
|
||||||
|
|
||||||
|
|
||||||
|
def test_health_endpoint_reports_service_liveness_without_gitea_access():
|
||||||
|
assert any(getattr(route, "path", None) == "/healthz" for route in app.routes)
|
||||||
|
assert health() == {"status": "ok", "service": "stackchain-dashboard"}
|
||||||
Loading…
Reference in New Issue
Block a user