SFN: list_executions() now returns the StopDate-attribute (#6802)

This commit is contained in:
Bert Blommers 2023-09-10 18:14:41 +00:00 committed by GitHub
parent 03cc785615
commit de4ce26c20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 19 deletions

View File

@ -141,6 +141,7 @@ class StepFunctionResponse(BaseResponse):
"executionArn": execution.execution_arn,
"name": execution.name,
"startDate": execution.start_date,
"stopDate": execution.stop_date,
"stateMachineArn": state_machine.arn,
"status": execution.status,
}

View File

@ -758,15 +758,22 @@ def test_state_machine_throws_error_when_describing_unknown_execution():
def test_state_machine_stop_execution():
client = boto3.client("stepfunctions", region_name=region)
#
sm = client.create_state_machine(
sm_arn = client.create_state_machine(
name="name", definition=str(simple_definition), roleArn=_get_default_role()
)
start = client.start_execution(stateMachineArn=sm["stateMachineArn"])
)["stateMachineArn"]
start = client.start_execution(stateMachineArn=sm_arn)
stop = client.stop_execution(executionArn=start["executionArn"])
#
assert stop["ResponseMetadata"]["HTTPStatusCode"] == 200
assert isinstance(stop["stopDate"], datetime)
description = client.describe_execution(executionArn=start["executionArn"])
assert description["status"] == "ABORTED"
assert isinstance(description["stopDate"], datetime)
execution = client.list_executions(stateMachineArn=sm_arn)["executions"][0]
assert isinstance(execution["stopDate"], datetime)
@mock_stepfunctions
@mock_sts
@ -786,22 +793,6 @@ def test_state_machine_stop_raises_error_when_unknown_execution():
assert "Execution Does Not Exist:" in ex.value.response["Error"]["Message"]
@mock_stepfunctions
@mock_sts
def test_state_machine_describe_execution_after_stoppage():
client = boto3.client("stepfunctions", region_name=region)
sm = client.create_state_machine(
name="name", definition=str(simple_definition), roleArn=_get_default_role()
)
execution = client.start_execution(stateMachineArn=sm["stateMachineArn"])
client.stop_execution(executionArn=execution["executionArn"])
description = client.describe_execution(executionArn=execution["executionArn"])
#
assert description["ResponseMetadata"]["HTTPStatusCode"] == 200
assert description["status"] == "ABORTED"
assert isinstance(description["stopDate"], datetime)
@mock_stepfunctions
@mock_sts
def test_state_machine_get_execution_history_throws_error_with_unknown_execution():