Ensure activity and decision tasks cannot timeout on a closed workflow

This commit is contained in:
Jean-Baptiste Barth 2015-11-04 22:35:45 +01:00
commit 65c95ab5bc
5 changed files with 44 additions and 7 deletions

View file

@ -102,3 +102,24 @@ def test_activity_task_has_timedout():
task.process_timeouts()
task.state.should.equal("TIMED_OUT")
task.timeout_type.should.equal("HEARTBEAT")
def test_activity_task_cannot_timeout_on_closed_workflow_execution():
with freeze_time("2015-01-01 12:00:00"):
wfe = make_workflow_execution()
wfe.start()
with freeze_time("2015-01-01 13:58:00"):
task = ActivityTask(
activity_id="my-activity-123",
activity_type="foo",
input="optional",
scheduled_event_id=117,
timeouts=ACTIVITY_TASK_TIMEOUTS,
workflow_execution=wfe,
)
with freeze_time("2015-01-01 14:10:00"):
task.has_timedout().should.equal(True)
wfe.has_timedout().should.equal(True)
wfe.process_timeouts()
task.has_timedout().should.equal(False)