Spaces:
Running
Running
File size: 456 Bytes
e7d7c61 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# tests/test_health_and_metrics.py
from fastapi.testclient import TestClient
from app.main import app
client = TestClient(app)
def test_healthz_ok():
r = client.get("/healthz")
assert r.status_code == 200
assert r.text == "ok"
def test_metrics_exposes_prometheus():
# Hit one endpoint to bump counters
client.get("/healthz")
r = client.get("/metrics")
assert r.status_code == 200
assert "http_requests_total" in r.text
|