ForcePilot/backend/test/integration/channel/test_metrics_router.py

27 lines
880 B
Python
Raw Normal View History

"""
Integration tests for channel metrics endpoint (/metrics).
"""
from __future__ import annotations
import pytest
pytestmark = [pytest.mark.asyncio, pytest.mark.integration]
async def test_metrics_returns_prometheus_format(test_client):
response = await test_client.get("/metrics")
if response.status_code == 503:
pytest.skip("Channel gateway not initialized")
assert response.status_code == 200, response.text
assert "text/plain" in response.headers.get("content-type", "")
body = response.text
assert "# HELP" in body or "# TYPE" in body or body.strip() == ""
async def test_metrics_no_auth_required(test_client):
response = await test_client.get("/metrics")
if response.status_code == 503:
pytest.skip("Channel gateway not initialized")
assert response.status_code != 401, "metrics endpoint should not require auth"