OLD | NEW |
(Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 from pipeline_utils.appengine_third_party_pipeline_src_pipeline import handlers |
| 6 from testing_utils import testing |
| 7 |
| 8 from model.build_analysis import BuildAnalysis |
| 9 from model.build_analysis_status import BuildAnalysisStatus |
| 10 from waterfall import build_failure_analysis |
| 11 from waterfall.identify_culprit_pipeline import IdentifyCulpritPipeline |
| 12 |
| 13 |
| 14 class PullChangelogPipelineTest(testing.AppengineTestCase): |
| 15 app_module = handlers._APP |
| 16 |
| 17 def testPullChangelogs(self): |
| 18 master_name = 'm' |
| 19 builder_name = 'b' |
| 20 build_number = 123 |
| 21 |
| 22 analysis = BuildAnalysis.CreateBuildAnalysis( |
| 23 master_name, builder_name, build_number) |
| 24 analysis.result = None |
| 25 analysis.status = BuildAnalysisStatus.ANALYZING |
| 26 analysis.put() |
| 27 |
| 28 failure_info = { |
| 29 'master_name': master_name, |
| 30 'builder_name': builder_name, |
| 31 'build_number': build_number, |
| 32 } |
| 33 change_logs = {} |
| 34 signals = {} |
| 35 |
| 36 dummy_result = ['dummy_result'] |
| 37 def _MockAnalyzeBuildFailure(*_): |
| 38 return dummy_result |
| 39 |
| 40 self.mock(build_failure_analysis, |
| 41 'AnalyzeBuildFailure', _MockAnalyzeBuildFailure) |
| 42 |
| 43 pipeline = IdentifyCulpritPipeline(failure_info, change_logs, signals) |
| 44 pipeline.start() |
| 45 self.execute_queued_tasks() |
| 46 |
| 47 analysis = BuildAnalysis.GetBuildAnalysis( |
| 48 master_name, builder_name, build_number) |
| 49 self.assertIsNotNone(analysis) |
| 50 self.assertEqual(dummy_result, analysis.result) |
| 51 self.assertEqual(BuildAnalysisStatus.ANALYZED, analysis.status) |
OLD | NEW |