aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mchucarr...@apache.org
Subject git commit: Fix build failure caused by timezone issue in tests.
Date Thu, 04 Sep 2014 20:01:35 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 9bb3de941 -> 9a33c673f


Fix build failure caused by timezone issue in tests.

Timestamps in pretty-printed job status use the local timezone.
Jenkins machines use GMT as their local time; so the time printed
on jenkins differs from times printed elsewhere.

This fix fuzzes out the time in the timestamps, so that it doesn't matter
where the test is run.

Bugs closed: aurora-684

Reviewed at https://reviews.apache.org/r/25350/


Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/9a33c673
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/9a33c673
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/9a33c673

Branch: refs/heads/master
Commit: 9a33c673fdc589cb18df1494d5991b8184c4ecdb
Parents: 9bb3de9
Author: Mark Chu-Carroll <mchucarroll@twopensource.com>
Authored: Thu Sep 4 15:59:05 2014 -0400
Committer: Mark Chu-Carroll <mchucarroll@twitter.com>
Committed: Thu Sep 4 15:59:05 2014 -0400

----------------------------------------------------------------------
 .../apache/aurora/client/cli/test_status.py     | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/9a33c673/src/test/python/apache/aurora/client/cli/test_status.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/cli/test_status.py b/src/test/python/apache/aurora/client/cli/test_status.py
index 2af24fb..721d976 100644
--- a/src/test/python/apache/aurora/client/cli/test_status.py
+++ b/src/test/python/apache/aurora/client/cli/test_status.py
@@ -13,6 +13,7 @@
 #
 
 import contextlib
+import re
 import textwrap
 
 from mock import Mock, patch
@@ -171,24 +172,24 @@ class TestJobStatus(AuroraClientCommandTest):
         patch('apache.aurora.client.factory.CLUSTERS', new=self.TEST_CLUSTERS)):
       cmd = AuroraCommandLine()
       cmd.execute(['job', 'status', 'west/bozo/test/hello'])
+      actual = re.sub("\\d\\d:\\d\\d:\\d\\d", "##:##:##", '\n'.join(mock_context.get_out()))
       expected = textwrap.dedent("""\
           Active tasks (3):
           \tTask:
           \t  cpus: 2, ram: 2 MB, disk: 2 MB
           \t  events:
-          \t   1970-11-23 13:58:46 RUNNING: Hi there
+          \t   1970-11-23 ##:##:## RUNNING: Hi there
           \tTask:
           \t  cpus: 2, ram: 2 MB, disk: 2 MB
           \t  events:
-          \t   1970-11-23 13:58:46 RUNNING: Hi there
+          \t   1970-11-23 ##:##:## RUNNING: Hi there
           \tTask:
           \t  cpus: 2, ram: 2 MB, disk: 2 MB
           \t  events:
-          \t   1970-11-23 13:58:46 RUNNING: Hi there
+          \t   1970-11-23 ##:##:## RUNNING: Hi there
           Inactive tasks (0):
           """)
-
-      assert '\n'.join(mock_context.get_out()) == expected
+      assert actual == expected
 
   def test_successful_status_output_with_metadata(self):
     """Test the status command more deeply: in a request with a fully specified
@@ -200,32 +201,33 @@ class TestJobStatus(AuroraClientCommandTest):
         patch('apache.aurora.client.factory.CLUSTERS', new=self.TEST_CLUSTERS)):
       cmd = AuroraCommandLine()
       cmd.execute(['job', 'status', 'west/bozo/test/hello'])
+      actual = re.sub("\\d\\d:\\d\\d:\\d\\d", "##:##:##", '\n'.join(mock_context.get_out()))
       expected = textwrap.dedent("""\
           Active tasks (3):
           \tTask:
           \t  cpus: 2, ram: 2 MB, disk: 2 MB
           \t  events:
-          \t   1970-11-23 13:58:46 RUNNING: Hi there
+          \t   1970-11-23 ##:##:## RUNNING: Hi there
           \t  metadata:
           \t\t  (key: 'meta', value: 'data')
           \t\t  (key: 'data', value: 'meta')
           \tTask:
           \t  cpus: 2, ram: 2 MB, disk: 2 MB
           \t  events:
-          \t   1970-11-23 13:58:46 RUNNING: Hi there
+          \t   1970-11-23 ##:##:## RUNNING: Hi there
           \t  metadata:
           \t\t  (key: 'meta', value: 'data')
           \t\t  (key: 'data', value: 'meta')
           \tTask:
           \t  cpus: 2, ram: 2 MB, disk: 2 MB
           \t  events:
-          \t   1970-11-23 13:58:46 RUNNING: Hi there
+          \t   1970-11-23 ##:##:## RUNNING: Hi there
           \t  metadata:
           \t\t  (key: 'meta', value: 'data')
           \t\t  (key: 'data', value: 'meta')
           Inactive tasks (0):
           """)
-      assert '\n'.join(mock_context.get_out()) == expected
+      assert actual == expected
 
   def test_successful_status_deep_null_metadata(self):
     (mock_api, mock_scheduler_proxy) = self.create_mock_api()


Mime
View raw message