Implement start to close timeout on SWF decision tasks

This commit is contained in:
Jean-Baptiste Barth 2015-11-04 10:12:17 +01:00
commit 86973f2b87
6 changed files with 89 additions and 1 deletions

View file

@ -1,3 +1,4 @@
from freezegun import freeze_time
from sure import expect
from moto.swf.models import DecisionTask
@ -29,3 +30,20 @@ def test_decision_task_full_dict_representation():
dt.start(1234)
fd = dt.to_full_dict()
fd["startedEventId"].should.equal(1234)
def test_decision_task_has_timedout():
wfe = make_workflow_execution()
wft = wfe.workflow_type
dt = DecisionTask(wfe, 123)
dt.has_timedout().should.equal(False)
with freeze_time("2015-01-01 12:00:00"):
dt.start(1234)
dt.has_timedout().should.equal(False)
# activity task timeout is 300s == 5mins
with freeze_time("2015-01-01 12:06:00"):
dt.has_timedout().should.equal(True)
dt.complete()
dt.has_timedout().should.equal(False)