Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: appengine/findit/waterfall/test/monitor_try_job_pipeline_test.py

Issue 2260313003: [Findit] Capture and store latest buildbucket response with each query (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Addressing comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « appengine/findit/waterfall/monitor_try_job_pipeline.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from datetime import datetime 5 from datetime import datetime
6 import json 6 import json
7 import time 7 import time
8 8
9 from common.waterfall import buildbucket_client 9 from common.waterfall import buildbucket_client
10 from common.waterfall import failure_type 10 from common.waterfall import failure_type
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 def setUp(self): 126 def setUp(self):
127 super(MonitorTryJobPipelineTest, self).setUp() 127 super(MonitorTryJobPipelineTest, self).setUp()
128 self.mock(time, 'sleep', lambda x: None) 128 self.mock(time, 'sleep', lambda x: None)
129 129
130 def testMicrosecondsToDatetime(self): 130 def testMicrosecondsToDatetime(self):
131 self.assertEqual( 131 self.assertEqual(
132 datetime(2016, 2, 1, 22, 59, 34), 132 datetime(2016, 2, 1, 22, 59, 34),
133 monitor_try_job_pipeline._MicrosecondsToDatetime(1454367574000000)) 133 monitor_try_job_pipeline._MicrosecondsToDatetime(1454367574000000))
134 self.assertIsNone(monitor_try_job_pipeline._MicrosecondsToDatetime(None)) 134 self.assertIsNone(monitor_try_job_pipeline._MicrosecondsToDatetime(None))
135 135
136 def testDictsAreEqual(self):
137 self.assertTrue(monitor_try_job_pipeline._DictsAreEqual(None, None))
138 self.assertTrue(monitor_try_job_pipeline._DictsAreEqual({}, {}))
139 self.assertTrue(monitor_try_job_pipeline._DictsAreEqual({'a': 1}, {'a': 1}))
140 self.assertTrue(monitor_try_job_pipeline._DictsAreEqual(
141 {'a': 1},
142 {'a': 1, 'b': 2},
143 exclude_keys=['b']))
144 self.assertTrue(monitor_try_job_pipeline._DictsAreEqual(
145 {'a': 1, 'b': 1},
146 {'a': 1, 'b': 2},
147 exclude_keys=['b']))
148 self.assertTrue(monitor_try_job_pipeline._DictsAreEqual(
149 {'a': 1},
150 {},
151 exclude_keys=['a']))
152 self.assertFalse(monitor_try_job_pipeline._DictsAreEqual(
153 {'a': 1},
154 {'a': 2}))
155 self.assertFalse(monitor_try_job_pipeline._DictsAreEqual(
156 {'a': 1, 'b': 2},
157 {'a': 1}))
158 self.assertFalse(monitor_try_job_pipeline._DictsAreEqual(
159 {'a': 1},
160 {'a': 1, 'b': 2}))
161
136 def testUpdateTryJobMetadataForBuildError(self): 162 def testUpdateTryJobMetadataForBuildError(self):
137 error_data = { 163 error_data = {
138 'reason': 'BUILD_NOT_FOUND', 164 'reason': 'BUILD_NOT_FOUND',
139 'message': 'message' 165 'message': 'message'
140 } 166 }
141 error = buildbucket_client.BuildbucketError(error_data) 167 error = buildbucket_client.BuildbucketError(error_data)
142 try_job_data = WfTryJobData.Create('1') 168 try_job_data = WfTryJobData.Create('1')
143 169
144 monitor_try_job_pipeline._UpdateTryJobMetadata( 170 monitor_try_job_pipeline._UpdateTryJobMetadata(
145 try_job_data, None, None, error, False) 171 try_job_data, None, None, error, False)
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 } 488 }
463 489
464 expected_error_dict = { 490 expected_error_dict = {
465 'message': 'No result report was found.', 491 'message': 'No result report was found.',
466 'reason': MonitorTryJobPipeline.UNKNOWN 492 'reason': MonitorTryJobPipeline.UNKNOWN
467 } 493 }
468 494
469 self.assertEqual( 495 self.assertEqual(
470 monitor_try_job_pipeline._GetError(build_response, None, False), 496 monitor_try_job_pipeline._GetError(build_response, None, False),
471 (expected_error_dict, try_job_error.UNKNOWN)) 497 (expected_error_dict, try_job_error.UNKNOWN))
OLDNEW
« no previous file with comments | « appengine/findit/waterfall/monitor_try_job_pipeline.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698