fix: validate schedule update bounds
This commit is contained in:
@@ -12,6 +12,7 @@ from wf_transport_rpc_http.models import (
|
||||
SetWorkflowOutputBindingsParams,
|
||||
StartRunParams,
|
||||
TraceRangeParams,
|
||||
UpdateScheduleParams,
|
||||
)
|
||||
|
||||
|
||||
@@ -61,6 +62,38 @@ def test_run_params_are_explicit_models() -> None:
|
||||
assert trace.trace_range.limit == 1
|
||||
|
||||
|
||||
def test_update_schedule_params_match_create_numeric_constraints() -> None:
|
||||
valid = UpdateScheduleParams(
|
||||
schedule_id="schedule",
|
||||
expected_revision=1,
|
||||
max_active_runs=2,
|
||||
lateness_allowance_s=0,
|
||||
max_steps=10,
|
||||
)
|
||||
assert valid.max_active_runs == 2
|
||||
assert valid.lateness_allowance_s == 0
|
||||
assert valid.max_steps == 10
|
||||
|
||||
with pytest.raises(ValidationError):
|
||||
UpdateScheduleParams(
|
||||
schedule_id="schedule", expected_revision=1, max_active_runs=0
|
||||
)
|
||||
with pytest.raises(ValidationError):
|
||||
UpdateScheduleParams(
|
||||
schedule_id="schedule", expected_revision=1, lateness_allowance_s=-1
|
||||
)
|
||||
with pytest.raises(ValidationError):
|
||||
UpdateScheduleParams(schedule_id="schedule", expected_revision=1, max_steps=0)
|
||||
with pytest.raises(ValidationError):
|
||||
UpdateScheduleParams(
|
||||
schedule_id="schedule", expected_revision=1, max_steps=True
|
||||
)
|
||||
with pytest.raises(ValidationError):
|
||||
UpdateScheduleParams(
|
||||
schedule_id="schedule", expected_revision=1, max_steps="10"
|
||||
)
|
||||
|
||||
|
||||
def test_step_input_params_accept_composite_bindings_but_workflow_output_does_not() -> (
|
||||
None
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user