This commit is contained in:
Steve Pulec 2017-02-23 21:37:43 -05:00
commit f37bad0e00
260 changed files with 6363 additions and 3766 deletions

View file

@ -11,19 +11,23 @@ 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"]
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")
conn.poll_for_activity_task(
"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")
resp = conn.get_workflow_execution_history(
"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")
resp = conn.get_workflow_execution_history(
"test-domain", conn.run_id, "uid-abcd1234")
resp["events"][-2]["eventType"].should.equal("ActivityTaskTimedOut")
attrs = resp["events"][-2]["activityTaskTimedOutEventAttributes"]
@ -44,7 +48,8 @@ def test_decision_task_start_to_close_timeout():
conn.poll_for_decision_task("test-domain", "queue")["taskToken"]
with freeze_time("2015-01-01 12:04:30"):
resp = conn.get_workflow_execution_history("test-domain", conn.run_id, "uid-abcd1234")
resp = conn.get_workflow_execution_history(
"test-domain", conn.run_id, "uid-abcd1234")
event_types = [evt["eventType"] for evt in resp["events"]]
event_types.should.equal(
@ -53,7 +58,8 @@ 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")
resp = conn.get_workflow_execution_history(
"test-domain", conn.run_id, "uid-abcd1234")
event_types = [evt["eventType"] for evt in resp["events"]]
event_types.should.equal(
@ -77,7 +83,8 @@ def test_workflow_execution_start_to_close_timeout():
conn = setup_workflow()
with freeze_time("2015-01-01 13:59:30"):
resp = conn.get_workflow_execution_history("test-domain", conn.run_id, "uid-abcd1234")
resp = conn.get_workflow_execution_history(
"test-domain", conn.run_id, "uid-abcd1234")
event_types = [evt["eventType"] for evt in resp["events"]]
event_types.should.equal(
@ -86,11 +93,13 @@ def test_workflow_execution_start_to_close_timeout():
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")
resp = conn.get_workflow_execution_history(
"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({