Skip to content

Commit a7e09a9

Browse files
committed
orkes-conductor-957: update Terminate API
test attempt
1 parent 344df92 commit a7e09a9

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

tests/integration/workflow/test_workflow_execution.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def test_workflow_methods(
124124
version=1234,
125125
).add(
126126
task
127-
)
127+
).failure_workflow(workflow_name)
128128
workflow_executor.register_workflow(
129129
workflow.to_workflow_def(),
130130
overwrite=True,
@@ -142,11 +142,15 @@ def test_workflow_methods(
142142
_restart_workflow(workflow_executor, workflow_id)
143143
_terminate_workflow(workflow_executor, workflow_id)
144144
_retry_workflow(workflow_executor, workflow_id)
145-
_terminate_workflow(workflow_executor, workflow_id)
145+
failure_wf_id = _terminate_workflow_with_failure(workflow_executor, workflow_id, True)
146+
_terminate_workflow(workflow_executor, failure_wf_id)
146147
_rerun_workflow(workflow_executor, workflow_id)
147148
workflow_executor.remove_workflow(
148149
workflow_id, archive_workflow=False
149150
)
151+
workflow_executor.remove_workflow(
152+
failure_wf_id, archive_workflow=False
153+
)
150154

151155

152156
def test_workflow_registration(workflow_executor: WorkflowExecutor):
@@ -266,6 +270,18 @@ def _terminate_workflow(workflow_executor: WorkflowExecutor, workflow_id: str) -
266270
f'workflow expected to be TERMINATED, but received {workflow_status.status}, workflow_id: {workflow_id}'
267271
)
268272

273+
def _terminate_workflow_with_failure(workflow_executor: WorkflowExecutor, workflow_id: str, trigger_failure_workflow: bool) -> str:
274+
workflow_executor.terminate(workflow_id, 'test', trigger_failure_workflow)
275+
workflow_status = workflow_executor.get_workflow_status(
276+
workflow_id,
277+
include_output=True,
278+
include_variables=False,
279+
)
280+
if workflow_status.status != 'TERMINATED':
281+
raise Exception(
282+
f'workflow expected to be TERMINATED, but received {workflow_status.status}, workflow_id: {workflow_id}'
283+
)
284+
return workflow_status.output.get('conductor.failure_workflow')
269285

270286
def _restart_workflow(workflow_executor: WorkflowExecutor, workflow_id: str) -> None:
271287
workflow_executor.restart(workflow_id)

0 commit comments

Comments
 (0)