chore: tighten scheduling review coverage

This commit is contained in:
lda
2026-09-09 21:50:24 +07:00 Verified
parent afb291d55c
commit 2ecdbdaa7f
17 changed files with 358 additions and 366 deletions
+10 -3
View File
@@ -17,6 +17,7 @@ from pathlib import Path
from typing import Any, cast
import pytest
from pydantic import ValidationError
from tests.artifacts.test_run_store import artifact as _artifact
from tests.artifacts.test_run_store import deployment as _deployment
@@ -588,7 +589,7 @@ async def test_tick_error_recorded_and_loop_continues(tmp_path: Path) -> None:
broken_path = tmp_path / "schedules" / "broken" / "schedule.json"
good_text = broken_path.read_text(encoding="utf-8")
broken_path.write_text('{"id": "broken", "trigger": {"kind": "bogus"}}')
with pytest.raises(Exception):
with pytest.raises(ValidationError):
await service.poll_once(intended + timedelta(seconds=1))
assert service.last_tick_error is not None
assert service.run_store.list_runs() == []
@@ -689,7 +690,10 @@ async def test_live_runtime_failure_spares_healthy_sibling(
hang_id, sib_id = await _poll_two(service, intended)
await _wait_for(lambda: runtime.started.is_set())
await _wait_for(
lambda: service.run_store.get_run(sib_id).status.value == "failed"
lambda: (
service.run_store.get_run(sib_id).status.value == "failed"
and not service.run_store.is_executing(sib_id)
)
)
failed = service.run_store.get_run(sib_id)
assert failed.status.value == "failed"
@@ -744,7 +748,10 @@ async def test_live_settlement_failure_spares_healthy_sibling(
hang_id, sib_id = await _poll_two(service, intended)
await _wait_for(lambda: runtime.started.is_set())
await _wait_for(
lambda: service.run_store.get_run(sib_id).status.value == "failed"
lambda: (
service.run_store.get_run(sib_id).status.value == "failed"
and not service.run_store.is_executing(sib_id)
)
)
assert fired["done"]
assert not service.run_store.is_executing(sib_id)