Skip to content

Commit 85538e2

Browse files
committed
Failing test
1 parent a9c71aa commit 85538e2

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

tests/nexus/test_workflow_caller_errors.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
sync_operation,
2222
)
2323

24-
from temporalio import workflow
24+
from temporalio import nexus, workflow
2525
from temporalio.client import (
2626
Client,
2727
WorkflowFailureError,
@@ -47,6 +47,13 @@ class ErrorTestInput:
4747
id: str
4848

4949

50+
@workflow.defn
51+
class NonTerminatingWorkflow:
52+
@workflow.run
53+
async def run(self) -> None:
54+
await asyncio.Event().wait()
55+
56+
5057
@nexusrpc.handler.service_handler
5158
class ErrorTestService:
5259
@nexusrpc.handler.sync_operation
@@ -87,6 +94,18 @@ def retried_due_to_internal_handler_error(
8794
type=nexusrpc.HandlerErrorType.INTERNAL,
8895
)
8996

97+
@nexusrpc.handler.sync_operation
98+
async def fails_due_to_workflow_already_started(
99+
self, ctx: nexusrpc.handler.StartOperationContext, input: ErrorTestInput
100+
) -> None:
101+
operation_invocation_counts[input.id] += 1
102+
for _ in range(2):
103+
await nexus.client().start_workflow(
104+
NonTerminatingWorkflow.run,
105+
id="second-start-request-will-fail",
106+
task_queue=nexus.info().task_queue,
107+
)
108+
90109

91110
@workflow.defn(sandboxed=False)
92111
class CallerWorkflow:
@@ -156,6 +175,11 @@ async def times_called() -> int:
156175
nexusrpc.HandlerErrorType.NOT_FOUND,
157176
"No handler for service",
158177
),
178+
(
179+
"fails_due_to_workflow_already_started",
180+
nexusrpc.HandlerErrorType.INTERNAL,
181+
"already started",
182+
),
159183
],
160184
)
161185
async def test_nexus_operation_fails_without_retry_as_handler_error(

0 commit comments

Comments
 (0)