Fix heartbeatTimeout of NONE and polling responses when there are no tasks (#3680)

* fix heartbeatTimeout of NONE resulting in ValueError and polling returning empty string taskToken when it shouldn't be returned

* fix expected taskToken in impacted tests

Co-authored-by: Clint Parham <cparham@aligntech.com>
This commit is contained in:
redparham 2021-02-12 08:01:42 -05:00 committed by GitHub
commit b60de10c79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 13 deletions

View file

@ -35,14 +35,14 @@ def test_poll_for_activity_task_when_one():
def test_poll_for_activity_task_when_none():
conn = setup_workflow()
resp = conn.poll_for_activity_task("test-domain", "activity-task-list")
resp.should.equal({"startedEventId": 0, "taskToken": ""})
resp.should.equal({"startedEventId": 0})
@mock_swf_deprecated
def test_poll_for_activity_task_on_non_existent_queue():
conn = setup_workflow()
resp = conn.poll_for_activity_task("test-domain", "non-existent-queue")
resp.should.equal({"startedEventId": 0, "taskToken": ""})
resp.should.equal({"startedEventId": 0})
# CountPendingActivityTasks endpoint

View file

@ -62,18 +62,14 @@ def test_poll_for_decision_task_when_none():
resp = conn.poll_for_decision_task("test-domain", "queue")
# this is the DecisionTask representation you get from the real SWF
# after waiting 60s when there's no decision to be taken
resp.should.equal(
{"previousStartedEventId": 0, "startedEventId": 0, "taskToken": ""}
)
resp.should.equal({"previousStartedEventId": 0, "startedEventId": 0})
@mock_swf_deprecated
def test_poll_for_decision_task_on_non_existent_queue():
conn = setup_workflow()
resp = conn.poll_for_decision_task("test-domain", "non-existent-queue")
resp.should.equal(
{"previousStartedEventId": 0, "startedEventId": 0, "taskToken": ""}
)
resp.should.equal({"previousStartedEventId": 0, "startedEventId": 0})
@mock_swf_deprecated