Stop the live HUD reconnect storm (nginx WS snippet + backoff), copy intel/nous_client into the summarizer image, and make event ingest idempotent on URL. GDELT uses the DOC API; NWS no longer sends bbox; FIRMS is one ON CONFLICT batch; GET /api/aircraft serves last-known. Health reports freshness without 503ing docker. EONET + CISA KEV added.
33 lines
865 B
Python
33 lines
865 B
Python
"""Liveness stays up; readiness/freshness is explicit."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import asyncio
|
|
|
|
import httpx
|
|
|
|
from main import app
|
|
|
|
BASE = "http://test"
|
|
|
|
|
|
async def _get(path: str) -> httpx.Response:
|
|
transport = httpx.ASGITransport(app=app)
|
|
async with httpx.AsyncClient(transport=transport, base_url=BASE) as client:
|
|
return await client.get(path)
|
|
|
|
|
|
def test_health_includes_checks_even_when_db_ok(monkeypatch):
|
|
"""HUD must be able to show degraded without docker killing the container."""
|
|
body = asyncio.run(_get("/api/health")).json()
|
|
assert "status" in body
|
|
assert "checks" in body
|
|
assert "db" in body["checks"]
|
|
|
|
|
|
def test_ready_endpoint_exists():
|
|
resp = asyncio.run(_get("/api/ready"))
|
|
assert resp.status_code in (200, 503)
|
|
body = resp.json()
|
|
assert "checks" in body
|
|
assert "status" in body
|