Implement Execution inputs for Step Functions (#3284)
* Add input attribute to Execution and test with describe_execution * Switch back method name
This commit is contained in:
parent
8854fd06e8
commit
ca64d8fc7a
3 changed files with 43 additions and 13 deletions
|
|
@ -1,8 +1,8 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import boto3
|
||||
import json
|
||||
import sure # noqa
|
||||
import datetime
|
||||
|
||||
from datetime import datetime
|
||||
from botocore.exceptions import ClientError
|
||||
|
|
@ -134,7 +134,7 @@ def test_state_machine_creation_fails_with_invalid_names():
|
|||
#
|
||||
|
||||
for invalid_name in invalid_names:
|
||||
with assert_raises(ClientError) as exc:
|
||||
with assert_raises(ClientError):
|
||||
client.create_state_machine(
|
||||
name=invalid_name,
|
||||
definition=str(simple_definition),
|
||||
|
|
@ -147,7 +147,7 @@ def test_state_machine_creation_requires_valid_role_arn():
|
|||
client = boto3.client("stepfunctions", region_name=region)
|
||||
name = "example_step_function"
|
||||
#
|
||||
with assert_raises(ClientError) as exc:
|
||||
with assert_raises(ClientError):
|
||||
client.create_state_machine(
|
||||
name=name,
|
||||
definition=str(simple_definition),
|
||||
|
|
@ -242,7 +242,7 @@ def test_state_machine_creation_can_be_described():
|
|||
def test_state_machine_throws_error_when_describing_unknown_machine():
|
||||
client = boto3.client("stepfunctions", region_name=region)
|
||||
#
|
||||
with assert_raises(ClientError) as exc:
|
||||
with assert_raises(ClientError):
|
||||
unknown_state_machine = (
|
||||
"arn:aws:states:"
|
||||
+ region
|
||||
|
|
@ -258,7 +258,7 @@ def test_state_machine_throws_error_when_describing_unknown_machine():
|
|||
def test_state_machine_throws_error_when_describing_bad_arn():
|
||||
client = boto3.client("stepfunctions", region_name=region)
|
||||
#
|
||||
with assert_raises(ClientError) as exc:
|
||||
with assert_raises(ClientError):
|
||||
client.describe_state_machine(stateMachineArn="bad")
|
||||
|
||||
|
||||
|
|
@ -267,7 +267,7 @@ def test_state_machine_throws_error_when_describing_bad_arn():
|
|||
def test_state_machine_throws_error_when_describing_machine_in_different_account():
|
||||
client = boto3.client("stepfunctions", region_name=region)
|
||||
#
|
||||
with assert_raises(ClientError) as exc:
|
||||
with assert_raises(ClientError):
|
||||
unknown_state_machine = (
|
||||
"arn:aws:states:" + region + ":000000000000:stateMachine:unknown"
|
||||
)
|
||||
|
|
@ -376,7 +376,7 @@ def test_state_machine_start_execution():
|
|||
def test_state_machine_start_execution_bad_arn_raises_exception():
|
||||
client = boto3.client("stepfunctions", region_name=region)
|
||||
#
|
||||
with assert_raises(ClientError) as exc:
|
||||
with assert_raises(ClientError):
|
||||
client.start_execution(stateMachineArn="bad")
|
||||
|
||||
|
||||
|
|
@ -464,7 +464,7 @@ def test_state_machine_list_executions_when_none_exist():
|
|||
|
||||
@mock_stepfunctions
|
||||
@mock_sts
|
||||
def test_state_machine_describe_execution():
|
||||
def test_state_machine_describe_execution_with_no_input():
|
||||
client = boto3.client("stepfunctions", region_name=region)
|
||||
#
|
||||
sm = client.create_state_machine(
|
||||
|
|
@ -483,12 +483,36 @@ def test_state_machine_describe_execution():
|
|||
description.shouldnt.have("stopDate")
|
||||
|
||||
|
||||
@mock_stepfunctions
|
||||
@mock_sts
|
||||
def test_state_machine_describe_execution_with_custom_input():
|
||||
client = boto3.client("stepfunctions", region_name=region)
|
||||
#
|
||||
execution_input = json.dumps({"input_key": "input_val"})
|
||||
sm = client.create_state_machine(
|
||||
name="name", definition=str(simple_definition), roleArn=_get_default_role()
|
||||
)
|
||||
execution = client.start_execution(
|
||||
stateMachineArn=sm["stateMachineArn"], input=execution_input
|
||||
)
|
||||
description = client.describe_execution(executionArn=execution["executionArn"])
|
||||
#
|
||||
description["ResponseMetadata"]["HTTPStatusCode"].should.equal(200)
|
||||
description["executionArn"].should.equal(execution["executionArn"])
|
||||
description["input"].should.equal(execution_input)
|
||||
description["name"].shouldnt.be.empty
|
||||
description["startDate"].should.equal(execution["startDate"])
|
||||
description["stateMachineArn"].should.equal(sm["stateMachineArn"])
|
||||
description["status"].should.equal("RUNNING")
|
||||
description.shouldnt.have("stopDate")
|
||||
|
||||
|
||||
@mock_stepfunctions
|
||||
@mock_sts
|
||||
def test_execution_throws_error_when_describing_unknown_execution():
|
||||
client = boto3.client("stepfunctions", region_name=region)
|
||||
#
|
||||
with assert_raises(ClientError) as exc:
|
||||
with assert_raises(ClientError):
|
||||
unknown_execution = (
|
||||
"arn:aws:states:" + region + ":" + _get_account_id() + ":execution:unknown"
|
||||
)
|
||||
|
|
@ -519,7 +543,7 @@ def test_state_machine_can_be_described_by_execution():
|
|||
def test_state_machine_throws_error_when_describing_unknown_execution():
|
||||
client = boto3.client("stepfunctions", region_name=region)
|
||||
#
|
||||
with assert_raises(ClientError) as exc:
|
||||
with assert_raises(ClientError):
|
||||
unknown_execution = (
|
||||
"arn:aws:states:" + region + ":" + _get_account_id() + ":execution:unknown"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue