structured logging around key workflows and docs for operational readiness

This commit is contained in:
2026-04-26 17:02:24 +02:00
parent 2902e362df
commit 99bb851ca8
8 changed files with 288 additions and 5 deletions

View File

@@ -64,6 +64,30 @@ def test_docs_endpoint_is_available():
assert "openapi.json" in response.text
def test_health_reports_database_and_checkout_root(tmp_path):
def override_settings():
return Settings(
database_path=str(tmp_path / "health.sqlite3"),
checkout_root=str(tmp_path / "checkouts"),
)
app.dependency_overrides[get_settings] = override_settings
client = TestClient(app)
try:
response = client.get("/health")
assert response.status_code == 200
body = response.json()
assert body["status"] == "ok"
assert body["database"]["reachable"] is True
assert body["database"]["error"] is None
assert body["database"]["path"].endswith("health.sqlite3")
assert body["checkout_root"]["path"].endswith("checkouts")
assert body["checkout_root"]["exists"] is False
finally:
app.dependency_overrides.clear()
def test_api_manual_registry_loop(tmp_path):
def override_settings():
return Settings(
@@ -429,6 +453,7 @@ def test_settings_can_load_from_environment(monkeypatch):
monkeypatch.setenv("REPO_REGISTRY_LLM_PROVIDER", "mock")
monkeypatch.setenv("REPO_REGISTRY_LLM_MODEL", "demo-model")
monkeypatch.setenv("REPO_REGISTRY_EMBEDDING_PROVIDER", "hashing")
monkeypatch.setenv("REPO_REGISTRY_LOG_LEVEL", "DEBUG")
settings = Settings()
@@ -437,6 +462,7 @@ def test_settings_can_load_from_environment(monkeypatch):
assert settings.llm_provider == "mock"
assert settings.llm_model == "demo-model"
assert settings.embedding_provider == "hashing"
assert settings.log_level == "DEBUG"
def test_api_analysis_run_loop(tmp_path):