Run black on moto & test directories.
This commit is contained in:
parent
c820395dbf
commit
96e5b1993d
507 changed files with 52541 additions and 47814 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue