fix: honor live scheduling revisions at dispatch
This commit is contained in:
@@ -56,9 +56,15 @@ def _scheduler(
|
||||
) -> tuple[Scheduler, FileScheduleStore, FileRunStore]:
|
||||
sched_store = FileScheduleStore(tmp_path / "sched")
|
||||
run_store = FileRunStore(tmp_path / "runs")
|
||||
|
||||
def revisioned_fixture_environment(sched: Any) -> Any:
|
||||
environment = fixture_environment(sched)
|
||||
deployment = environment.deployment.model_copy(update={"revision": 3})
|
||||
return environment.model_copy(update={"deployment": deployment})
|
||||
|
||||
preparer = SchedulePreparer(
|
||||
DictDeployments({"dep-1": {"rev": 3, "required": []}}),
|
||||
fixture_environment,
|
||||
revisioned_fixture_environment,
|
||||
)
|
||||
sched = Scheduler(
|
||||
schedule_store=sched_store,
|
||||
@@ -159,6 +165,23 @@ def test_unknown_deployment_rejects_without_a_run(tmp_path: Path) -> None:
|
||||
sched.ownership.release()
|
||||
|
||||
|
||||
def test_deployment_revision_mismatch_rejects_pinned_environment() -> None:
|
||||
"""Preparation fails when directory metadata no longer matches the pin."""
|
||||
preparer = SchedulePreparer(
|
||||
DictDeployments({"dep-1": {"rev": 2, "required": []}}),
|
||||
fixture_environment,
|
||||
)
|
||||
|
||||
result = preparer.prepare(
|
||||
sched=_sched_model("s"),
|
||||
intended=ts(2026, 9, 8, 12, 0),
|
||||
now=ts(2026, 9, 8, 12, 0),
|
||||
)
|
||||
|
||||
assert isinstance(result, PreparationRejected)
|
||||
assert result.reason == "deployment-changed"
|
||||
|
||||
|
||||
def test_missing_required_input_rejects_without_a_run(tmp_path: Path) -> None:
|
||||
sched_store = FileScheduleStore(tmp_path / "sched")
|
||||
run_store = FileRunStore(tmp_path / "runs")
|
||||
|
||||
Reference in New Issue
Block a user