| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 mock | 6 import mock |
| 7 | 7 |
| 8 from common import constants | 8 from common import constants |
| 9 from common.pipeline_wrapper import pipeline_handlers | 9 from common.pipeline_wrapper import pipeline_handlers |
| 10 from model import analysis_status | 10 from model import analysis_status |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 | 458 |
| 459 pipeline = NextBuildNumberPipeline() | 459 pipeline = NextBuildNumberPipeline() |
| 460 pipeline.run( | 460 pipeline.run( |
| 461 master_name, builder_name, master_build_number, build_number, step_name, | 461 master_name, builder_name, master_build_number, build_number, step_name, |
| 462 test_name, analysis.version_number) | 462 test_name, analysis.version_number) |
| 463 | 463 |
| 464 analysis = MasterFlakeAnalysis.GetVersion( | 464 analysis = MasterFlakeAnalysis.GetVersion( |
| 465 master_name, builder_name, master_build_number, step_name, test_name) | 465 master_name, builder_name, master_build_number, step_name, test_name) |
| 466 self.assertEqual(analysis_status.COMPLETED, analysis.status) | 466 self.assertEqual(analysis_status.COMPLETED, analysis.status) |
| 467 | 467 |
| 468 def testUpdateAnalysisUponCompletionFound(self): | |
| 469 analysis = MasterFlakeAnalysis.Create('m', 'b', 123, 's', 't') | |
| 470 recursive_flake_pipeline._UpdateAnalysisStatusUponCompletion( | |
| 471 analysis, 100, analysis_status.COMPLETED, None) | |
| 472 self.assertEqual(analysis.suspected_flake_build_number, 100) | |
| 473 self.assertEqual(analysis.result_status, result_status.FOUND_UNTRIAGED) | |
| 474 | |
| 475 def testUpdateAnalysisUponCompletionError(self): | 468 def testUpdateAnalysisUponCompletionError(self): |
| 476 expected_error = { | 469 expected_error = { |
| 477 'code': 1, | 470 'code': 1, |
| 478 'message': 'some error message' | 471 'message': 'some error message' |
| 479 } | 472 } |
| 480 analysis = MasterFlakeAnalysis.Create('m', 'b', 123, 's', 't') | 473 analysis = MasterFlakeAnalysis.Create('m', 'b', 123, 's', 't') |
| 481 recursive_flake_pipeline._UpdateAnalysisStatusUponCompletion( | 474 recursive_flake_pipeline._UpdateAnalysisStatusUponCompletion( |
| 482 analysis, 100, analysis_status.COMPLETED, expected_error) | 475 analysis, 100, analysis_status.COMPLETED, expected_error) |
| 483 self.assertEqual(expected_error, analysis.error) | 476 self.assertEqual(expected_error, analysis.error) |
| 484 self.assertEqual(analysis.suspected_flake_build_number, 100) | 477 self.assertEqual(analysis.suspected_flake_build_number, 100) |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 calls = mocked_pipeline.mock_calls | 719 calls = mocked_pipeline.mock_calls |
| 727 self.assertEqual(2, len(calls)) | 720 self.assertEqual(2, len(calls)) |
| 728 | 721 |
| 729 _, args, __ = calls[0] | 722 _, args, __ = calls[0] |
| 730 bug_id, comment, labels = args | 723 bug_id, comment, labels = args |
| 731 self.assertEqual(123, bug_id) | 724 self.assertEqual(123, bug_id) |
| 732 self.assertEqual(['AnalyzedByFindit'], labels) | 725 self.assertEqual(['AnalyzedByFindit'], labels) |
| 733 self.assertTrue('om / ob / os' in comment) | 726 self.assertTrue('om / ob / os' in comment) |
| 734 | 727 |
| 735 self.assertEqual(mock.call().start(queue_name='queue'), calls[1]) | 728 self.assertEqual(mock.call().start(queue_name='queue'), calls[1]) |
| OLD | NEW |