Support more defaults in SWF workflow registration
SWF workflow type now keeps track of the default task-priority and default AWS Lambda role, set at workflow registration.
This commit is contained in:
parent
aeb194fc57
commit
979d20753c
@ -8,6 +8,8 @@ class WorkflowType(GenericType):
|
|||||||
"defaultChildPolicy",
|
"defaultChildPolicy",
|
||||||
"defaultExecutionStartToCloseTimeout",
|
"defaultExecutionStartToCloseTimeout",
|
||||||
"defaultTaskStartToCloseTimeout",
|
"defaultTaskStartToCloseTimeout",
|
||||||
|
"defaultTaskPriority",
|
||||||
|
"defaultLambdaRole",
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -300,6 +300,12 @@ class SWFResponse(BaseResponse):
|
|||||||
default_execution_start_to_close_timeout = self._params.get(
|
default_execution_start_to_close_timeout = self._params.get(
|
||||||
"defaultExecutionStartToCloseTimeout"
|
"defaultExecutionStartToCloseTimeout"
|
||||||
)
|
)
|
||||||
|
default_task_priority = self._params.get(
|
||||||
|
"defaultTaskPriority"
|
||||||
|
)
|
||||||
|
default_lambda_role = self._params.get(
|
||||||
|
"defaultLambdaRole"
|
||||||
|
)
|
||||||
description = self._params.get("description")
|
description = self._params.get("description")
|
||||||
|
|
||||||
self._check_string(domain)
|
self._check_string(domain)
|
||||||
@ -309,10 +315,10 @@ class SWFResponse(BaseResponse):
|
|||||||
self._check_none_or_string(default_child_policy)
|
self._check_none_or_string(default_child_policy)
|
||||||
self._check_none_or_string(default_task_start_to_close_timeout)
|
self._check_none_or_string(default_task_start_to_close_timeout)
|
||||||
self._check_none_or_string(default_execution_start_to_close_timeout)
|
self._check_none_or_string(default_execution_start_to_close_timeout)
|
||||||
|
self._check_none_or_string(default_task_priority)
|
||||||
|
self._check_none_or_string(default_lambda_role)
|
||||||
self._check_none_or_string(description)
|
self._check_none_or_string(description)
|
||||||
|
|
||||||
# TODO: add defaultTaskPriority when boto gets to support it
|
|
||||||
# TODO: add defaultLambdaRole when boto gets to support it
|
|
||||||
self.swf_backend.register_type(
|
self.swf_backend.register_type(
|
||||||
"workflow",
|
"workflow",
|
||||||
domain,
|
domain,
|
||||||
@ -322,6 +328,8 @@ class SWFResponse(BaseResponse):
|
|||||||
default_child_policy=default_child_policy,
|
default_child_policy=default_child_policy,
|
||||||
default_task_start_to_close_timeout=default_task_start_to_close_timeout,
|
default_task_start_to_close_timeout=default_task_start_to_close_timeout,
|
||||||
default_execution_start_to_close_timeout=default_execution_start_to_close_timeout,
|
default_execution_start_to_close_timeout=default_execution_start_to_close_timeout,
|
||||||
|
default_task_priority=default_task_priority,
|
||||||
|
default_lambda_role=default_lambda_role,
|
||||||
description=description,
|
description=description,
|
||||||
)
|
)
|
||||||
return ""
|
return ""
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import sure
|
import sure
|
||||||
import boto
|
import boto
|
||||||
|
import boto3
|
||||||
|
|
||||||
from moto import mock_swf_deprecated
|
from moto import mock_swf_deprecated
|
||||||
|
from moto import mock_swf
|
||||||
from boto.swf.exceptions import SWFResponseError
|
from boto.swf.exceptions import SWFResponseError
|
||||||
|
|
||||||
|
|
||||||
@ -133,6 +135,41 @@ def test_describe_workflow_type():
|
|||||||
infos["status"].should.equal("REGISTERED")
|
infos["status"].should.equal("REGISTERED")
|
||||||
|
|
||||||
|
|
||||||
|
@mock_swf
|
||||||
|
def test_describe_workflow_type_full_boto3():
|
||||||
|
# boto3 required as boto doesn't support all of the arguments
|
||||||
|
client = boto3.client("swf", region_name="us-east-1")
|
||||||
|
client.register_domain(
|
||||||
|
name="test-domain", workflowExecutionRetentionPeriodInDays="2"
|
||||||
|
)
|
||||||
|
client.register_workflow_type(
|
||||||
|
domain="test-domain",
|
||||||
|
name="test-workflow",
|
||||||
|
version="v1.0",
|
||||||
|
description="Test workflow.",
|
||||||
|
defaultTaskStartToCloseTimeout="20",
|
||||||
|
defaultExecutionStartToCloseTimeout="60",
|
||||||
|
defaultTaskList={"name": "foo"},
|
||||||
|
defaultTaskPriority="-2",
|
||||||
|
defaultChildPolicy="ABANDON",
|
||||||
|
defaultLambdaRole="arn:bar",
|
||||||
|
)
|
||||||
|
|
||||||
|
resp = client.describe_workflow_type(
|
||||||
|
domain="test-domain", workflowType={"name": "test-workflow", "version": "v1.0"}
|
||||||
|
)
|
||||||
|
resp["typeInfo"]["workflowType"]["name"].should.equal("test-workflow")
|
||||||
|
resp["typeInfo"]["workflowType"]["version"].should.equal("v1.0")
|
||||||
|
resp["typeInfo"]["status"].should.equal("REGISTERED")
|
||||||
|
resp["typeInfo"]["description"].should.equal("Test workflow.")
|
||||||
|
resp["configuration"]["defaultTaskStartToCloseTimeout"].should.equal("20")
|
||||||
|
resp["configuration"]["defaultExecutionStartToCloseTimeout"].should.equal("60")
|
||||||
|
resp["configuration"]["defaultTaskList"]["name"].should.equal("foo")
|
||||||
|
resp["configuration"]["defaultTaskPriority"].should.equal("-2")
|
||||||
|
resp["configuration"]["defaultChildPolicy"].should.equal("ABANDON")
|
||||||
|
resp["configuration"]["defaultLambdaRole"].should.equal("arn:bar")
|
||||||
|
|
||||||
|
|
||||||
@mock_swf_deprecated
|
@mock_swf_deprecated
|
||||||
def test_describe_non_existent_workflow_type():
|
def test_describe_non_existent_workflow_type():
|
||||||
conn = boto.connect_swf("the_key", "the_secret")
|
conn = boto.connect_swf("the_key", "the_secret")
|
||||||
|
Loading…
Reference in New Issue
Block a user