Run black on moto & test directories.
This commit is contained in:
parent
c820395dbf
commit
96e5b1993d
507 changed files with 52541 additions and 47814 deletions
|
|
@ -2,11 +2,7 @@ from freezegun import freeze_time
|
|||
import sure # noqa
|
||||
|
||||
from moto.swf.exceptions import SWFWorkflowExecutionClosedError
|
||||
from moto.swf.models import (
|
||||
ActivityTask,
|
||||
ActivityType,
|
||||
Timeout,
|
||||
)
|
||||
from moto.swf.models import ActivityTask, ActivityType, Timeout
|
||||
|
||||
from ..utils import (
|
||||
ACTIVITY_TASK_TIMEOUTS,
|
||||
|
|
@ -149,6 +145,7 @@ def test_activity_task_cannot_change_state_on_closed_workflow_execution():
|
|||
wfe.complete(123)
|
||||
|
||||
task.timeout.when.called_with(Timeout(task, 0, "foo")).should.throw(
|
||||
SWFWorkflowExecutionClosedError)
|
||||
SWFWorkflowExecutionClosedError
|
||||
)
|
||||
task.complete.when.called_with().should.throw(SWFWorkflowExecutionClosedError)
|
||||
task.fail.when.called_with().should.throw(SWFWorkflowExecutionClosedError)
|
||||
|
|
|
|||
|
|
@ -76,5 +76,6 @@ def test_decision_task_cannot_change_state_on_closed_workflow_execution():
|
|||
wfe.complete(123)
|
||||
|
||||
task.timeout.when.called_with(Timeout(task, 0, "foo")).should.throw(
|
||||
SWFWorkflowExecutionClosedError)
|
||||
SWFWorkflowExecutionClosedError
|
||||
)
|
||||
task.complete.when.called_with().should.throw(SWFWorkflowExecutionClosedError)
|
||||
|
|
|
|||
|
|
@ -9,15 +9,13 @@ import tests.backport_assert_raises # noqa
|
|||
|
||||
# Fake WorkflowExecution for tests purposes
|
||||
WorkflowExecution = namedtuple(
|
||||
"WorkflowExecution",
|
||||
["workflow_id", "run_id", "execution_status", "open"]
|
||||
"WorkflowExecution", ["workflow_id", "run_id", "execution_status", "open"]
|
||||
)
|
||||
|
||||
|
||||
def test_domain_short_dict_representation():
|
||||
domain = Domain("foo", "52")
|
||||
domain.to_short_dict().should.equal(
|
||||
{"name": "foo", "status": "REGISTERED"})
|
||||
domain.to_short_dict().should.equal({"name": "foo", "status": "REGISTERED"})
|
||||
|
||||
domain.description = "foo bar"
|
||||
domain.to_short_dict()["description"].should.equal("foo bar")
|
||||
|
|
@ -39,9 +37,7 @@ def test_domain_string_representation():
|
|||
def test_domain_add_to_activity_task_list():
|
||||
domain = Domain("my-domain", "60")
|
||||
domain.add_to_activity_task_list("foo", "bar")
|
||||
domain.activity_task_lists.should.equal({
|
||||
"foo": ["bar"]
|
||||
})
|
||||
domain.activity_task_lists.should.equal({"foo": ["bar"]})
|
||||
|
||||
|
||||
def test_domain_activity_tasks():
|
||||
|
|
@ -54,9 +50,7 @@ def test_domain_activity_tasks():
|
|||
def test_domain_add_to_decision_task_list():
|
||||
domain = Domain("my-domain", "60")
|
||||
domain.add_to_decision_task_list("foo", "bar")
|
||||
domain.decision_task_lists.should.equal({
|
||||
"foo": ["bar"]
|
||||
})
|
||||
domain.decision_task_lists.should.equal({"foo": ["bar"]})
|
||||
|
||||
|
||||
def test_domain_decision_tasks():
|
||||
|
|
@ -70,50 +64,44 @@ def test_domain_get_workflow_execution():
|
|||
domain = Domain("my-domain", "60")
|
||||
|
||||
wfe1 = WorkflowExecution(
|
||||
workflow_id="wf-id-1", run_id="run-id-1", execution_status="OPEN", open=True)
|
||||
workflow_id="wf-id-1", run_id="run-id-1", execution_status="OPEN", open=True
|
||||
)
|
||||
wfe2 = WorkflowExecution(
|
||||
workflow_id="wf-id-1", run_id="run-id-2", execution_status="CLOSED", open=False)
|
||||
workflow_id="wf-id-1", run_id="run-id-2", execution_status="CLOSED", open=False
|
||||
)
|
||||
wfe3 = WorkflowExecution(
|
||||
workflow_id="wf-id-2", run_id="run-id-3", execution_status="OPEN", open=True)
|
||||
workflow_id="wf-id-2", run_id="run-id-3", execution_status="OPEN", open=True
|
||||
)
|
||||
wfe4 = WorkflowExecution(
|
||||
workflow_id="wf-id-3", run_id="run-id-4", execution_status="CLOSED", open=False)
|
||||
workflow_id="wf-id-3", run_id="run-id-4", execution_status="CLOSED", open=False
|
||||
)
|
||||
domain.workflow_executions = [wfe1, wfe2, wfe3, wfe4]
|
||||
|
||||
# get workflow execution through workflow_id and run_id
|
||||
domain.get_workflow_execution(
|
||||
"wf-id-1", run_id="run-id-1").should.equal(wfe1)
|
||||
domain.get_workflow_execution(
|
||||
"wf-id-1", run_id="run-id-2").should.equal(wfe2)
|
||||
domain.get_workflow_execution(
|
||||
"wf-id-3", run_id="run-id-4").should.equal(wfe4)
|
||||
domain.get_workflow_execution("wf-id-1", run_id="run-id-1").should.equal(wfe1)
|
||||
domain.get_workflow_execution("wf-id-1", run_id="run-id-2").should.equal(wfe2)
|
||||
domain.get_workflow_execution("wf-id-3", run_id="run-id-4").should.equal(wfe4)
|
||||
|
||||
domain.get_workflow_execution.when.called_with(
|
||||
"wf-id-1", run_id="non-existent"
|
||||
).should.throw(
|
||||
SWFUnknownResourceFault,
|
||||
)
|
||||
).should.throw(SWFUnknownResourceFault)
|
||||
|
||||
# get OPEN workflow execution by default if no run_id
|
||||
domain.get_workflow_execution("wf-id-1").should.equal(wfe1)
|
||||
domain.get_workflow_execution.when.called_with(
|
||||
"wf-id-3"
|
||||
).should.throw(
|
||||
domain.get_workflow_execution.when.called_with("wf-id-3").should.throw(
|
||||
SWFUnknownResourceFault
|
||||
)
|
||||
domain.get_workflow_execution.when.called_with(
|
||||
"wf-id-non-existent"
|
||||
).should.throw(
|
||||
domain.get_workflow_execution.when.called_with("wf-id-non-existent").should.throw(
|
||||
SWFUnknownResourceFault
|
||||
)
|
||||
|
||||
# raise_if_closed attribute
|
||||
domain.get_workflow_execution(
|
||||
"wf-id-1", run_id="run-id-1", raise_if_closed=True).should.equal(wfe1)
|
||||
"wf-id-1", run_id="run-id-1", raise_if_closed=True
|
||||
).should.equal(wfe1)
|
||||
domain.get_workflow_execution.when.called_with(
|
||||
"wf-id-3", run_id="run-id-4", raise_if_closed=True
|
||||
).should.throw(
|
||||
SWFUnknownResourceFault
|
||||
)
|
||||
).should.throw(SWFUnknownResourceFault)
|
||||
|
||||
# raise_if_none attribute
|
||||
domain.get_workflow_execution("foo", raise_if_none=False).should.be.none
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import sure # noqa
|
|||
|
||||
# Tests for GenericType (ActivityType, WorkflowType)
|
||||
class FooType(GenericType):
|
||||
|
||||
@property
|
||||
def kind(self):
|
||||
return "foo"
|
||||
|
|
@ -40,12 +39,12 @@ def test_type_full_dict_representation():
|
|||
_type.to_full_dict()["configuration"].should.equal({})
|
||||
|
||||
_type.task_list = "foo"
|
||||
_type.to_full_dict()["configuration"][
|
||||
"defaultTaskList"].should.equal({"name": "foo"})
|
||||
_type.to_full_dict()["configuration"]["defaultTaskList"].should.equal(
|
||||
{"name": "foo"}
|
||||
)
|
||||
|
||||
_type.just_an_example_timeout = "60"
|
||||
_type.to_full_dict()["configuration"][
|
||||
"justAnExampleTimeout"].should.equal("60")
|
||||
_type.to_full_dict()["configuration"]["justAnExampleTimeout"].should.equal("60")
|
||||
|
||||
_type.non_whitelisted_property = "34"
|
||||
keys = _type.to_full_dict()["configuration"].keys()
|
||||
|
|
@ -55,4 +54,5 @@ def test_type_full_dict_representation():
|
|||
def test_type_string_representation():
|
||||
_type = FooType("test-foo", "v1.0")
|
||||
str(_type).should.equal(
|
||||
"FooType(name: test-foo, version: v1.0, status: REGISTERED)")
|
||||
"FooType(name: test-foo, version: v1.0, status: REGISTERED)"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -15,17 +15,17 @@ def test_history_event_creation():
|
|||
@freeze_time("2015-01-01 12:00:00")
|
||||
def test_history_event_to_dict_representation():
|
||||
he = HistoryEvent(123, "DecisionTaskStarted", scheduled_event_id=2)
|
||||
he.to_dict().should.equal({
|
||||
"eventId": 123,
|
||||
"eventType": "DecisionTaskStarted",
|
||||
"eventTimestamp": 1420113600.0,
|
||||
"decisionTaskStartedEventAttributes": {
|
||||
"scheduledEventId": 2
|
||||
he.to_dict().should.equal(
|
||||
{
|
||||
"eventId": 123,
|
||||
"eventType": "DecisionTaskStarted",
|
||||
"eventTimestamp": 1420113600.0,
|
||||
"decisionTaskStartedEventAttributes": {"scheduledEventId": 2},
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
|
||||
def test_history_event_breaks_on_initialization_if_not_implemented():
|
||||
HistoryEvent.when.called_with(
|
||||
123, "UnknownHistoryEvent"
|
||||
).should.throw(NotImplementedError)
|
||||
HistoryEvent.when.called_with(123, "UnknownHistoryEvent").should.throw(
|
||||
NotImplementedError
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,12 +1,7 @@
|
|||
from freezegun import freeze_time
|
||||
import sure # noqa
|
||||
|
||||
from moto.swf.models import (
|
||||
ActivityType,
|
||||
Timeout,
|
||||
WorkflowType,
|
||||
WorkflowExecution,
|
||||
)
|
||||
from moto.swf.models import ActivityType, Timeout, WorkflowType, WorkflowExecution
|
||||
from moto.swf.exceptions import SWFDefaultUndefinedFault
|
||||
from ..utils import (
|
||||
auto_start_decision_tasks,
|
||||
|
|
@ -43,28 +38,31 @@ def test_workflow_execution_creation_child_policy_logic():
|
|||
WorkflowExecution(
|
||||
domain,
|
||||
WorkflowType(
|
||||
"test-workflow", "v1.0",
|
||||
task_list="queue", default_child_policy="ABANDON",
|
||||
"test-workflow",
|
||||
"v1.0",
|
||||
task_list="queue",
|
||||
default_child_policy="ABANDON",
|
||||
default_execution_start_to_close_timeout="300",
|
||||
default_task_start_to_close_timeout="300",
|
||||
),
|
||||
"ab1234"
|
||||
"ab1234",
|
||||
).child_policy.should.equal("ABANDON")
|
||||
|
||||
WorkflowExecution(
|
||||
domain,
|
||||
WorkflowType(
|
||||
"test-workflow", "v1.0", task_list="queue",
|
||||
"test-workflow",
|
||||
"v1.0",
|
||||
task_list="queue",
|
||||
default_execution_start_to_close_timeout="300",
|
||||
default_task_start_to_close_timeout="300",
|
||||
),
|
||||
"ab1234",
|
||||
child_policy="REQUEST_CANCEL"
|
||||
child_policy="REQUEST_CANCEL",
|
||||
).child_policy.should.equal("REQUEST_CANCEL")
|
||||
|
||||
WorkflowExecution.when.called_with(
|
||||
domain,
|
||||
WorkflowType("test-workflow", "v1.0"), "ab1234"
|
||||
domain, WorkflowType("test-workflow", "v1.0"), "ab1234"
|
||||
).should.throw(SWFDefaultUndefinedFault)
|
||||
|
||||
|
||||
|
|
@ -84,8 +82,10 @@ def test_workflow_execution_generates_a_random_run_id():
|
|||
def test_workflow_execution_short_dict_representation():
|
||||
domain = get_basic_domain()
|
||||
wf_type = WorkflowType(
|
||||
"test-workflow", "v1.0",
|
||||
task_list="queue", default_child_policy="ABANDON",
|
||||
"test-workflow",
|
||||
"v1.0",
|
||||
task_list="queue",
|
||||
default_child_policy="ABANDON",
|
||||
default_execution_start_to_close_timeout="300",
|
||||
default_task_start_to_close_timeout="300",
|
||||
)
|
||||
|
|
@ -99,8 +99,10 @@ def test_workflow_execution_short_dict_representation():
|
|||
def test_workflow_execution_medium_dict_representation():
|
||||
domain = get_basic_domain()
|
||||
wf_type = WorkflowType(
|
||||
"test-workflow", "v1.0",
|
||||
task_list="queue", default_child_policy="ABANDON",
|
||||
"test-workflow",
|
||||
"v1.0",
|
||||
task_list="queue",
|
||||
default_child_policy="ABANDON",
|
||||
default_execution_start_to_close_timeout="300",
|
||||
default_task_start_to_close_timeout="300",
|
||||
)
|
||||
|
|
@ -109,7 +111,7 @@ def test_workflow_execution_medium_dict_representation():
|
|||
md = wfe.to_medium_dict()
|
||||
md["execution"].should.equal(wfe.to_short_dict())
|
||||
md["workflowType"].should.equal(wf_type.to_short_dict())
|
||||
md["startTimestamp"].should.be.a('float')
|
||||
md["startTimestamp"].should.be.a("float")
|
||||
md["executionStatus"].should.equal("OPEN")
|
||||
md["cancelRequested"].should.be.falsy
|
||||
md.should_not.contain("tagList")
|
||||
|
|
@ -122,8 +124,10 @@ def test_workflow_execution_medium_dict_representation():
|
|||
def test_workflow_execution_full_dict_representation():
|
||||
domain = get_basic_domain()
|
||||
wf_type = WorkflowType(
|
||||
"test-workflow", "v1.0",
|
||||
task_list="queue", default_child_policy="ABANDON",
|
||||
"test-workflow",
|
||||
"v1.0",
|
||||
task_list="queue",
|
||||
default_child_policy="ABANDON",
|
||||
default_execution_start_to_close_timeout="300",
|
||||
default_task_start_to_close_timeout="300",
|
||||
)
|
||||
|
|
@ -134,32 +138,36 @@ def test_workflow_execution_full_dict_representation():
|
|||
fd["openCounts"]["openTimers"].should.equal(0)
|
||||
fd["openCounts"]["openDecisionTasks"].should.equal(0)
|
||||
fd["openCounts"]["openActivityTasks"].should.equal(0)
|
||||
fd["executionConfiguration"].should.equal({
|
||||
"childPolicy": "ABANDON",
|
||||
"executionStartToCloseTimeout": "300",
|
||||
"taskList": {"name": "queue"},
|
||||
"taskStartToCloseTimeout": "300",
|
||||
})
|
||||
fd["executionConfiguration"].should.equal(
|
||||
{
|
||||
"childPolicy": "ABANDON",
|
||||
"executionStartToCloseTimeout": "300",
|
||||
"taskList": {"name": "queue"},
|
||||
"taskStartToCloseTimeout": "300",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_workflow_execution_list_dict_representation():
|
||||
domain = get_basic_domain()
|
||||
wf_type = WorkflowType(
|
||||
'test-workflow', 'v1.0',
|
||||
task_list='queue', default_child_policy='ABANDON',
|
||||
default_execution_start_to_close_timeout='300',
|
||||
default_task_start_to_close_timeout='300',
|
||||
"test-workflow",
|
||||
"v1.0",
|
||||
task_list="queue",
|
||||
default_child_policy="ABANDON",
|
||||
default_execution_start_to_close_timeout="300",
|
||||
default_task_start_to_close_timeout="300",
|
||||
)
|
||||
wfe = WorkflowExecution(domain, wf_type, 'ab1234')
|
||||
wfe = WorkflowExecution(domain, wf_type, "ab1234")
|
||||
|
||||
ld = wfe.to_list_dict()
|
||||
ld['workflowType']['version'].should.equal('v1.0')
|
||||
ld['workflowType']['name'].should.equal('test-workflow')
|
||||
ld['executionStatus'].should.equal('OPEN')
|
||||
ld['execution']['workflowId'].should.equal('ab1234')
|
||||
ld['execution'].should.contain('runId')
|
||||
ld['cancelRequested'].should.be.false
|
||||
ld.should.contain('startTimestamp')
|
||||
ld["workflowType"]["version"].should.equal("v1.0")
|
||||
ld["workflowType"]["name"].should.equal("test-workflow")
|
||||
ld["executionStatus"].should.equal("OPEN")
|
||||
ld["execution"]["workflowId"].should.equal("ab1234")
|
||||
ld["execution"].should.contain("runId")
|
||||
ld["cancelRequested"].should.be.false
|
||||
ld.should.contain("startTimestamp")
|
||||
|
||||
|
||||
def test_workflow_execution_schedule_decision_task():
|
||||
|
|
@ -240,10 +248,8 @@ def test_workflow_execution_schedule_activity_task():
|
|||
wfe.open_counts["openActivityTasks"].should.equal(1)
|
||||
last_event = wfe.events()[-1]
|
||||
last_event.event_type.should.equal("ActivityTaskScheduled")
|
||||
last_event.event_attributes[
|
||||
"decisionTaskCompletedEventId"].should.equal(123)
|
||||
last_event.event_attributes["taskList"][
|
||||
"name"].should.equal("task-list-name")
|
||||
last_event.event_attributes["decisionTaskCompletedEventId"].should.equal(123)
|
||||
last_event.event_attributes["taskList"]["name"].should.equal("task-list-name")
|
||||
|
||||
wfe.activity_tasks.should.have.length_of(1)
|
||||
task = wfe.activity_tasks[0]
|
||||
|
|
@ -254,17 +260,18 @@ def test_workflow_execution_schedule_activity_task():
|
|||
|
||||
def test_workflow_execution_schedule_activity_task_without_task_list_should_take_default():
|
||||
wfe = make_workflow_execution()
|
||||
wfe.domain.add_type(
|
||||
ActivityType("test-activity", "v1.2", task_list="foobar")
|
||||
wfe.domain.add_type(ActivityType("test-activity", "v1.2", task_list="foobar"))
|
||||
wfe.schedule_activity_task(
|
||||
123,
|
||||
{
|
||||
"activityId": "my-activity-001",
|
||||
"activityType": {"name": "test-activity", "version": "v1.2"},
|
||||
"scheduleToStartTimeout": "600",
|
||||
"scheduleToCloseTimeout": "600",
|
||||
"startToCloseTimeout": "600",
|
||||
"heartbeatTimeout": "300",
|
||||
},
|
||||
)
|
||||
wfe.schedule_activity_task(123, {
|
||||
"activityId": "my-activity-001",
|
||||
"activityType": {"name": "test-activity", "version": "v1.2"},
|
||||
"scheduleToStartTimeout": "600",
|
||||
"scheduleToCloseTimeout": "600",
|
||||
"startToCloseTimeout": "600",
|
||||
"heartbeatTimeout": "300",
|
||||
})
|
||||
|
||||
wfe.open_counts["openActivityTasks"].should.equal(1)
|
||||
last_event = wfe.events()[-1]
|
||||
|
|
@ -290,50 +297,51 @@ def test_workflow_execution_schedule_activity_task_should_fail_if_wrong_attribut
|
|||
wfe.schedule_activity_task(123, hsh)
|
||||
last_event = wfe.events()[-1]
|
||||
last_event.event_type.should.equal("ScheduleActivityTaskFailed")
|
||||
last_event.event_attributes["cause"].should.equal(
|
||||
"ACTIVITY_TYPE_DOES_NOT_EXIST")
|
||||
last_event.event_attributes["cause"].should.equal("ACTIVITY_TYPE_DOES_NOT_EXIST")
|
||||
|
||||
hsh["activityType"]["name"] = "test-activity"
|
||||
wfe.schedule_activity_task(123, hsh)
|
||||
last_event = wfe.events()[-1]
|
||||
last_event.event_type.should.equal("ScheduleActivityTaskFailed")
|
||||
last_event.event_attributes["cause"].should.equal(
|
||||
"ACTIVITY_TYPE_DEPRECATED")
|
||||
last_event.event_attributes["cause"].should.equal("ACTIVITY_TYPE_DEPRECATED")
|
||||
|
||||
hsh["activityType"]["version"] = "v1.2"
|
||||
wfe.schedule_activity_task(123, hsh)
|
||||
last_event = wfe.events()[-1]
|
||||
last_event.event_type.should.equal("ScheduleActivityTaskFailed")
|
||||
last_event.event_attributes["cause"].should.equal(
|
||||
"DEFAULT_TASK_LIST_UNDEFINED")
|
||||
last_event.event_attributes["cause"].should.equal("DEFAULT_TASK_LIST_UNDEFINED")
|
||||
|
||||
hsh["taskList"] = {"name": "foobar"}
|
||||
wfe.schedule_activity_task(123, hsh)
|
||||
last_event = wfe.events()[-1]
|
||||
last_event.event_type.should.equal("ScheduleActivityTaskFailed")
|
||||
last_event.event_attributes["cause"].should.equal(
|
||||
"DEFAULT_SCHEDULE_TO_START_TIMEOUT_UNDEFINED")
|
||||
"DEFAULT_SCHEDULE_TO_START_TIMEOUT_UNDEFINED"
|
||||
)
|
||||
|
||||
hsh["scheduleToStartTimeout"] = "600"
|
||||
wfe.schedule_activity_task(123, hsh)
|
||||
last_event = wfe.events()[-1]
|
||||
last_event.event_type.should.equal("ScheduleActivityTaskFailed")
|
||||
last_event.event_attributes["cause"].should.equal(
|
||||
"DEFAULT_SCHEDULE_TO_CLOSE_TIMEOUT_UNDEFINED")
|
||||
"DEFAULT_SCHEDULE_TO_CLOSE_TIMEOUT_UNDEFINED"
|
||||
)
|
||||
|
||||
hsh["scheduleToCloseTimeout"] = "600"
|
||||
wfe.schedule_activity_task(123, hsh)
|
||||
last_event = wfe.events()[-1]
|
||||
last_event.event_type.should.equal("ScheduleActivityTaskFailed")
|
||||
last_event.event_attributes["cause"].should.equal(
|
||||
"DEFAULT_START_TO_CLOSE_TIMEOUT_UNDEFINED")
|
||||
"DEFAULT_START_TO_CLOSE_TIMEOUT_UNDEFINED"
|
||||
)
|
||||
|
||||
hsh["startToCloseTimeout"] = "600"
|
||||
wfe.schedule_activity_task(123, hsh)
|
||||
last_event = wfe.events()[-1]
|
||||
last_event.event_type.should.equal("ScheduleActivityTaskFailed")
|
||||
last_event.event_attributes["cause"].should.equal(
|
||||
"DEFAULT_HEARTBEAT_TIMEOUT_UNDEFINED")
|
||||
"DEFAULT_HEARTBEAT_TIMEOUT_UNDEFINED"
|
||||
)
|
||||
|
||||
wfe.open_counts["openActivityTasks"].should.equal(0)
|
||||
wfe.activity_tasks.should.have.length_of(0)
|
||||
|
|
@ -365,9 +373,9 @@ def test_workflow_execution_schedule_activity_task_failure_triggers_new_decision
|
|||
"activityId": "my-activity-001",
|
||||
"activityType": {
|
||||
"name": "test-activity-does-not-exist",
|
||||
"version": "v1.2"
|
||||
"version": "v1.2",
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
"decisionType": "ScheduleActivityTask",
|
||||
|
|
@ -375,11 +383,12 @@ def test_workflow_execution_schedule_activity_task_failure_triggers_new_decision
|
|||
"activityId": "my-activity-001",
|
||||
"activityType": {
|
||||
"name": "test-activity-does-not-exist",
|
||||
"version": "v1.2"
|
||||
"version": "v1.2",
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
])
|
||||
],
|
||||
)
|
||||
|
||||
wfe.latest_execution_context.should.equal("free-form execution context")
|
||||
wfe.open_counts["openActivityTasks"].should.equal(0)
|
||||
|
|
@ -402,8 +411,7 @@ def test_workflow_execution_schedule_activity_task_with_same_activity_id():
|
|||
wfe.open_counts["openActivityTasks"].should.equal(1)
|
||||
last_event = wfe.events()[-1]
|
||||
last_event.event_type.should.equal("ScheduleActivityTaskFailed")
|
||||
last_event.event_attributes["cause"].should.equal(
|
||||
"ACTIVITY_ID_ALREADY_IN_USE")
|
||||
last_event.event_attributes["cause"].should.equal("ACTIVITY_ID_ALREADY_IN_USE")
|
||||
|
||||
|
||||
def test_workflow_execution_start_activity_task():
|
||||
|
|
@ -481,8 +489,7 @@ def test_timeouts_are_processed_in_order_and_reevaluated():
|
|||
# - but the last scheduled decision task should *not* timeout (workflow closed)
|
||||
with freeze_time("2015-01-01 12:00:00"):
|
||||
wfe = make_workflow_execution(
|
||||
execution_start_to_close_timeout=8 * 60,
|
||||
task_start_to_close_timeout=5 * 60,
|
||||
execution_start_to_close_timeout=8 * 60, task_start_to_close_timeout=5 * 60
|
||||
)
|
||||
# decision will automatically start
|
||||
wfe = auto_start_decision_tasks(wfe)
|
||||
|
|
@ -493,9 +500,11 @@ def test_timeouts_are_processed_in_order_and_reevaluated():
|
|||
wfe._process_timeouts()
|
||||
|
||||
event_types = [e.event_type for e in wfe.events()[event_idx:]]
|
||||
event_types.should.equal([
|
||||
"DecisionTaskTimedOut",
|
||||
"DecisionTaskScheduled",
|
||||
"DecisionTaskStarted",
|
||||
"WorkflowExecutionTimedOut",
|
||||
])
|
||||
event_types.should.equal(
|
||||
[
|
||||
"DecisionTaskTimedOut",
|
||||
"DecisionTaskScheduled",
|
||||
"DecisionTaskStarted",
|
||||
"WorkflowExecutionTimedOut",
|
||||
]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -12,18 +12,19 @@ from ..utils import setup_workflow, SCHEDULE_ACTIVITY_TASK_DECISION
|
|||
@mock_swf_deprecated
|
||||
def test_poll_for_activity_task_when_one():
|
||||
conn = setup_workflow()
|
||||
decision_token = conn.poll_for_decision_task(
|
||||
"test-domain", "queue")["taskToken"]
|
||||
conn.respond_decision_task_completed(decision_token, decisions=[
|
||||
SCHEDULE_ACTIVITY_TASK_DECISION
|
||||
])
|
||||
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
|
||||
conn.respond_decision_task_completed(
|
||||
decision_token, decisions=[SCHEDULE_ACTIVITY_TASK_DECISION]
|
||||
)
|
||||
resp = conn.poll_for_activity_task(
|
||||
"test-domain", "activity-task-list", identity="surprise")
|
||||
"test-domain", "activity-task-list", identity="surprise"
|
||||
)
|
||||
resp["activityId"].should.equal("my-activity-001")
|
||||
resp["taskToken"].should_not.be.none
|
||||
|
||||
resp = conn.get_workflow_execution_history(
|
||||
"test-domain", conn.run_id, "uid-abcd1234")
|
||||
"test-domain", conn.run_id, "uid-abcd1234"
|
||||
)
|
||||
resp["events"][-1]["eventType"].should.equal("ActivityTaskStarted")
|
||||
resp["events"][-1]["activityTaskStartedEventAttributes"].should.equal(
|
||||
{"identity": "surprise", "scheduledEventId": 5}
|
||||
|
|
@ -48,14 +49,12 @@ def test_poll_for_activity_task_on_non_existent_queue():
|
|||
@mock_swf_deprecated
|
||||
def test_count_pending_activity_tasks():
|
||||
conn = setup_workflow()
|
||||
decision_token = conn.poll_for_decision_task(
|
||||
"test-domain", "queue")["taskToken"]
|
||||
conn.respond_decision_task_completed(decision_token, decisions=[
|
||||
SCHEDULE_ACTIVITY_TASK_DECISION
|
||||
])
|
||||
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
|
||||
conn.respond_decision_task_completed(
|
||||
decision_token, decisions=[SCHEDULE_ACTIVITY_TASK_DECISION]
|
||||
)
|
||||
|
||||
resp = conn.count_pending_activity_tasks(
|
||||
"test-domain", "activity-task-list")
|
||||
resp = conn.count_pending_activity_tasks("test-domain", "activity-task-list")
|
||||
resp.should.equal({"count": 1, "truncated": False})
|
||||
|
||||
|
||||
|
|
@ -70,20 +69,22 @@ def test_count_pending_decision_tasks_on_non_existent_task_list():
|
|||
@mock_swf_deprecated
|
||||
def test_respond_activity_task_completed():
|
||||
conn = setup_workflow()
|
||||
decision_token = conn.poll_for_decision_task(
|
||||
"test-domain", "queue")["taskToken"]
|
||||
conn.respond_decision_task_completed(decision_token, decisions=[
|
||||
SCHEDULE_ACTIVITY_TASK_DECISION
|
||||
])
|
||||
activity_token = conn.poll_for_activity_task(
|
||||
"test-domain", "activity-task-list")["taskToken"]
|
||||
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
|
||||
conn.respond_decision_task_completed(
|
||||
decision_token, decisions=[SCHEDULE_ACTIVITY_TASK_DECISION]
|
||||
)
|
||||
activity_token = conn.poll_for_activity_task("test-domain", "activity-task-list")[
|
||||
"taskToken"
|
||||
]
|
||||
|
||||
resp = conn.respond_activity_task_completed(
|
||||
activity_token, result="result of the task")
|
||||
activity_token, result="result of the task"
|
||||
)
|
||||
resp.should.be.none
|
||||
|
||||
resp = conn.get_workflow_execution_history(
|
||||
"test-domain", conn.run_id, "uid-abcd1234")
|
||||
"test-domain", conn.run_id, "uid-abcd1234"
|
||||
)
|
||||
resp["events"][-2]["eventType"].should.equal("ActivityTaskCompleted")
|
||||
resp["events"][-2]["activityTaskCompletedEventAttributes"].should.equal(
|
||||
{"result": "result of the task", "scheduledEventId": 5, "startedEventId": 6}
|
||||
|
|
@ -93,13 +94,13 @@ def test_respond_activity_task_completed():
|
|||
@mock_swf_deprecated
|
||||
def test_respond_activity_task_completed_on_closed_workflow_execution():
|
||||
conn = setup_workflow()
|
||||
decision_token = conn.poll_for_decision_task(
|
||||
"test-domain", "queue")["taskToken"]
|
||||
conn.respond_decision_task_completed(decision_token, decisions=[
|
||||
SCHEDULE_ACTIVITY_TASK_DECISION
|
||||
])
|
||||
activity_token = conn.poll_for_activity_task(
|
||||
"test-domain", "activity-task-list")["taskToken"]
|
||||
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
|
||||
conn.respond_decision_task_completed(
|
||||
decision_token, decisions=[SCHEDULE_ACTIVITY_TASK_DECISION]
|
||||
)
|
||||
activity_token = conn.poll_for_activity_task("test-domain", "activity-task-list")[
|
||||
"taskToken"
|
||||
]
|
||||
|
||||
# bad: we're closing workflow execution manually, but endpoints are not
|
||||
# coded for now..
|
||||
|
|
@ -107,52 +108,57 @@ def test_respond_activity_task_completed_on_closed_workflow_execution():
|
|||
wfe.execution_status = "CLOSED"
|
||||
# /bad
|
||||
|
||||
conn.respond_activity_task_completed.when.called_with(
|
||||
activity_token
|
||||
).should.throw(SWFResponseError, "WorkflowExecution=")
|
||||
conn.respond_activity_task_completed.when.called_with(activity_token).should.throw(
|
||||
SWFResponseError, "WorkflowExecution="
|
||||
)
|
||||
|
||||
|
||||
@mock_swf_deprecated
|
||||
def test_respond_activity_task_completed_with_task_already_completed():
|
||||
conn = setup_workflow()
|
||||
decision_token = conn.poll_for_decision_task(
|
||||
"test-domain", "queue")["taskToken"]
|
||||
conn.respond_decision_task_completed(decision_token, decisions=[
|
||||
SCHEDULE_ACTIVITY_TASK_DECISION
|
||||
])
|
||||
activity_token = conn.poll_for_activity_task(
|
||||
"test-domain", "activity-task-list")["taskToken"]
|
||||
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
|
||||
conn.respond_decision_task_completed(
|
||||
decision_token, decisions=[SCHEDULE_ACTIVITY_TASK_DECISION]
|
||||
)
|
||||
activity_token = conn.poll_for_activity_task("test-domain", "activity-task-list")[
|
||||
"taskToken"
|
||||
]
|
||||
|
||||
conn.respond_activity_task_completed(activity_token)
|
||||
|
||||
conn.respond_activity_task_completed.when.called_with(
|
||||
activity_token
|
||||
).should.throw(SWFResponseError, "Unknown activity, scheduledEventId = 5")
|
||||
conn.respond_activity_task_completed.when.called_with(activity_token).should.throw(
|
||||
SWFResponseError, "Unknown activity, scheduledEventId = 5"
|
||||
)
|
||||
|
||||
|
||||
# RespondActivityTaskFailed endpoint
|
||||
@mock_swf_deprecated
|
||||
def test_respond_activity_task_failed():
|
||||
conn = setup_workflow()
|
||||
decision_token = conn.poll_for_decision_task(
|
||||
"test-domain", "queue")["taskToken"]
|
||||
conn.respond_decision_task_completed(decision_token, decisions=[
|
||||
SCHEDULE_ACTIVITY_TASK_DECISION
|
||||
])
|
||||
activity_token = conn.poll_for_activity_task(
|
||||
"test-domain", "activity-task-list")["taskToken"]
|
||||
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
|
||||
conn.respond_decision_task_completed(
|
||||
decision_token, decisions=[SCHEDULE_ACTIVITY_TASK_DECISION]
|
||||
)
|
||||
activity_token = conn.poll_for_activity_task("test-domain", "activity-task-list")[
|
||||
"taskToken"
|
||||
]
|
||||
|
||||
resp = conn.respond_activity_task_failed(activity_token,
|
||||
reason="short reason",
|
||||
details="long details")
|
||||
resp = conn.respond_activity_task_failed(
|
||||
activity_token, reason="short reason", details="long details"
|
||||
)
|
||||
resp.should.be.none
|
||||
|
||||
resp = conn.get_workflow_execution_history(
|
||||
"test-domain", conn.run_id, "uid-abcd1234")
|
||||
"test-domain", conn.run_id, "uid-abcd1234"
|
||||
)
|
||||
resp["events"][-2]["eventType"].should.equal("ActivityTaskFailed")
|
||||
resp["events"][-2]["activityTaskFailedEventAttributes"].should.equal(
|
||||
{"reason": "short reason", "details": "long details",
|
||||
"scheduledEventId": 5, "startedEventId": 6}
|
||||
{
|
||||
"reason": "short reason",
|
||||
"details": "long details",
|
||||
"scheduledEventId": 5,
|
||||
"startedEventId": 6,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -162,11 +168,10 @@ def test_respond_activity_task_completed_with_wrong_token():
|
|||
# because the safeguards are shared with RespondActivityTaskCompleted, so
|
||||
# no need to retest everything end-to-end.
|
||||
conn = setup_workflow()
|
||||
decision_token = conn.poll_for_decision_task(
|
||||
"test-domain", "queue")["taskToken"]
|
||||
conn.respond_decision_task_completed(decision_token, decisions=[
|
||||
SCHEDULE_ACTIVITY_TASK_DECISION
|
||||
])
|
||||
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
|
||||
conn.respond_decision_task_completed(
|
||||
decision_token, decisions=[SCHEDULE_ACTIVITY_TASK_DECISION]
|
||||
)
|
||||
conn.poll_for_activity_task("test-domain", "activity-task-list")
|
||||
conn.respond_activity_task_failed.when.called_with(
|
||||
"not-a-correct-token"
|
||||
|
|
@ -177,13 +182,13 @@ def test_respond_activity_task_completed_with_wrong_token():
|
|||
@mock_swf_deprecated
|
||||
def test_record_activity_task_heartbeat():
|
||||
conn = setup_workflow()
|
||||
decision_token = conn.poll_for_decision_task(
|
||||
"test-domain", "queue")["taskToken"]
|
||||
conn.respond_decision_task_completed(decision_token, decisions=[
|
||||
SCHEDULE_ACTIVITY_TASK_DECISION
|
||||
])
|
||||
activity_token = conn.poll_for_activity_task(
|
||||
"test-domain", "activity-task-list")["taskToken"]
|
||||
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
|
||||
conn.respond_decision_task_completed(
|
||||
decision_token, decisions=[SCHEDULE_ACTIVITY_TASK_DECISION]
|
||||
)
|
||||
activity_token = conn.poll_for_activity_task("test-domain", "activity-task-list")[
|
||||
"taskToken"
|
||||
]
|
||||
|
||||
resp = conn.record_activity_task_heartbeat(activity_token)
|
||||
resp.should.equal({"cancelRequested": False})
|
||||
|
|
@ -192,13 +197,11 @@ def test_record_activity_task_heartbeat():
|
|||
@mock_swf_deprecated
|
||||
def test_record_activity_task_heartbeat_with_wrong_token():
|
||||
conn = setup_workflow()
|
||||
decision_token = conn.poll_for_decision_task(
|
||||
"test-domain", "queue")["taskToken"]
|
||||
conn.respond_decision_task_completed(decision_token, decisions=[
|
||||
SCHEDULE_ACTIVITY_TASK_DECISION
|
||||
])
|
||||
conn.poll_for_activity_task(
|
||||
"test-domain", "activity-task-list")["taskToken"]
|
||||
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
|
||||
conn.respond_decision_task_completed(
|
||||
decision_token, decisions=[SCHEDULE_ACTIVITY_TASK_DECISION]
|
||||
)
|
||||
conn.poll_for_activity_task("test-domain", "activity-task-list")["taskToken"]
|
||||
|
||||
conn.record_activity_task_heartbeat.when.called_with(
|
||||
"bad-token", details="some progress details"
|
||||
|
|
@ -208,21 +211,23 @@ def test_record_activity_task_heartbeat_with_wrong_token():
|
|||
@mock_swf_deprecated
|
||||
def test_record_activity_task_heartbeat_sets_details_in_case_of_timeout():
|
||||
conn = setup_workflow()
|
||||
decision_token = conn.poll_for_decision_task(
|
||||
"test-domain", "queue")["taskToken"]
|
||||
conn.respond_decision_task_completed(decision_token, decisions=[
|
||||
SCHEDULE_ACTIVITY_TASK_DECISION
|
||||
])
|
||||
decision_token = conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
|
||||
conn.respond_decision_task_completed(
|
||||
decision_token, decisions=[SCHEDULE_ACTIVITY_TASK_DECISION]
|
||||
)
|
||||
with freeze_time("2015-01-01 12:00:00"):
|
||||
activity_token = conn.poll_for_activity_task(
|
||||
"test-domain", "activity-task-list")["taskToken"]
|
||||
"test-domain", "activity-task-list"
|
||||
)["taskToken"]
|
||||
conn.record_activity_task_heartbeat(
|
||||
activity_token, details="some progress details")
|
||||
activity_token, details="some progress details"
|
||||
)
|
||||
|
||||
with freeze_time("2015-01-01 12:05:30"):
|
||||
# => Activity Task Heartbeat timeout reached!!
|
||||
resp = conn.get_workflow_execution_history(
|
||||
"test-domain", conn.run_id, "uid-abcd1234")
|
||||
"test-domain", conn.run_id, "uid-abcd1234"
|
||||
)
|
||||
resp["events"][-2]["eventType"].should.equal("ActivityTaskTimedOut")
|
||||
attrs = resp["events"][-2]["activityTaskTimedOutEventAttributes"]
|
||||
attrs["details"].should.equal("some progress details")
|
||||
|
|
|
|||
|
|
@ -49,10 +49,11 @@ def test_list_activity_types():
|
|||
conn.register_activity_type("test-domain", "c-test-activity", "v1.0")
|
||||
|
||||
all_activity_types = conn.list_activity_types("test-domain", "REGISTERED")
|
||||
names = [activity_type["activityType"]["name"]
|
||||
for activity_type in all_activity_types["typeInfos"]]
|
||||
names.should.equal(
|
||||
["a-test-activity", "b-test-activity", "c-test-activity"])
|
||||
names = [
|
||||
activity_type["activityType"]["name"]
|
||||
for activity_type in all_activity_types["typeInfos"]
|
||||
]
|
||||
names.should.equal(["a-test-activity", "b-test-activity", "c-test-activity"])
|
||||
|
||||
|
||||
@mock_swf_deprecated
|
||||
|
|
@ -63,12 +64,14 @@ def test_list_activity_types_reverse_order():
|
|||
conn.register_activity_type("test-domain", "a-test-activity", "v1.0")
|
||||
conn.register_activity_type("test-domain", "c-test-activity", "v1.0")
|
||||
|
||||
all_activity_types = conn.list_activity_types("test-domain", "REGISTERED",
|
||||
reverse_order=True)
|
||||
names = [activity_type["activityType"]["name"]
|
||||
for activity_type in all_activity_types["typeInfos"]]
|
||||
names.should.equal(
|
||||
["c-test-activity", "b-test-activity", "a-test-activity"])
|
||||
all_activity_types = conn.list_activity_types(
|
||||
"test-domain", "REGISTERED", reverse_order=True
|
||||
)
|
||||
names = [
|
||||
activity_type["activityType"]["name"]
|
||||
for activity_type in all_activity_types["typeInfos"]
|
||||
]
|
||||
names.should.equal(["c-test-activity", "b-test-activity", "a-test-activity"])
|
||||
|
||||
|
||||
# DeprecateActivityType endpoint
|
||||
|
|
@ -112,11 +115,15 @@ def test_deprecate_non_existent_activity_type():
|
|||
def test_describe_activity_type():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60")
|
||||
conn.register_activity_type("test-domain", "test-activity", "v1.0",
|
||||
task_list="foo", default_task_heartbeat_timeout="32")
|
||||
conn.register_activity_type(
|
||||
"test-domain",
|
||||
"test-activity",
|
||||
"v1.0",
|
||||
task_list="foo",
|
||||
default_task_heartbeat_timeout="32",
|
||||
)
|
||||
|
||||
actype = conn.describe_activity_type(
|
||||
"test-domain", "test-activity", "v1.0")
|
||||
actype = conn.describe_activity_type("test-domain", "test-activity", "v1.0")
|
||||
actype["configuration"]["defaultTaskList"]["name"].should.equal("foo")
|
||||
infos = actype["typeInfo"]
|
||||
infos["activityType"]["name"].should.equal("test-activity")
|
||||
|
|
|
|||
|
|
@ -14,18 +14,20 @@ def test_poll_for_decision_task_when_one():
|
|||
conn = setup_workflow()
|
||||
|
||||
resp = conn.get_workflow_execution_history(
|
||||
"test-domain", conn.run_id, "uid-abcd1234")
|
||||
"test-domain", conn.run_id, "uid-abcd1234"
|
||||
)
|
||||
types = [evt["eventType"] for evt in resp["events"]]
|
||||
types.should.equal(["WorkflowExecutionStarted", "DecisionTaskScheduled"])
|
||||
|
||||
resp = conn.poll_for_decision_task(
|
||||
"test-domain", "queue", identity="srv01")
|
||||
resp = conn.poll_for_decision_task("test-domain", "queue", identity="srv01")
|
||||
types = [evt["eventType"] for evt in resp["events"]]
|
||||
types.should.equal(["WorkflowExecutionStarted",
|
||||
"DecisionTaskScheduled", "DecisionTaskStarted"])
|
||||
types.should.equal(
|
||||
["WorkflowExecutionStarted", "DecisionTaskScheduled", "DecisionTaskStarted"]
|
||||
)
|
||||
|
||||
resp[
|
||||
"events"][-1]["decisionTaskStartedEventAttributes"]["identity"].should.equal("srv01")
|
||||
resp["events"][-1]["decisionTaskStartedEventAttributes"]["identity"].should.equal(
|
||||
"srv01"
|
||||
)
|
||||
|
||||
|
||||
@mock_swf_deprecated
|
||||
|
|
@ -49,11 +51,11 @@ def test_poll_for_decision_task_on_non_existent_queue():
|
|||
@mock_swf_deprecated
|
||||
def test_poll_for_decision_task_with_reverse_order():
|
||||
conn = setup_workflow()
|
||||
resp = conn.poll_for_decision_task(
|
||||
"test-domain", "queue", reverse_order=True)
|
||||
resp = conn.poll_for_decision_task("test-domain", "queue", reverse_order=True)
|
||||
types = [evt["eventType"] for evt in resp["events"]]
|
||||
types.should.equal(
|
||||
["DecisionTaskStarted", "DecisionTaskScheduled", "WorkflowExecutionStarted"])
|
||||
["DecisionTaskStarted", "DecisionTaskScheduled", "WorkflowExecutionStarted"]
|
||||
)
|
||||
|
||||
|
||||
# CountPendingDecisionTasks endpoint
|
||||
|
|
@ -91,29 +93,32 @@ def test_respond_decision_task_completed_with_no_decision():
|
|||
task_token = resp["taskToken"]
|
||||
|
||||
resp = conn.respond_decision_task_completed(
|
||||
task_token,
|
||||
execution_context="free-form context",
|
||||
task_token, execution_context="free-form context"
|
||||
)
|
||||
resp.should.be.none
|
||||
|
||||
resp = conn.get_workflow_execution_history(
|
||||
"test-domain", conn.run_id, "uid-abcd1234")
|
||||
"test-domain", conn.run_id, "uid-abcd1234"
|
||||
)
|
||||
types = [evt["eventType"] for evt in resp["events"]]
|
||||
types.should.equal([
|
||||
"WorkflowExecutionStarted",
|
||||
"DecisionTaskScheduled",
|
||||
"DecisionTaskStarted",
|
||||
"DecisionTaskCompleted",
|
||||
])
|
||||
types.should.equal(
|
||||
[
|
||||
"WorkflowExecutionStarted",
|
||||
"DecisionTaskScheduled",
|
||||
"DecisionTaskStarted",
|
||||
"DecisionTaskCompleted",
|
||||
]
|
||||
)
|
||||
evt = resp["events"][-1]
|
||||
evt["decisionTaskCompletedEventAttributes"].should.equal({
|
||||
"executionContext": "free-form context",
|
||||
"scheduledEventId": 2,
|
||||
"startedEventId": 3,
|
||||
})
|
||||
evt["decisionTaskCompletedEventAttributes"].should.equal(
|
||||
{
|
||||
"executionContext": "free-form context",
|
||||
"scheduledEventId": 2,
|
||||
"startedEventId": 3,
|
||||
}
|
||||
)
|
||||
|
||||
resp = conn.describe_workflow_execution(
|
||||
"test-domain", conn.run_id, "uid-abcd1234")
|
||||
resp = conn.describe_workflow_execution("test-domain", conn.run_id, "uid-abcd1234")
|
||||
resp["latestExecutionContext"].should.equal("free-form context")
|
||||
|
||||
|
||||
|
|
@ -138,9 +143,9 @@ def test_respond_decision_task_completed_on_close_workflow_execution():
|
|||
wfe.execution_status = "CLOSED"
|
||||
# /bad
|
||||
|
||||
conn.respond_decision_task_completed.when.called_with(
|
||||
task_token
|
||||
).should.throw(SWFResponseError)
|
||||
conn.respond_decision_task_completed.when.called_with(task_token).should.throw(
|
||||
SWFResponseError
|
||||
)
|
||||
|
||||
|
||||
@mock_swf_deprecated
|
||||
|
|
@ -150,9 +155,9 @@ def test_respond_decision_task_completed_with_task_already_completed():
|
|||
task_token = resp["taskToken"]
|
||||
conn.respond_decision_task_completed(task_token)
|
||||
|
||||
conn.respond_decision_task_completed.when.called_with(
|
||||
task_token
|
||||
).should.throw(SWFResponseError)
|
||||
conn.respond_decision_task_completed.when.called_with(task_token).should.throw(
|
||||
SWFResponseError
|
||||
)
|
||||
|
||||
|
||||
@mock_swf_deprecated
|
||||
|
|
@ -161,26 +166,31 @@ def test_respond_decision_task_completed_with_complete_workflow_execution():
|
|||
resp = conn.poll_for_decision_task("test-domain", "queue")
|
||||
task_token = resp["taskToken"]
|
||||
|
||||
decisions = [{
|
||||
"decisionType": "CompleteWorkflowExecution",
|
||||
"completeWorkflowExecutionDecisionAttributes": {"result": "foo bar"}
|
||||
}]
|
||||
resp = conn.respond_decision_task_completed(
|
||||
task_token, decisions=decisions)
|
||||
decisions = [
|
||||
{
|
||||
"decisionType": "CompleteWorkflowExecution",
|
||||
"completeWorkflowExecutionDecisionAttributes": {"result": "foo bar"},
|
||||
}
|
||||
]
|
||||
resp = conn.respond_decision_task_completed(task_token, decisions=decisions)
|
||||
resp.should.be.none
|
||||
|
||||
resp = conn.get_workflow_execution_history(
|
||||
"test-domain", conn.run_id, "uid-abcd1234")
|
||||
"test-domain", conn.run_id, "uid-abcd1234"
|
||||
)
|
||||
types = [evt["eventType"] for evt in resp["events"]]
|
||||
types.should.equal([
|
||||
"WorkflowExecutionStarted",
|
||||
"DecisionTaskScheduled",
|
||||
"DecisionTaskStarted",
|
||||
"DecisionTaskCompleted",
|
||||
"WorkflowExecutionCompleted",
|
||||
])
|
||||
types.should.equal(
|
||||
[
|
||||
"WorkflowExecutionStarted",
|
||||
"DecisionTaskScheduled",
|
||||
"DecisionTaskStarted",
|
||||
"DecisionTaskCompleted",
|
||||
"WorkflowExecutionCompleted",
|
||||
]
|
||||
)
|
||||
resp["events"][-1]["workflowExecutionCompletedEventAttributes"][
|
||||
"result"].should.equal("foo bar")
|
||||
"result"
|
||||
].should.equal("foo bar")
|
||||
|
||||
|
||||
@mock_swf_deprecated
|
||||
|
|
@ -211,9 +221,10 @@ def test_respond_decision_task_completed_with_invalid_decision_type():
|
|||
]
|
||||
|
||||
conn.respond_decision_task_completed.when.called_with(
|
||||
task_token, decisions=decisions).should.throw(
|
||||
SWFResponseError,
|
||||
r"Value 'BadDecisionType' at 'decisions.1.member.decisionType'"
|
||||
task_token, decisions=decisions
|
||||
).should.throw(
|
||||
SWFResponseError,
|
||||
r"Value 'BadDecisionType' at 'decisions.1.member.decisionType'",
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -226,8 +237,8 @@ def test_respond_decision_task_completed_with_missing_attributes():
|
|||
decisions = [
|
||||
{
|
||||
"decisionType": "should trigger even with incorrect decision type",
|
||||
"startTimerDecisionAttributes": {}
|
||||
},
|
||||
"startTimerDecisionAttributes": {},
|
||||
}
|
||||
]
|
||||
|
||||
conn.respond_decision_task_completed.when.called_with(
|
||||
|
|
@ -235,7 +246,7 @@ def test_respond_decision_task_completed_with_missing_attributes():
|
|||
).should.throw(
|
||||
SWFResponseError,
|
||||
r"Value null at 'decisions.1.member.startTimerDecisionAttributes.timerId' "
|
||||
r"failed to satisfy constraint: Member must not be null"
|
||||
r"failed to satisfy constraint: Member must not be null",
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -245,16 +256,14 @@ def test_respond_decision_task_completed_with_missing_attributes_totally():
|
|||
resp = conn.poll_for_decision_task("test-domain", "queue")
|
||||
task_token = resp["taskToken"]
|
||||
|
||||
decisions = [
|
||||
{"decisionType": "StartTimer"},
|
||||
]
|
||||
decisions = [{"decisionType": "StartTimer"}]
|
||||
|
||||
conn.respond_decision_task_completed.when.called_with(
|
||||
task_token, decisions=decisions
|
||||
).should.throw(
|
||||
SWFResponseError,
|
||||
r"Value null at 'decisions.1.member.startTimerDecisionAttributes.timerId' "
|
||||
r"failed to satisfy constraint: Member must not be null"
|
||||
r"failed to satisfy constraint: Member must not be null",
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -264,24 +273,31 @@ def test_respond_decision_task_completed_with_fail_workflow_execution():
|
|||
resp = conn.poll_for_decision_task("test-domain", "queue")
|
||||
task_token = resp["taskToken"]
|
||||
|
||||
decisions = [{
|
||||
"decisionType": "FailWorkflowExecution",
|
||||
"failWorkflowExecutionDecisionAttributes": {"reason": "my rules", "details": "foo"}
|
||||
}]
|
||||
resp = conn.respond_decision_task_completed(
|
||||
task_token, decisions=decisions)
|
||||
decisions = [
|
||||
{
|
||||
"decisionType": "FailWorkflowExecution",
|
||||
"failWorkflowExecutionDecisionAttributes": {
|
||||
"reason": "my rules",
|
||||
"details": "foo",
|
||||
},
|
||||
}
|
||||
]
|
||||
resp = conn.respond_decision_task_completed(task_token, decisions=decisions)
|
||||
resp.should.be.none
|
||||
|
||||
resp = conn.get_workflow_execution_history(
|
||||
"test-domain", conn.run_id, "uid-abcd1234")
|
||||
"test-domain", conn.run_id, "uid-abcd1234"
|
||||
)
|
||||
types = [evt["eventType"] for evt in resp["events"]]
|
||||
types.should.equal([
|
||||
"WorkflowExecutionStarted",
|
||||
"DecisionTaskScheduled",
|
||||
"DecisionTaskStarted",
|
||||
"DecisionTaskCompleted",
|
||||
"WorkflowExecutionFailed",
|
||||
])
|
||||
types.should.equal(
|
||||
[
|
||||
"WorkflowExecutionStarted",
|
||||
"DecisionTaskScheduled",
|
||||
"DecisionTaskStarted",
|
||||
"DecisionTaskCompleted",
|
||||
"WorkflowExecutionFailed",
|
||||
]
|
||||
)
|
||||
attrs = resp["events"][-1]["workflowExecutionFailedEventAttributes"]
|
||||
attrs["reason"].should.equal("my rules")
|
||||
attrs["details"].should.equal("foo")
|
||||
|
|
@ -294,49 +310,44 @@ def test_respond_decision_task_completed_with_schedule_activity_task():
|
|||
resp = conn.poll_for_decision_task("test-domain", "queue")
|
||||
task_token = resp["taskToken"]
|
||||
|
||||
decisions = [{
|
||||
"decisionType": "ScheduleActivityTask",
|
||||
"scheduleActivityTaskDecisionAttributes": {
|
||||
"activityId": "my-activity-001",
|
||||
"activityType": {
|
||||
"name": "test-activity",
|
||||
"version": "v1.1"
|
||||
},
|
||||
"heartbeatTimeout": "60",
|
||||
"input": "123",
|
||||
"taskList": {
|
||||
"name": "my-task-list"
|
||||
decisions = [
|
||||
{
|
||||
"decisionType": "ScheduleActivityTask",
|
||||
"scheduleActivityTaskDecisionAttributes": {
|
||||
"activityId": "my-activity-001",
|
||||
"activityType": {"name": "test-activity", "version": "v1.1"},
|
||||
"heartbeatTimeout": "60",
|
||||
"input": "123",
|
||||
"taskList": {"name": "my-task-list"},
|
||||
},
|
||||
}
|
||||
}]
|
||||
resp = conn.respond_decision_task_completed(
|
||||
task_token, decisions=decisions)
|
||||
]
|
||||
resp = conn.respond_decision_task_completed(task_token, decisions=decisions)
|
||||
resp.should.be.none
|
||||
|
||||
resp = conn.get_workflow_execution_history(
|
||||
"test-domain", conn.run_id, "uid-abcd1234")
|
||||
"test-domain", conn.run_id, "uid-abcd1234"
|
||||
)
|
||||
types = [evt["eventType"] for evt in resp["events"]]
|
||||
types.should.equal([
|
||||
"WorkflowExecutionStarted",
|
||||
"DecisionTaskScheduled",
|
||||
"DecisionTaskStarted",
|
||||
"DecisionTaskCompleted",
|
||||
"ActivityTaskScheduled",
|
||||
])
|
||||
resp["events"][-1]["activityTaskScheduledEventAttributes"].should.equal({
|
||||
"decisionTaskCompletedEventId": 4,
|
||||
"activityId": "my-activity-001",
|
||||
"activityType": {
|
||||
"name": "test-activity",
|
||||
"version": "v1.1",
|
||||
},
|
||||
"heartbeatTimeout": "60",
|
||||
"input": "123",
|
||||
"taskList": {
|
||||
"name": "my-task-list"
|
||||
},
|
||||
})
|
||||
types.should.equal(
|
||||
[
|
||||
"WorkflowExecutionStarted",
|
||||
"DecisionTaskScheduled",
|
||||
"DecisionTaskStarted",
|
||||
"DecisionTaskCompleted",
|
||||
"ActivityTaskScheduled",
|
||||
]
|
||||
)
|
||||
resp["events"][-1]["activityTaskScheduledEventAttributes"].should.equal(
|
||||
{
|
||||
"decisionTaskCompletedEventId": 4,
|
||||
"activityId": "my-activity-001",
|
||||
"activityType": {"name": "test-activity", "version": "v1.1"},
|
||||
"heartbeatTimeout": "60",
|
||||
"input": "123",
|
||||
"taskList": {"name": "my-task-list"},
|
||||
}
|
||||
)
|
||||
|
||||
resp = conn.describe_workflow_execution(
|
||||
"test-domain", conn.run_id, "uid-abcd1234")
|
||||
resp = conn.describe_workflow_execution("test-domain", conn.run_id, "uid-abcd1234")
|
||||
resp["latestActivityTaskTimestamp"].should.equal(1420113600.0)
|
||||
|
|
|
|||
|
|
@ -82,18 +82,16 @@ def test_deprecate_already_deprecated_domain():
|
|||
conn.register_domain("test-domain", "60", description="A test domain")
|
||||
conn.deprecate_domain("test-domain")
|
||||
|
||||
conn.deprecate_domain.when.called_with(
|
||||
"test-domain"
|
||||
).should.throw(SWFResponseError)
|
||||
conn.deprecate_domain.when.called_with("test-domain").should.throw(SWFResponseError)
|
||||
|
||||
|
||||
@mock_swf_deprecated
|
||||
def test_deprecate_non_existent_domain():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
|
||||
conn.deprecate_domain.when.called_with(
|
||||
"non-existent"
|
||||
).should.throw(SWFResponseError)
|
||||
conn.deprecate_domain.when.called_with("non-existent").should.throw(
|
||||
SWFResponseError
|
||||
)
|
||||
|
||||
|
||||
# DescribeDomain endpoint
|
||||
|
|
@ -103,8 +101,7 @@ def test_describe_domain():
|
|||
conn.register_domain("test-domain", "60", description="A test domain")
|
||||
|
||||
domain = conn.describe_domain("test-domain")
|
||||
domain["configuration"][
|
||||
"workflowExecutionRetentionPeriodInDays"].should.equal("60")
|
||||
domain["configuration"]["workflowExecutionRetentionPeriodInDays"].should.equal("60")
|
||||
domain["domainInfo"]["description"].should.equal("A test domain")
|
||||
domain["domainInfo"]["name"].should.equal("test-domain")
|
||||
domain["domainInfo"]["status"].should.equal("REGISTERED")
|
||||
|
|
@ -114,6 +111,4 @@ def test_describe_domain():
|
|||
def test_describe_non_existent_domain():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
|
||||
conn.describe_domain.when.called_with(
|
||||
"non-existent"
|
||||
).should.throw(SWFResponseError)
|
||||
conn.describe_domain.when.called_with("non-existent").should.throw(SWFResponseError)
|
||||
|
|
|
|||
|
|
@ -12,23 +12,27 @@ from ..utils import setup_workflow, SCHEDULE_ACTIVITY_TASK_DECISION
|
|||
def test_activity_task_heartbeat_timeout():
|
||||
with freeze_time("2015-01-01 12:00:00"):
|
||||
conn = setup_workflow()
|
||||
decision_token = conn.poll_for_decision_task(
|
||||
"test-domain", "queue")["taskToken"]
|
||||
conn.respond_decision_task_completed(decision_token, decisions=[
|
||||
SCHEDULE_ACTIVITY_TASK_DECISION
|
||||
])
|
||||
decision_token = conn.poll_for_decision_task("test-domain", "queue")[
|
||||
"taskToken"
|
||||
]
|
||||
conn.respond_decision_task_completed(
|
||||
decision_token, decisions=[SCHEDULE_ACTIVITY_TASK_DECISION]
|
||||
)
|
||||
conn.poll_for_activity_task(
|
||||
"test-domain", "activity-task-list", identity="surprise")
|
||||
"test-domain", "activity-task-list", identity="surprise"
|
||||
)
|
||||
|
||||
with freeze_time("2015-01-01 12:04:30"):
|
||||
resp = conn.get_workflow_execution_history(
|
||||
"test-domain", conn.run_id, "uid-abcd1234")
|
||||
"test-domain", conn.run_id, "uid-abcd1234"
|
||||
)
|
||||
resp["events"][-1]["eventType"].should.equal("ActivityTaskStarted")
|
||||
|
||||
with freeze_time("2015-01-01 12:05:30"):
|
||||
# => Activity Task Heartbeat timeout reached!!
|
||||
resp = conn.get_workflow_execution_history(
|
||||
"test-domain", conn.run_id, "uid-abcd1234")
|
||||
"test-domain", conn.run_id, "uid-abcd1234"
|
||||
)
|
||||
|
||||
resp["events"][-2]["eventType"].should.equal("ActivityTaskTimedOut")
|
||||
attrs = resp["events"][-2]["activityTaskTimedOutEventAttributes"]
|
||||
|
|
@ -50,7 +54,8 @@ def test_decision_task_start_to_close_timeout():
|
|||
|
||||
with freeze_time("2015-01-01 12:04:30"):
|
||||
resp = conn.get_workflow_execution_history(
|
||||
"test-domain", conn.run_id, "uid-abcd1234")
|
||||
"test-domain", conn.run_id, "uid-abcd1234"
|
||||
)
|
||||
|
||||
event_types = [evt["eventType"] for evt in resp["events"]]
|
||||
event_types.should.equal(
|
||||
|
|
@ -60,17 +65,27 @@ def test_decision_task_start_to_close_timeout():
|
|||
with freeze_time("2015-01-01 12:05:30"):
|
||||
# => Decision Task Start to Close timeout reached!!
|
||||
resp = conn.get_workflow_execution_history(
|
||||
"test-domain", conn.run_id, "uid-abcd1234")
|
||||
"test-domain", conn.run_id, "uid-abcd1234"
|
||||
)
|
||||
|
||||
event_types = [evt["eventType"] for evt in resp["events"]]
|
||||
event_types.should.equal(
|
||||
["WorkflowExecutionStarted", "DecisionTaskScheduled", "DecisionTaskStarted",
|
||||
"DecisionTaskTimedOut", "DecisionTaskScheduled"]
|
||||
[
|
||||
"WorkflowExecutionStarted",
|
||||
"DecisionTaskScheduled",
|
||||
"DecisionTaskStarted",
|
||||
"DecisionTaskTimedOut",
|
||||
"DecisionTaskScheduled",
|
||||
]
|
||||
)
|
||||
attrs = resp["events"][-2]["decisionTaskTimedOutEventAttributes"]
|
||||
attrs.should.equal({
|
||||
"scheduledEventId": 2, "startedEventId": 3, "timeoutType": "START_TO_CLOSE"
|
||||
})
|
||||
attrs.should.equal(
|
||||
{
|
||||
"scheduledEventId": 2,
|
||||
"startedEventId": 3,
|
||||
"timeoutType": "START_TO_CLOSE",
|
||||
}
|
||||
)
|
||||
# checks that event has been emitted at 12:05:00, not 12:05:30
|
||||
resp["events"][-2]["eventTimestamp"].should.equal(1420113900.0)
|
||||
|
||||
|
|
@ -85,26 +100,27 @@ def test_workflow_execution_start_to_close_timeout():
|
|||
|
||||
with freeze_time("2015-01-01 13:59:30"):
|
||||
resp = conn.get_workflow_execution_history(
|
||||
"test-domain", conn.run_id, "uid-abcd1234")
|
||||
"test-domain", conn.run_id, "uid-abcd1234"
|
||||
)
|
||||
|
||||
event_types = [evt["eventType"] for evt in resp["events"]]
|
||||
event_types.should.equal(
|
||||
["WorkflowExecutionStarted", "DecisionTaskScheduled"]
|
||||
)
|
||||
event_types.should.equal(["WorkflowExecutionStarted", "DecisionTaskScheduled"])
|
||||
|
||||
with freeze_time("2015-01-01 14:00:30"):
|
||||
# => Workflow Execution Start to Close timeout reached!!
|
||||
resp = conn.get_workflow_execution_history(
|
||||
"test-domain", conn.run_id, "uid-abcd1234")
|
||||
"test-domain", conn.run_id, "uid-abcd1234"
|
||||
)
|
||||
|
||||
event_types = [evt["eventType"] for evt in resp["events"]]
|
||||
event_types.should.equal(
|
||||
["WorkflowExecutionStarted", "DecisionTaskScheduled",
|
||||
"WorkflowExecutionTimedOut"]
|
||||
[
|
||||
"WorkflowExecutionStarted",
|
||||
"DecisionTaskScheduled",
|
||||
"WorkflowExecutionTimedOut",
|
||||
]
|
||||
)
|
||||
attrs = resp["events"][-1]["workflowExecutionTimedOutEventAttributes"]
|
||||
attrs.should.equal({
|
||||
"childPolicy": "ABANDON", "timeoutType": "START_TO_CLOSE"
|
||||
})
|
||||
attrs.should.equal({"childPolicy": "ABANDON", "timeoutType": "START_TO_CLOSE"})
|
||||
# checks that event has been emitted at 14:00:00, not 14:00:30
|
||||
resp["events"][-1]["eventTimestamp"].should.equal(1420120800.0)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ from boto.swf.exceptions import SWFResponseError
|
|||
from datetime import datetime, timedelta
|
||||
|
||||
import sure # noqa
|
||||
|
||||
# Ensure 'assert_raises' context manager support for Python 2.6
|
||||
import tests.backport_assert_raises # noqa
|
||||
|
||||
|
|
@ -16,8 +17,11 @@ def setup_swf_environment():
|
|||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60", description="A test domain")
|
||||
conn.register_workflow_type(
|
||||
"test-domain", "test-workflow", "v1.0",
|
||||
task_list="queue", default_child_policy="TERMINATE",
|
||||
"test-domain",
|
||||
"test-workflow",
|
||||
"v1.0",
|
||||
task_list="queue",
|
||||
default_child_policy="TERMINATE",
|
||||
default_execution_start_to_close_timeout="300",
|
||||
default_task_start_to_close_timeout="300",
|
||||
)
|
||||
|
|
@ -31,29 +35,34 @@ def test_start_workflow_execution():
|
|||
conn = setup_swf_environment()
|
||||
|
||||
wf = conn.start_workflow_execution(
|
||||
"test-domain", "uid-abcd1234", "test-workflow", "v1.0")
|
||||
"test-domain", "uid-abcd1234", "test-workflow", "v1.0"
|
||||
)
|
||||
wf.should.contain("runId")
|
||||
|
||||
|
||||
@mock_swf_deprecated
|
||||
def test_signal_workflow_execution():
|
||||
conn = setup_swf_environment()
|
||||
hsh = conn.start_workflow_execution(
|
||||
"test-domain", "uid-abcd1234", "test-workflow", "v1.0")
|
||||
"test-domain", "uid-abcd1234", "test-workflow", "v1.0"
|
||||
)
|
||||
run_id = hsh["runId"]
|
||||
|
||||
wfe = conn.signal_workflow_execution(
|
||||
"test-domain", "my_signal", "uid-abcd1234", "my_input", run_id)
|
||||
"test-domain", "my_signal", "uid-abcd1234", "my_input", run_id
|
||||
)
|
||||
|
||||
wfe = conn.describe_workflow_execution(
|
||||
"test-domain", run_id, "uid-abcd1234")
|
||||
wfe = conn.describe_workflow_execution("test-domain", run_id, "uid-abcd1234")
|
||||
|
||||
wfe["openCounts"]["openDecisionTasks"].should.equal(2)
|
||||
|
||||
|
||||
@mock_swf_deprecated
|
||||
def test_start_already_started_workflow_execution():
|
||||
conn = setup_swf_environment()
|
||||
conn.start_workflow_execution(
|
||||
"test-domain", "uid-abcd1234", "test-workflow", "v1.0")
|
||||
"test-domain", "uid-abcd1234", "test-workflow", "v1.0"
|
||||
)
|
||||
|
||||
conn.start_workflow_execution.when.called_with(
|
||||
"test-domain", "uid-abcd1234", "test-workflow", "v1.0"
|
||||
|
|
@ -75,13 +84,12 @@ def test_start_workflow_execution_on_deprecated_type():
|
|||
def test_describe_workflow_execution():
|
||||
conn = setup_swf_environment()
|
||||
hsh = conn.start_workflow_execution(
|
||||
"test-domain", "uid-abcd1234", "test-workflow", "v1.0")
|
||||
"test-domain", "uid-abcd1234", "test-workflow", "v1.0"
|
||||
)
|
||||
run_id = hsh["runId"]
|
||||
|
||||
wfe = conn.describe_workflow_execution(
|
||||
"test-domain", run_id, "uid-abcd1234")
|
||||
wfe["executionInfo"]["execution"][
|
||||
"workflowId"].should.equal("uid-abcd1234")
|
||||
wfe = conn.describe_workflow_execution("test-domain", run_id, "uid-abcd1234")
|
||||
wfe["executionInfo"]["execution"]["workflowId"].should.equal("uid-abcd1234")
|
||||
wfe["executionInfo"]["executionStatus"].should.equal("OPEN")
|
||||
|
||||
|
||||
|
|
@ -99,11 +107,11 @@ def test_describe_non_existent_workflow_execution():
|
|||
def test_get_workflow_execution_history():
|
||||
conn = setup_swf_environment()
|
||||
hsh = conn.start_workflow_execution(
|
||||
"test-domain", "uid-abcd1234", "test-workflow", "v1.0")
|
||||
"test-domain", "uid-abcd1234", "test-workflow", "v1.0"
|
||||
)
|
||||
run_id = hsh["runId"]
|
||||
|
||||
resp = conn.get_workflow_execution_history(
|
||||
"test-domain", run_id, "uid-abcd1234")
|
||||
resp = conn.get_workflow_execution_history("test-domain", run_id, "uid-abcd1234")
|
||||
types = [evt["eventType"] for evt in resp["events"]]
|
||||
types.should.equal(["WorkflowExecutionStarted", "DecisionTaskScheduled"])
|
||||
|
||||
|
|
@ -112,11 +120,13 @@ def test_get_workflow_execution_history():
|
|||
def test_get_workflow_execution_history_with_reverse_order():
|
||||
conn = setup_swf_environment()
|
||||
hsh = conn.start_workflow_execution(
|
||||
"test-domain", "uid-abcd1234", "test-workflow", "v1.0")
|
||||
"test-domain", "uid-abcd1234", "test-workflow", "v1.0"
|
||||
)
|
||||
run_id = hsh["runId"]
|
||||
|
||||
resp = conn.get_workflow_execution_history("test-domain", run_id, "uid-abcd1234",
|
||||
reverse_order=True)
|
||||
resp = conn.get_workflow_execution_history(
|
||||
"test-domain", run_id, "uid-abcd1234", reverse_order=True
|
||||
)
|
||||
types = [evt["eventType"] for evt in resp["events"]]
|
||||
types.should.equal(["DecisionTaskScheduled", "WorkflowExecutionStarted"])
|
||||
|
||||
|
|
@ -136,32 +146,36 @@ def test_list_open_workflow_executions():
|
|||
conn = setup_swf_environment()
|
||||
# One open workflow execution
|
||||
conn.start_workflow_execution(
|
||||
'test-domain', 'uid-abcd1234', 'test-workflow', 'v1.0'
|
||||
"test-domain", "uid-abcd1234", "test-workflow", "v1.0"
|
||||
)
|
||||
# One closed workflow execution to make sure it isn't displayed
|
||||
run_id = conn.start_workflow_execution(
|
||||
'test-domain', 'uid-abcd12345', 'test-workflow', 'v1.0'
|
||||
)['runId']
|
||||
conn.terminate_workflow_execution('test-domain', 'uid-abcd12345',
|
||||
details='some details',
|
||||
reason='a more complete reason',
|
||||
run_id=run_id)
|
||||
"test-domain", "uid-abcd12345", "test-workflow", "v1.0"
|
||||
)["runId"]
|
||||
conn.terminate_workflow_execution(
|
||||
"test-domain",
|
||||
"uid-abcd12345",
|
||||
details="some details",
|
||||
reason="a more complete reason",
|
||||
run_id=run_id,
|
||||
)
|
||||
|
||||
yesterday = datetime.utcnow() - timedelta(days=1)
|
||||
oldest_date = unix_time(yesterday)
|
||||
response = conn.list_open_workflow_executions('test-domain',
|
||||
oldest_date,
|
||||
workflow_id='test-workflow')
|
||||
execution_infos = response['executionInfos']
|
||||
response = conn.list_open_workflow_executions(
|
||||
"test-domain", oldest_date, workflow_id="test-workflow"
|
||||
)
|
||||
execution_infos = response["executionInfos"]
|
||||
len(execution_infos).should.equal(1)
|
||||
open_workflow = execution_infos[0]
|
||||
open_workflow['workflowType'].should.equal({'version': 'v1.0',
|
||||
'name': 'test-workflow'})
|
||||
open_workflow.should.contain('startTimestamp')
|
||||
open_workflow['execution']['workflowId'].should.equal('uid-abcd1234')
|
||||
open_workflow['execution'].should.contain('runId')
|
||||
open_workflow['cancelRequested'].should.be(False)
|
||||
open_workflow['executionStatus'].should.equal('OPEN')
|
||||
open_workflow["workflowType"].should.equal(
|
||||
{"version": "v1.0", "name": "test-workflow"}
|
||||
)
|
||||
open_workflow.should.contain("startTimestamp")
|
||||
open_workflow["execution"]["workflowId"].should.equal("uid-abcd1234")
|
||||
open_workflow["execution"].should.contain("runId")
|
||||
open_workflow["cancelRequested"].should.be(False)
|
||||
open_workflow["executionStatus"].should.equal("OPEN")
|
||||
|
||||
|
||||
# ListClosedWorkflowExecutions endpoint
|
||||
|
|
@ -170,33 +184,36 @@ def test_list_closed_workflow_executions():
|
|||
conn = setup_swf_environment()
|
||||
# Leave one workflow execution open to make sure it isn't displayed
|
||||
conn.start_workflow_execution(
|
||||
'test-domain', 'uid-abcd1234', 'test-workflow', 'v1.0'
|
||||
"test-domain", "uid-abcd1234", "test-workflow", "v1.0"
|
||||
)
|
||||
# One closed workflow execution
|
||||
run_id = conn.start_workflow_execution(
|
||||
'test-domain', 'uid-abcd12345', 'test-workflow', 'v1.0'
|
||||
)['runId']
|
||||
conn.terminate_workflow_execution('test-domain', 'uid-abcd12345',
|
||||
details='some details',
|
||||
reason='a more complete reason',
|
||||
run_id=run_id)
|
||||
"test-domain", "uid-abcd12345", "test-workflow", "v1.0"
|
||||
)["runId"]
|
||||
conn.terminate_workflow_execution(
|
||||
"test-domain",
|
||||
"uid-abcd12345",
|
||||
details="some details",
|
||||
reason="a more complete reason",
|
||||
run_id=run_id,
|
||||
)
|
||||
|
||||
yesterday = datetime.utcnow() - timedelta(days=1)
|
||||
oldest_date = unix_time(yesterday)
|
||||
response = conn.list_closed_workflow_executions(
|
||||
'test-domain',
|
||||
start_oldest_date=oldest_date,
|
||||
workflow_id='test-workflow')
|
||||
execution_infos = response['executionInfos']
|
||||
"test-domain", start_oldest_date=oldest_date, workflow_id="test-workflow"
|
||||
)
|
||||
execution_infos = response["executionInfos"]
|
||||
len(execution_infos).should.equal(1)
|
||||
open_workflow = execution_infos[0]
|
||||
open_workflow['workflowType'].should.equal({'version': 'v1.0',
|
||||
'name': 'test-workflow'})
|
||||
open_workflow.should.contain('startTimestamp')
|
||||
open_workflow['execution']['workflowId'].should.equal('uid-abcd12345')
|
||||
open_workflow['execution'].should.contain('runId')
|
||||
open_workflow['cancelRequested'].should.be(False)
|
||||
open_workflow['executionStatus'].should.equal('CLOSED')
|
||||
open_workflow["workflowType"].should.equal(
|
||||
{"version": "v1.0", "name": "test-workflow"}
|
||||
)
|
||||
open_workflow.should.contain("startTimestamp")
|
||||
open_workflow["execution"]["workflowId"].should.equal("uid-abcd12345")
|
||||
open_workflow["execution"].should.contain("runId")
|
||||
open_workflow["cancelRequested"].should.be(False)
|
||||
open_workflow["executionStatus"].should.equal("CLOSED")
|
||||
|
||||
|
||||
# TerminateWorkflowExecution endpoint
|
||||
|
|
@ -207,14 +224,16 @@ def test_terminate_workflow_execution():
|
|||
"test-domain", "uid-abcd1234", "test-workflow", "v1.0"
|
||||
)["runId"]
|
||||
|
||||
resp = conn.terminate_workflow_execution("test-domain", "uid-abcd1234",
|
||||
details="some details",
|
||||
reason="a more complete reason",
|
||||
run_id=run_id)
|
||||
resp = conn.terminate_workflow_execution(
|
||||
"test-domain",
|
||||
"uid-abcd1234",
|
||||
details="some details",
|
||||
reason="a more complete reason",
|
||||
run_id=run_id,
|
||||
)
|
||||
resp.should.be.none
|
||||
|
||||
resp = conn.get_workflow_execution_history(
|
||||
"test-domain", run_id, "uid-abcd1234")
|
||||
resp = conn.get_workflow_execution_history("test-domain", run_id, "uid-abcd1234")
|
||||
evt = resp["events"][-1]
|
||||
evt["eventType"].should.equal("WorkflowExecutionTerminated")
|
||||
attrs = evt["workflowExecutionTerminatedEventAttributes"]
|
||||
|
|
@ -243,16 +262,12 @@ def test_terminate_workflow_execution_with_wrong_workflow_or_run_id():
|
|||
# already closed, without run_id
|
||||
conn.terminate_workflow_execution.when.called_with(
|
||||
"test-domain", "uid-abcd1234"
|
||||
).should.throw(
|
||||
SWFResponseError, "Unknown execution, workflowId = uid-abcd1234"
|
||||
)
|
||||
).should.throw(SWFResponseError, "Unknown execution, workflowId = uid-abcd1234")
|
||||
|
||||
# wrong workflow id
|
||||
conn.terminate_workflow_execution.when.called_with(
|
||||
"test-domain", "uid-non-existent"
|
||||
).should.throw(
|
||||
SWFResponseError, "Unknown execution, workflowId = uid-non-existent"
|
||||
)
|
||||
).should.throw(SWFResponseError, "Unknown execution, workflowId = uid-non-existent")
|
||||
|
||||
# wrong run_id
|
||||
conn.terminate_workflow_execution.when.called_with(
|
||||
|
|
|
|||
|
|
@ -49,10 +49,11 @@ def test_list_workflow_types():
|
|||
conn.register_workflow_type("test-domain", "c-test-workflow", "v1.0")
|
||||
|
||||
all_workflow_types = conn.list_workflow_types("test-domain", "REGISTERED")
|
||||
names = [activity_type["workflowType"]["name"]
|
||||
for activity_type in all_workflow_types["typeInfos"]]
|
||||
names.should.equal(
|
||||
["a-test-workflow", "b-test-workflow", "c-test-workflow"])
|
||||
names = [
|
||||
activity_type["workflowType"]["name"]
|
||||
for activity_type in all_workflow_types["typeInfos"]
|
||||
]
|
||||
names.should.equal(["a-test-workflow", "b-test-workflow", "c-test-workflow"])
|
||||
|
||||
|
||||
@mock_swf_deprecated
|
||||
|
|
@ -63,12 +64,14 @@ def test_list_workflow_types_reverse_order():
|
|||
conn.register_workflow_type("test-domain", "a-test-workflow", "v1.0")
|
||||
conn.register_workflow_type("test-domain", "c-test-workflow", "v1.0")
|
||||
|
||||
all_workflow_types = conn.list_workflow_types("test-domain", "REGISTERED",
|
||||
reverse_order=True)
|
||||
names = [activity_type["workflowType"]["name"]
|
||||
for activity_type in all_workflow_types["typeInfos"]]
|
||||
names.should.equal(
|
||||
["c-test-workflow", "b-test-workflow", "a-test-workflow"])
|
||||
all_workflow_types = conn.list_workflow_types(
|
||||
"test-domain", "REGISTERED", reverse_order=True
|
||||
)
|
||||
names = [
|
||||
activity_type["workflowType"]["name"]
|
||||
for activity_type in all_workflow_types["typeInfos"]
|
||||
]
|
||||
names.should.equal(["c-test-workflow", "b-test-workflow", "a-test-workflow"])
|
||||
|
||||
|
||||
# DeprecateWorkflowType endpoint
|
||||
|
|
@ -112,15 +115,18 @@ def test_deprecate_non_existent_workflow_type():
|
|||
def test_describe_workflow_type():
|
||||
conn = boto.connect_swf("the_key", "the_secret")
|
||||
conn.register_domain("test-domain", "60")
|
||||
conn.register_workflow_type("test-domain", "test-workflow", "v1.0",
|
||||
task_list="foo", default_child_policy="TERMINATE")
|
||||
conn.register_workflow_type(
|
||||
"test-domain",
|
||||
"test-workflow",
|
||||
"v1.0",
|
||||
task_list="foo",
|
||||
default_child_policy="TERMINATE",
|
||||
)
|
||||
|
||||
actype = conn.describe_workflow_type(
|
||||
"test-domain", "test-workflow", "v1.0")
|
||||
actype = conn.describe_workflow_type("test-domain", "test-workflow", "v1.0")
|
||||
actype["configuration"]["defaultTaskList"]["name"].should.equal("foo")
|
||||
actype["configuration"]["defaultChildPolicy"].should.equal("TERMINATE")
|
||||
actype["configuration"].keys().should_not.contain(
|
||||
"defaultTaskStartToCloseTimeout")
|
||||
actype["configuration"].keys().should_not.contain("defaultTaskStartToCloseTimeout")
|
||||
infos = actype["typeInfo"]
|
||||
infos["workflowType"]["name"].should.equal("test-workflow")
|
||||
infos["workflowType"]["version"].should.equal("v1.0")
|
||||
|
|
|
|||
|
|
@ -16,69 +16,76 @@ from moto.swf.exceptions import (
|
|||
SWFValidationException,
|
||||
SWFDecisionValidationException,
|
||||
)
|
||||
from moto.swf.models import (
|
||||
WorkflowType,
|
||||
)
|
||||
from moto.swf.models import WorkflowType
|
||||
|
||||
|
||||
def test_swf_client_error():
|
||||
ex = SWFClientError("ASpecificType", "error message")
|
||||
|
||||
ex.code.should.equal(400)
|
||||
json.loads(ex.get_body()).should.equal({
|
||||
"__type": "ASpecificType",
|
||||
"message": "error message"
|
||||
})
|
||||
json.loads(ex.get_body()).should.equal(
|
||||
{"__type": "ASpecificType", "message": "error message"}
|
||||
)
|
||||
|
||||
|
||||
def test_swf_unknown_resource_fault():
|
||||
ex = SWFUnknownResourceFault("type", "detail")
|
||||
|
||||
ex.code.should.equal(400)
|
||||
json.loads(ex.get_body()).should.equal({
|
||||
"__type": "com.amazonaws.swf.base.model#UnknownResourceFault",
|
||||
"message": "Unknown type: detail"
|
||||
})
|
||||
json.loads(ex.get_body()).should.equal(
|
||||
{
|
||||
"__type": "com.amazonaws.swf.base.model#UnknownResourceFault",
|
||||
"message": "Unknown type: detail",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_swf_unknown_resource_fault_with_only_one_parameter():
|
||||
ex = SWFUnknownResourceFault("foo bar baz")
|
||||
|
||||
ex.code.should.equal(400)
|
||||
json.loads(ex.get_body()).should.equal({
|
||||
"__type": "com.amazonaws.swf.base.model#UnknownResourceFault",
|
||||
"message": "Unknown foo bar baz"
|
||||
})
|
||||
json.loads(ex.get_body()).should.equal(
|
||||
{
|
||||
"__type": "com.amazonaws.swf.base.model#UnknownResourceFault",
|
||||
"message": "Unknown foo bar baz",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_swf_domain_already_exists_fault():
|
||||
ex = SWFDomainAlreadyExistsFault("domain-name")
|
||||
|
||||
ex.code.should.equal(400)
|
||||
json.loads(ex.get_body()).should.equal({
|
||||
"__type": "com.amazonaws.swf.base.model#DomainAlreadyExistsFault",
|
||||
"message": "domain-name"
|
||||
})
|
||||
json.loads(ex.get_body()).should.equal(
|
||||
{
|
||||
"__type": "com.amazonaws.swf.base.model#DomainAlreadyExistsFault",
|
||||
"message": "domain-name",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_swf_domain_deprecated_fault():
|
||||
ex = SWFDomainDeprecatedFault("domain-name")
|
||||
|
||||
ex.code.should.equal(400)
|
||||
json.loads(ex.get_body()).should.equal({
|
||||
"__type": "com.amazonaws.swf.base.model#DomainDeprecatedFault",
|
||||
"message": "domain-name"
|
||||
})
|
||||
json.loads(ex.get_body()).should.equal(
|
||||
{
|
||||
"__type": "com.amazonaws.swf.base.model#DomainDeprecatedFault",
|
||||
"message": "domain-name",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_swf_serialization_exception():
|
||||
ex = SWFSerializationException("value")
|
||||
|
||||
ex.code.should.equal(400)
|
||||
json.loads(ex.get_body()).should.equal({
|
||||
"__type": "com.amazonaws.swf.base.model#SerializationException",
|
||||
"message": "class java.lang.Foo can not be converted to an String (not a real SWF exception ; happened on: value)"
|
||||
})
|
||||
json.loads(ex.get_body()).should.equal(
|
||||
{
|
||||
"__type": "com.amazonaws.swf.base.model#SerializationException",
|
||||
"message": "class java.lang.Foo can not be converted to an String (not a real SWF exception ; happened on: value)",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_swf_type_already_exists_fault():
|
||||
|
|
@ -86,10 +93,12 @@ def test_swf_type_already_exists_fault():
|
|||
ex = SWFTypeAlreadyExistsFault(wft)
|
||||
|
||||
ex.code.should.equal(400)
|
||||
json.loads(ex.get_body()).should.equal({
|
||||
"__type": "com.amazonaws.swf.base.model#TypeAlreadyExistsFault",
|
||||
"message": "WorkflowType=[name=wf-name, version=wf-version]"
|
||||
})
|
||||
json.loads(ex.get_body()).should.equal(
|
||||
{
|
||||
"__type": "com.amazonaws.swf.base.model#TypeAlreadyExistsFault",
|
||||
"message": "WorkflowType=[name=wf-name, version=wf-version]",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_swf_type_deprecated_fault():
|
||||
|
|
@ -97,51 +106,65 @@ def test_swf_type_deprecated_fault():
|
|||
ex = SWFTypeDeprecatedFault(wft)
|
||||
|
||||
ex.code.should.equal(400)
|
||||
json.loads(ex.get_body()).should.equal({
|
||||
"__type": "com.amazonaws.swf.base.model#TypeDeprecatedFault",
|
||||
"message": "WorkflowType=[name=wf-name, version=wf-version]"
|
||||
})
|
||||
json.loads(ex.get_body()).should.equal(
|
||||
{
|
||||
"__type": "com.amazonaws.swf.base.model#TypeDeprecatedFault",
|
||||
"message": "WorkflowType=[name=wf-name, version=wf-version]",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_swf_workflow_execution_already_started_fault():
|
||||
ex = SWFWorkflowExecutionAlreadyStartedFault()
|
||||
|
||||
ex.code.should.equal(400)
|
||||
json.loads(ex.get_body()).should.equal({
|
||||
"__type": "com.amazonaws.swf.base.model#WorkflowExecutionAlreadyStartedFault",
|
||||
'message': 'Already Started',
|
||||
})
|
||||
json.loads(ex.get_body()).should.equal(
|
||||
{
|
||||
"__type": "com.amazonaws.swf.base.model#WorkflowExecutionAlreadyStartedFault",
|
||||
"message": "Already Started",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_swf_default_undefined_fault():
|
||||
ex = SWFDefaultUndefinedFault("execution_start_to_close_timeout")
|
||||
|
||||
ex.code.should.equal(400)
|
||||
json.loads(ex.get_body()).should.equal({
|
||||
"__type": "com.amazonaws.swf.base.model#DefaultUndefinedFault",
|
||||
"message": "executionStartToCloseTimeout",
|
||||
})
|
||||
json.loads(ex.get_body()).should.equal(
|
||||
{
|
||||
"__type": "com.amazonaws.swf.base.model#DefaultUndefinedFault",
|
||||
"message": "executionStartToCloseTimeout",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_swf_validation_exception():
|
||||
ex = SWFValidationException("Invalid token")
|
||||
|
||||
ex.code.should.equal(400)
|
||||
json.loads(ex.get_body()).should.equal({
|
||||
"__type": "com.amazon.coral.validate#ValidationException",
|
||||
"message": "Invalid token",
|
||||
})
|
||||
json.loads(ex.get_body()).should.equal(
|
||||
{
|
||||
"__type": "com.amazon.coral.validate#ValidationException",
|
||||
"message": "Invalid token",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_swf_decision_validation_error():
|
||||
ex = SWFDecisionValidationException([
|
||||
{"type": "null_value",
|
||||
"where": "decisions.1.member.startTimerDecisionAttributes.startToFireTimeout"},
|
||||
{"type": "bad_decision_type",
|
||||
"value": "FooBar",
|
||||
"where": "decisions.1.member.decisionType",
|
||||
"possible_values": "Foo, Bar, Baz"},
|
||||
])
|
||||
ex = SWFDecisionValidationException(
|
||||
[
|
||||
{
|
||||
"type": "null_value",
|
||||
"where": "decisions.1.member.startTimerDecisionAttributes.startToFireTimeout",
|
||||
},
|
||||
{
|
||||
"type": "bad_decision_type",
|
||||
"value": "FooBar",
|
||||
"where": "decisions.1.member.decisionType",
|
||||
"possible_values": "Foo, Bar, Baz",
|
||||
},
|
||||
]
|
||||
)
|
||||
|
||||
ex.code.should.equal(400)
|
||||
ex.error_type.should.equal("com.amazon.coral.validate#ValidationException")
|
||||
|
|
|
|||
|
|
@ -4,10 +4,6 @@ from moto.swf.utils import decapitalize
|
|||
|
||||
|
||||
def test_decapitalize():
|
||||
cases = {
|
||||
"fooBar": "fooBar",
|
||||
"FooBar": "fooBar",
|
||||
"FOO BAR": "fOO BAR",
|
||||
}
|
||||
cases = {"fooBar": "fooBar", "FooBar": "fooBar", "FOO BAR": "fOO BAR"}
|
||||
for before, after in cases.items():
|
||||
decapitalize(before).should.equal(after)
|
||||
|
|
|
|||
|
|
@ -1,11 +1,6 @@
|
|||
import boto
|
||||
|
||||
from moto.swf.models import (
|
||||
ActivityType,
|
||||
Domain,
|
||||
WorkflowType,
|
||||
WorkflowExecution,
|
||||
)
|
||||
from moto.swf.models import ActivityType, Domain, WorkflowType, WorkflowExecution
|
||||
|
||||
|
||||
# Some useful constants
|
||||
|
|
@ -13,9 +8,9 @@ from moto.swf.models import (
|
|||
# from semi-real world example, the goal is mostly to have predictible and
|
||||
# intuitive behaviour in moto/swf own tests...
|
||||
ACTIVITY_TASK_TIMEOUTS = {
|
||||
"heartbeatTimeout": "300", # 5 mins
|
||||
"heartbeatTimeout": "300", # 5 mins
|
||||
"scheduleToStartTimeout": "1800", # 30 mins
|
||||
"startToCloseTimeout": "1800", # 30 mins
|
||||
"startToCloseTimeout": "1800", # 30 mins
|
||||
"scheduleToCloseTimeout": "2700", # 45 mins
|
||||
}
|
||||
|
||||
|
|
@ -26,11 +21,12 @@ SCHEDULE_ACTIVITY_TASK_DECISION = {
|
|||
"activityId": "my-activity-001",
|
||||
"activityType": {"name": "test-activity", "version": "v1.1"},
|
||||
"taskList": {"name": "activity-task-list"},
|
||||
}
|
||||
},
|
||||
}
|
||||
for key, value in ACTIVITY_TASK_TIMEOUTS.items():
|
||||
SCHEDULE_ACTIVITY_TASK_DECISION[
|
||||
"scheduleActivityTaskDecisionAttributes"][key] = value
|
||||
SCHEDULE_ACTIVITY_TASK_DECISION["scheduleActivityTaskDecisionAttributes"][
|
||||
key
|
||||
] = value
|
||||
|
||||
|
||||
# A test Domain
|
||||
|
|
@ -40,14 +36,15 @@ def get_basic_domain():
|
|||
|
||||
# A test WorkflowType
|
||||
def _generic_workflow_type_attributes():
|
||||
return [
|
||||
"test-workflow", "v1.0"
|
||||
], {
|
||||
"task_list": "queue",
|
||||
"default_child_policy": "ABANDON",
|
||||
"default_execution_start_to_close_timeout": "7200",
|
||||
"default_task_start_to_close_timeout": "300",
|
||||
}
|
||||
return (
|
||||
["test-workflow", "v1.0"],
|
||||
{
|
||||
"task_list": "queue",
|
||||
"default_child_policy": "ABANDON",
|
||||
"default_execution_start_to_close_timeout": "7200",
|
||||
"default_task_start_to_close_timeout": "300",
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def get_basic_workflow_type():
|
||||
|
|
@ -81,14 +78,17 @@ def setup_workflow():
|
|||
conn.register_domain("test-domain", "60", description="A test domain")
|
||||
conn = mock_basic_workflow_type("test-domain", conn)
|
||||
conn.register_activity_type(
|
||||
"test-domain", "test-activity", "v1.1",
|
||||
"test-domain",
|
||||
"test-activity",
|
||||
"v1.1",
|
||||
default_task_heartbeat_timeout="600",
|
||||
default_task_schedule_to_close_timeout="600",
|
||||
default_task_schedule_to_start_timeout="600",
|
||||
default_task_start_to_close_timeout="600",
|
||||
)
|
||||
wfe = conn.start_workflow_execution(
|
||||
"test-domain", "uid-abcd1234", "test-workflow", "v1.0")
|
||||
"test-domain", "uid-abcd1234", "test-workflow", "v1.0"
|
||||
)
|
||||
conn.run_id = wfe["runId"]
|
||||
return conn
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue