From f4feec4727113f06efaaefcd267a45871ddccb90 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Barth Date: Tue, 3 Nov 2015 09:09:00 +0100 Subject: [PATCH] Fix timestamps in tests as Travis builds run on GMT time When launched manually, tests should be launched with the environment variable TZ=GMT. Maybe this could be useful to add that explicitly somewhere in the README or in the Makefile. --- tests/test_swf/models/test_activity_task.py | 4 ++-- tests/test_swf/models/test_history_event.py | 4 ++-- tests/test_swf/models/test_workflow_execution.py | 8 ++++---- tests/test_swf/responses/test_decision_tasks.py | 2 +- tests/test_swf/test_utils.py | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/test_swf/models/test_activity_task.py b/tests/test_swf/models/test_activity_task.py index 53e9c2cf8..4057c947c 100644 --- a/tests/test_swf/models/test_activity_task.py +++ b/tests/test_swf/models/test_activity_task.py @@ -75,12 +75,12 @@ def test_activity_task_reset_heartbeat_clock(): workflow_execution=wfe, ) - task.last_heartbeat_timestamp.should.equal(1420110000.0) + task.last_heartbeat_timestamp.should.equal(1420113600.0) with freeze_time("2015-01-01 13:00:00"): task.reset_heartbeat_clock() - task.last_heartbeat_timestamp.should.equal(1420113600.0) + task.last_heartbeat_timestamp.should.equal(1420117200.0) def test_activity_task_has_timedout(): wfe = make_workflow_execution() diff --git a/tests/test_swf/models/test_history_event.py b/tests/test_swf/models/test_history_event.py index 89d73210c..8b6a7f711 100644 --- a/tests/test_swf/models/test_history_event.py +++ b/tests/test_swf/models/test_history_event.py @@ -9,7 +9,7 @@ def test_history_event_creation(): he = HistoryEvent(123, "DecisionTaskStarted", scheduled_event_id=2) he.event_id.should.equal(123) he.event_type.should.equal("DecisionTaskStarted") - he.event_timestamp.should.equal(1420110000.0) + he.event_timestamp.should.equal(1420113600.0) @freeze_time("2015-01-01 12:00:00") def test_history_event_to_dict_representation(): @@ -17,7 +17,7 @@ def test_history_event_to_dict_representation(): he.to_dict().should.equal({ "eventId": 123, "eventType": "DecisionTaskStarted", - "eventTimestamp": 1420110000.0, + "eventTimestamp": 1420113600.0, "decisionTaskStartedEventAttributes": { "scheduledEventId": 2 } diff --git a/tests/test_swf/models/test_workflow_execution.py b/tests/test_swf/models/test_workflow_execution.py index ced636969..5f14c51da 100644 --- a/tests/test_swf/models/test_workflow_execution.py +++ b/tests/test_swf/models/test_workflow_execution.py @@ -165,7 +165,7 @@ def test_workflow_execution_start(): wfe.events().should.equal([]) wfe.start() - wfe.start_timestamp.should.equal(1420110000.0) + wfe.start_timestamp.should.equal(1420113600.0) wfe.events().should.have.length_of(2) wfe.events()[0].event_type.should.equal("WorkflowExecutionStarted") wfe.events()[1].event_type.should.equal("DecisionTaskScheduled") @@ -177,7 +177,7 @@ def test_workflow_execution_complete(): wfe.execution_status.should.equal("CLOSED") wfe.close_status.should.equal("COMPLETED") - wfe.close_timestamp.should.equal(1420196400.0) + wfe.close_timestamp.should.equal(1420200000.0) wfe.events()[-1].event_type.should.equal("WorkflowExecutionCompleted") wfe.events()[-1].decision_task_completed_event_id.should.equal(123) wfe.events()[-1].result.should.equal("foo") @@ -189,7 +189,7 @@ def test_workflow_execution_fail(): wfe.execution_status.should.equal("CLOSED") wfe.close_status.should.equal("FAILED") - wfe.close_timestamp.should.equal(1420196400.0) + wfe.close_timestamp.should.equal(1420200000.0) wfe.events()[-1].event_type.should.equal("WorkflowExecutionFailed") wfe.events()[-1].decision_task_completed_event_id.should.equal(123) wfe.events()[-1].details.should.equal("some details") @@ -202,7 +202,7 @@ def test_workflow_execution_schedule_activity_task(): wfe.schedule_activity_task(123, VALID_ACTIVITY_TASK_ATTRIBUTES) - wfe.latest_activity_task_timestamp.should.equal(1420110000.0) + wfe.latest_activity_task_timestamp.should.equal(1420113600.0) wfe.open_counts["openActivityTasks"].should.equal(1) last_event = wfe.events()[-1] diff --git a/tests/test_swf/responses/test_decision_tasks.py b/tests/test_swf/responses/test_decision_tasks.py index 9510b31fd..7e9ecddb1 100644 --- a/tests/test_swf/responses/test_decision_tasks.py +++ b/tests/test_swf/responses/test_decision_tasks.py @@ -313,4 +313,4 @@ def test_respond_decision_task_completed_with_schedule_activity_task(): }) resp = conn.describe_workflow_execution("test-domain", conn.run_id, "uid-abcd1234") - resp["latestActivityTaskTimestamp"].should.equal(1420110000.0) + resp["latestActivityTaskTimestamp"].should.equal(1420113600.0) diff --git a/tests/test_swf/test_utils.py b/tests/test_swf/test_utils.py index 33bb8ada6..9f7da8857 100644 --- a/tests/test_swf/test_utils.py +++ b/tests/test_swf/test_utils.py @@ -18,4 +18,4 @@ def test_decapitalize(): @freeze_time("2015-01-01 12:00:00") def test_now_timestamp(): - now_timestamp().should.equal(1420110000.0) + now_timestamp().should.equal(1420113600.0)