Skip to content

Commit

Permalink
Error on constructing start operation with invalid conflict policy
Browse files Browse the repository at this point in the history
  • Loading branch information
dandavison committed Dec 19, 2024
1 parent 74e009f commit 3808da2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions temporalio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2615,6 +2615,8 @@ def __init__(
name, result_type_from_run_fn = (
temporalio.workflow._Definition.get_name_and_result_type(workflow)
)
if id_conflict_policy == temporalio.common.WorkflowIDConflictPolicy.UNSPECIFIED:
raise ValueError("WorkflowIDConflictPolicy is required")

self._start_workflow_input = UpdateWithStartStartWorkflowInput(
workflow=name,
Expand Down
19 changes: 19 additions & 0 deletions tests/worker/test_update_with_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,3 +496,22 @@ async def test_update_with_start_client_outbound_interceptor(

wf_handle = await start_op.workflow_handle()
assert await wf_handle.result() == "intercepted-workflow-arg"


def test_with_start_workflow_operation_requires_conflict_policy():
with pytest.raises(ValueError):
WithStartWorkflowOperation(
WorkflowForUpdateWithStartTest.run,
0,
id="wid-1",
id_conflict_policy=WorkflowIDConflictPolicy.UNSPECIFIED,
task_queue="test-queue",
)

with pytest.raises(TypeError):
WithStartWorkflowOperation( # type: ignore
WorkflowForUpdateWithStartTest.run,
0,
id="wid-1",
task_queue="test-queue",
)

0 comments on commit 3808da2

Please sign in to comment.