| OLD | NEW |
| 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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 'report': { | 419 'report': { |
| 420 'metadata': { | 420 'metadata': { |
| 421 'infra_failure': True | 421 'infra_failure': True |
| 422 } | 422 } |
| 423 } | 423 } |
| 424 } | 424 } |
| 425 }) | 425 }) |
| 426 } | 426 } |
| 427 | 427 |
| 428 expected_error_dict = { | 428 expected_error_dict = { |
| 429 'message': 'Compile failed unexpectedly.', | 429 'message': 'Buildbucket reported a general error.', |
| 430 'reason': MonitorTryJobPipeline.UNKNOWN | 430 'reason': MonitorTryJobPipeline.UNKNOWN |
| 431 } | 431 } |
| 432 | 432 |
| 433 self.assertEqual( | 433 self.assertEqual( |
| 434 monitor_try_job_pipeline._GetError(build_response, None, False), | 434 monitor_try_job_pipeline._GetError(build_response, None, False), |
| 435 (expected_error_dict, try_job_error.INFRA_FAILURE)) | 435 (expected_error_dict, try_job_error.INFRA_FAILURE)) |
| 436 | 436 |
| 437 def testGetErrorUnknownBuildbucketFailure(self): | 437 def testGetErrorUnknownBuildbucketFailure(self): |
| 438 build_response = { | 438 build_response = { |
| 439 'result': 'FAILED', | 439 'result': 'FAILED', |
| (...skipping 22 matching lines...) Expand all Loading... |
| 462 } | 462 } |
| 463 | 463 |
| 464 expected_error_dict = { | 464 expected_error_dict = { |
| 465 'message': 'No result report was found.', | 465 'message': 'No result report was found.', |
| 466 'reason': MonitorTryJobPipeline.UNKNOWN | 466 'reason': MonitorTryJobPipeline.UNKNOWN |
| 467 } | 467 } |
| 468 | 468 |
| 469 self.assertEqual( | 469 self.assertEqual( |
| 470 monitor_try_job_pipeline._GetError(build_response, None, False), | 470 monitor_try_job_pipeline._GetError(build_response, None, False), |
| 471 (expected_error_dict, try_job_error.UNKNOWN)) | 471 (expected_error_dict, try_job_error.UNKNOWN)) |
| OLD | NEW |