test(cron): adapt guard-leak regression to owner-fenced dispatch on main

The salvaged regression from #86582 predates the claim_job_for_fire
owner-fencing that landed with #70638; mock the claim and heartbeat so
the healthy job actually runs through the fenced flow.
This commit is contained in:
Teknium
2026-08-14 20:58:37 -07:00
parent 569b7a34b1
commit 5733ec097b

View File

@@ -178,7 +178,17 @@ class TestRunningJobGuard:
monkeypatch.setattr(sched, "_deliver_result", lambda *_a, **_kw: None)
monkeypatch.setattr(sched, "finish_execution", lambda *_a, **_kw: None)
monkeypatch.setattr(sched, "claim_dispatch", lambda *_a, **_kw: True)
monkeypatch.setattr(
sched,
"claim_job_for_fire",
lambda job_id, **_kw: dict(
healthy_job, fire_claim={"by": "test-owner", "at": "now"}
)
if job_id == "healthy-job"
else None,
)
monkeypatch.setattr(sched, "mark_execution_running", lambda *_a, **_kw: None)
monkeypatch.setattr(sched, "heartbeat_fire_claim", lambda *_a, **_kw: True)
n = sched.tick(verbose=False)