19 lines
665 B
Python
19 lines
665 B
Python
import pytest
|
|
|
|
from ._helpers import make_event, make_heartbeat
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_metrics_endpoint(app_client, auth_headers):
|
|
await app_client.post("/api/v1/heartbeat", json=make_heartbeat(), headers=auth_headers)
|
|
ev = make_event(status="critical", exit_code=2)
|
|
await app_client.post(
|
|
"/api/v1/events", json={"agent_id": "agent-1", "events": [ev]}, headers=auth_headers
|
|
)
|
|
r = await app_client.get("/metrics")
|
|
assert r.status_code == 200
|
|
body = r.text
|
|
assert "monlet_server_heartbeats_total" in body
|
|
assert "monlet_server_events_total" in body
|
|
assert "monlet_server_incidents_opened_total" in body
|