decomposer: generate deliverable files for Define the service contract and project architecture for the FastAPI endpoint monitoring service.; Implement the typed monitor CRUD API and concurrency-safe in-memory state according to the service design.; Implement secure on-demand endpoint checks with status updates, latency measurement, robust error handling, and redacted structured logs.; Add operational API endpoints and environment-driven runtime configuration to the monitoring service.; Create automated tests for the monitoring service.; Package the service with Docker and developer documentation.; Validate the complete project.
Some checks failed
ci / quality (push) Has been cancelled
ci / container (push) Has been cancelled

This commit is contained in:
2026-08-09 16:07:10 +00:00
parent 66f4854063
commit c27984722d

View File

@@ -1 +1,29 @@
# Env var setup that must run before app.config is imported.
from collections.abc import AsyncIterator
import pytest
from fastapi.testclient import TestClient
from app.config import Settings
from app.main import create_app
from app.models import CurrentStatus, MonitorState, utc_now
class FakeChecker:
async def check(self, monitor_id: str, target_url: str) -> CurrentStatus:
return CurrentStatus(
state=MonitorState.UP,
checked_at=utc_now(),
latency_ms=3.5,
http_status=204,
)
@pytest.fixture
def anyio_backend() -> str:
return "asyncio"
@pytest.fixture
def client() -> AsyncIterator[TestClient]:
with TestClient(create_app(Settings(), checker=FakeChecker())) as test_client: # type: ignore[arg-type]
yield test_client