Spaces:
Runtime error
Runtime error
Download tests/test_metrics.py from RamshaAnwar/contextquery-api: direct link, hf CLI and curl.
- Browser
- Download file 665 Bytes
-
https://huggingface.co/spaces/RamshaAnwar/contextquery-api/resolve/main/tests/test_metrics.py
- Command line
-
hf download hf://spaces/RamshaAnwar/contextquery-api/tests/test_metrics.py
-
curl -L -o test_metrics.py https://huggingface.co/spaces/RamshaAnwar/contextquery-api/resolve/main/tests/test_metrics.py
665 Bytes
| import pytest | |
| def test_metrics_endpoint_returns_prometheus_text(client): | |
| """Verify that /metrics is public and returns valid Prometheus format.""" | |
| res = client.get("/metrics") | |
| assert res.status_code == 200 | |
| assert "text/plain" in res.headers["content-type"] | |
| # Prometheus format usually includes HELP and TYPE lines | |
| content = res.text | |
| assert "# HELP" in content or "# TYPE" in content | |
| # It should track HTTP requests (this might require a request to happen first) | |
| # Trigger a request to increment the counter | |
| client.get("/healthz") | |
| res2 = client.get("/metrics") | |
| assert "http_requests_total" in res2.text |