StepFunctions: Ensure that all operations respect the FAILURE env var (#6204)
This commit is contained in:
parent
dda6e573dd
commit
c44f0b7395
@ -31,13 +31,40 @@ stepfunctions
|
||||
- [X] delete_state_machine
|
||||
- [ ] describe_activity
|
||||
- [X] describe_execution
|
||||
|
||||
The status of every execution is set to 'RUNNING' by default.
|
||||
Set the following environment variable if you want to get a FAILED status back:
|
||||
|
||||
.. sourcecode:: bash
|
||||
|
||||
SF_EXECUTION_HISTORY_TYPE=FAILURE
|
||||
|
||||
|
||||
- [ ] describe_map_run
|
||||
- [X] describe_state_machine
|
||||
- [ ] describe_state_machine_for_execution
|
||||
- [ ] get_activity_task
|
||||
- [X] get_execution_history
|
||||
|
||||
A static list of successful events is returned by default.
|
||||
Set the following environment variable if you want to get a static list of events for a failed execution:
|
||||
|
||||
.. sourcecode:: bash
|
||||
|
||||
SF_EXECUTION_HISTORY_TYPE=FAILURE
|
||||
|
||||
|
||||
- [ ] list_activities
|
||||
- [X] list_executions
|
||||
|
||||
The status of every execution is set to 'RUNNING' by default.
|
||||
Set the following environment variable if you want to get a FAILED status back:
|
||||
|
||||
.. sourcecode:: bash
|
||||
|
||||
SF_EXECUTION_HISTORY_TYPE=FAILURE
|
||||
|
||||
|
||||
- [ ] list_map_runs
|
||||
- [X] list_state_machines
|
||||
- [X] list_tags_for_resource
|
||||
|
@ -230,7 +230,11 @@ class Execution:
|
||||
self.start_date = iso_8601_datetime_with_milliseconds(datetime.now())
|
||||
self.state_machine_arn = state_machine_arn
|
||||
self.execution_input = execution_input
|
||||
self.status = "RUNNING"
|
||||
self.status = (
|
||||
"RUNNING"
|
||||
if settings.get_sf_execution_history_type() == "SUCCESS"
|
||||
else "FAILED"
|
||||
)
|
||||
self.stop_date = None
|
||||
|
||||
def get_execution_history(self, roleArn):
|
||||
@ -510,6 +514,14 @@ class StepFunctionBackend(BaseBackend):
|
||||
|
||||
@paginate(pagination_model=PAGINATION_MODEL)
|
||||
def list_executions(self, state_machine_arn, status_filter=None):
|
||||
"""
|
||||
The status of every execution is set to 'RUNNING' by default.
|
||||
Set the following environment variable if you want to get a FAILED status back:
|
||||
|
||||
.. sourcecode:: bash
|
||||
|
||||
SF_EXECUTION_HISTORY_TYPE=FAILURE
|
||||
"""
|
||||
executions = self.describe_state_machine(state_machine_arn).executions
|
||||
|
||||
if status_filter:
|
||||
@ -519,6 +531,14 @@ class StepFunctionBackend(BaseBackend):
|
||||
return executions
|
||||
|
||||
def describe_execution(self, execution_arn):
|
||||
"""
|
||||
The status of every execution is set to 'RUNNING' by default.
|
||||
Set the following environment variable if you want to get a FAILED status back:
|
||||
|
||||
.. sourcecode:: bash
|
||||
|
||||
SF_EXECUTION_HISTORY_TYPE=FAILURE
|
||||
"""
|
||||
self._validate_execution_arn(execution_arn)
|
||||
state_machine = self._get_state_machine_for_execution(execution_arn)
|
||||
exctn = next(
|
||||
@ -532,6 +552,14 @@ class StepFunctionBackend(BaseBackend):
|
||||
return exctn
|
||||
|
||||
def get_execution_history(self, execution_arn):
|
||||
"""
|
||||
A static list of successful events is returned by default.
|
||||
Set the following environment variable if you want to get a static list of events for a failed execution:
|
||||
|
||||
.. sourcecode:: bash
|
||||
|
||||
SF_EXECUTION_HISTORY_TYPE=FAILURE
|
||||
"""
|
||||
self._validate_execution_arn(execution_arn)
|
||||
state_machine = self._get_state_machine_for_execution(execution_arn)
|
||||
execution = next(
|
||||
|
@ -950,6 +950,12 @@ def test_state_machine_get_execution_history_contains_expected_failure_events_wh
|
||||
execution_history["events"].should.have.length_of(3)
|
||||
execution_history["events"].should.equal(expected_events)
|
||||
|
||||
exc = client.describe_execution(executionArn=execution["executionArn"])
|
||||
assert exc["status"] == "FAILED"
|
||||
|
||||
exc = client.list_executions(stateMachineArn=sm["stateMachineArn"])["executions"][0]
|
||||
assert exc["status"] == "FAILED"
|
||||
|
||||
|
||||
def _get_default_role():
|
||||
return "arn:aws:iam::" + ACCOUNT_ID + ":role/unknown_sf_role"
|
||||
|
Loading…
x
Reference in New Issue
Block a user