feat(flywheel): expose incident processing timeline
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 10m56s
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 10m56s
This commit is contained in:
25
apps/api/tests/test_incident_timeline_service.py
Normal file
25
apps/api/tests/test_incident_timeline_service.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from src.services.incident_timeline_service import STAGE_DEFS, format_ascii_timeline
|
||||
|
||||
|
||||
def _stages(status_by_stage: dict[str, str]) -> list[dict]:
|
||||
return [
|
||||
{"stage": stage, "status": status_by_stage.get(stage, "skipped")}
|
||||
for stage, _label in STAGE_DEFS
|
||||
]
|
||||
|
||||
|
||||
def test_format_ascii_timeline_skips_unrecorded_stages() -> None:
|
||||
stages = _stages({
|
||||
"webhook": "completed",
|
||||
"ai_router": "success",
|
||||
"executor": "error",
|
||||
"km": "pending",
|
||||
})
|
||||
|
||||
assert format_ascii_timeline(stages) == (
|
||||
"webhook:ok > ai_router:ok > executor:fail > km:wait"
|
||||
)
|
||||
|
||||
|
||||
def test_format_ascii_timeline_has_empty_fallback() -> None:
|
||||
assert format_ascii_timeline(_stages({})) == "webhook:skip > ai:skip > executor:skip"
|
||||
Reference in New Issue
Block a user