ConfigManager V2

This commit is contained in:
2026-02-19 22:45:06 +03:00
parent da8ed4fa2b
commit 7eb3476b96
17 changed files with 801 additions and 2 deletions

View File

@@ -0,0 +1,41 @@
import asyncio
from config_manager.v2.health import HealthServer
def test_health_mapping_ok_to_200():
async def provider():
return {"status": "ok"}
async def scenario() -> None:
server = HealthServer(
host="127.0.0.1",
port=8000,
path="/health",
timeout=0.2,
health_provider=provider,
)
code, payload = await server._build_health_response()
assert code == 200
assert payload["status"] == "ok"
asyncio.run(scenario())
def test_health_mapping_unhealthy_to_503():
async def provider():
return {"status": "unhealthy", "detail": "worker failed"}
async def scenario() -> None:
server = HealthServer(
host="127.0.0.1",
port=8000,
path="/health",
timeout=0.2,
health_provider=provider,
)
code, payload = await server._build_health_response()
assert code == 503
assert payload["status"] == "unhealthy"
asyncio.run(scenario())