Skip to content

Commit

Permalink
Add workflow-complete decision failure-handling
Browse files Browse the repository at this point in the history
See #9

Took 6 minutes
  • Loading branch information
EpicWink committed Mar 19, 2020
1 parent 67f14fd commit d420b58
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions tests/test_specs_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,57 @@ def test_decision_failure_raises(self, workflow, cause, exception_str):
instance.build_decisions()
assert str(e.value) == exception_str

def test_workflow_complete_decision_failure(self):
"""Test workflow-complete decision failure handling."""
# Build input
workflow = seddy_specs.DAGWorkflow.from_spec(
{
"name": "foo",
"version": "0.44",
"tasks": [],
"type": "dag",
}
)
workflow.setup()
task = {
"taskToken": "spam",
"previousStartedEventId": 3,
"startedEventId": 7,
"events": [
{"eventId": 1, "eventType": "WorkflowExecutionStarted"},
{"eventId": 2, "eventType": "DecisionTaskScheduled"},
{
"eventId": 3,
"eventType": "DecisionTaskStarted",
"decisionTaskStartedEventAttributes": {"identity": "spam-1234"},
},
{
"eventId": 4,
"eventType": "DecisionTaskCompleted",
"decisionTaskCompletedEventAttributes": {"startedEventId": 3},
},
{
"eventId": 5,
"eventType": "CompleteWorkflowExecutionFailed",
"completeWorkflowExecutionFailedEventAttributes": {
"cause": "UNHANDLED_DECISION",
"DecisionTaskCompletedEventId": 4,
},
},
{"eventId": 6, "eventType": "DecisionTaskScheduled"},
{
"eventId": 7,
"eventType": "DecisionTaskStarted",
"decisionTaskStartedEventAttributes": {"identity": "spam-1234"},
},
],
}
instance = seddy_specs.DAGBuilder(workflow, task)

# Run function
instance.build_decisions()
assert instance.decisions == [{"decisionType": "CompleteWorkflowExecution"}]


class TestWorkflow:
"""Test ``seddy._specs.DAGWorkflow``."""
Expand Down

0 comments on commit d420b58

Please sign in to comment.