docs/test: align scheduling cleanup

This commit is contained in:
lda
2026-09-10 05:26:40 +07:00 Verified
parent 4474135301
commit 422dd57db6
8 changed files with 59 additions and 35 deletions
+2 -2
View File
@@ -94,8 +94,8 @@ def test_thesis_bundle_has_reproducible_agent_evaluation_assets() -> None:
assert "figure-format.lua" in generate_script
assert "thesisFigureFormat" in generate_script
assert (
generate_script.index("$include_markdown_filter `")
< generate_script.index("$diagram_filter `")
generate_script.index('"--lua-filter", $include_markdown_filter')
< generate_script.index('"--lua-filter", $diagram_filter')
< generate_script.index("--filter=pandoc-crossref")
)
assert "generate_agent_challenge_evaluation.py" in combined_build_script
+4 -2
View File
@@ -265,8 +265,10 @@ async def test_settlement_does_not_block_the_event_loop(
await service.start()
service.schedule_store.create_schedule(_sched_model("a", intended))
await service.poll_once(intended + timedelta(seconds=1))
await asyncio.sleep(0.05)
assert settlement_started.is_set()
# The worker releases itself after two seconds as failure-safe cleanup.
# Keep this bounded wait shorter than that timeout so the assertion
# observes the intentionally blocked settlement rather than its guard.
assert await asyncio.to_thread(settlement_started.wait, 1.0)
assert not settlement_finished.is_set()
assert service.live_executions == 1
release.set()
+3 -1
View File
@@ -100,7 +100,9 @@ def test_competing_processes_share_the_canonical_lock(tmp_path: Path) -> None:
comp = tmp_path / "composition"
comp.mkdir(parents=True)
sched_store, run_store = _stores(comp)
identity = Path(canonical_lock_root(sched_store.root, run_store.root) or "")
resolved = canonical_lock_root(sched_store.root, run_store.root)
assert resolved is not None
identity = Path(resolved)
holder = SchedulerOwnership(identity, owner="parent").acquire()
try:
script_path = tmp_path / "compete_canonical.py"
+2
View File
@@ -51,6 +51,7 @@ def test_competing_process_cannot_acquire_while_held(tmp_path: Path) -> None:
capture_output=True,
text=True,
timeout=30,
cwd=Path(__file__).resolve().parents[2],
)
assert proc.returncode == 0, proc.stderr
assert "second-owner-rejected" in proc.stdout
@@ -73,6 +74,7 @@ def test_lock_released_on_process_death(tmp_path: Path) -> None:
)
proc = subprocess.Popen(
[sys.executable, str(script_path)],
cwd=Path(__file__).resolve().parents[2],
stdout=subprocess.PIPE,
text=True,
)
@@ -356,6 +356,12 @@ def _entries(root: Path, schedule_id: str, kind: str) -> list[dict[str, Any]]:
return [row for row in rows if row["kind"] == kind]
async def _kinds(root: Path, schedule_id: str) -> list[str]:
page = FileScheduleStore(root).list_occurrences(schedule_id, limit=100)
rows = cast(list[dict[str, Any]], page["occurrences"])
return [row["kind"] for row in rows]
def _run_ids(root: Path) -> list[str]:
return [record.id for record in FileRunStore(root).list_runs()]
@@ -610,7 +616,7 @@ asyncio.run(main())
text=True,
)
try:
output, _ = process.communicate(timeout=7)
output, _ = process.communicate(timeout=30)
except subprocess.TimeoutExpired:
process.kill()
output, _ = process.communicate(timeout=5)
@@ -1761,12 +1767,6 @@ async def test_shutdown_timeout_spares_healthy_sibling(tmp_path: Path) -> None:
await service.stop()
async def _kinds(root: Path, schedule_id: str) -> list[str]:
page = FileScheduleStore(root).list_occurrences(schedule_id, limit=100)
rows = cast(list[dict[str, Any]], page["occurrences"])
return [row["kind"] for row in rows]
async def test_scheduled_resume_records_completion_live(tmp_path: Path) -> None:
"""A resumed completion lands in occurrence history live (B3).