| 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 import os | 5 import os |
| 6 | 6 |
| 7 from testing_utils import testing | |
| 8 | |
| 9 from common import chromium_deps | 7 from common import chromium_deps |
| 8 from model import wf_analysis_status |
| 10 from model.wf_analysis import WfAnalysis | 9 from model.wf_analysis import WfAnalysis |
| 11 from model import wf_analysis_status | |
| 12 from pipeline_wrapper import pipeline_handlers | 10 from pipeline_wrapper import pipeline_handlers |
| 13 from waterfall import buildbot | 11 from waterfall import buildbot |
| 12 from waterfall import lock_util |
| 14 from waterfall.analyze_build_failure_pipeline import AnalyzeBuildFailurePipeline | 13 from waterfall.analyze_build_failure_pipeline import AnalyzeBuildFailurePipeline |
| 15 from waterfall import lock_util | 14 from waterfall.test import wf_configured_test_case |
| 16 from waterfall import waterfall_config | |
| 17 | 15 |
| 18 | 16 |
| 19 class AnalyzeBuildFailurePipelineTest(testing.AppengineTestCase): | 17 class AnalyzeBuildFailurePipelineTest( |
| 18 wf_configured_test_case.WaterfallConfiguredTestCase): |
| 20 app_module = pipeline_handlers._APP | 19 app_module = pipeline_handlers._APP |
| 21 | 20 |
| 22 def _MockChangeLog( | 21 def _MockChangeLog( |
| 23 self, urlfetch, user_name, revision, commit_position, file_path): | 22 self, urlfetch, user_name, revision, commit_position, file_path): |
| 24 url = ('https://chromium.googlesource.com/chromium/src.git/+/%s?format=json' | 23 url = ('https://chromium.googlesource.com/chromium/src.git/+/%s?format=json' |
| 25 % revision) | 24 % revision) |
| 26 | 25 |
| 27 COMMIT_LOG_TEMPLATE = """)]}' | 26 COMMIT_LOG_TEMPLATE = """)]}' |
| 28 { | 27 { |
| 29 "commit": "REVISION", | 28 "commit": "REVISION", |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 return {} | 96 return {} |
| 98 self.mock(chromium_deps, 'GetChromeDependency', MockGetChromeDependency) | 97 self.mock(chromium_deps, 'GetChromeDependency', MockGetChromeDependency) |
| 99 | 98 |
| 100 def testBuildFailurePipeline(self): | 99 def testBuildFailurePipeline(self): |
| 101 master_name = 'm' | 100 master_name = 'm' |
| 102 builder_name = 'b' | 101 builder_name = 'b' |
| 103 build_number = 124 | 102 build_number = 124 |
| 104 | 103 |
| 105 self._Setup(master_name, builder_name, build_number) | 104 self._Setup(master_name, builder_name, build_number) |
| 106 | 105 |
| 107 def MockStepIsSupportedForMaster(*_): | |
| 108 return True | |
| 109 | |
| 110 self.mock(waterfall_config, | |
| 111 'StepIsSupportedForMaster', | |
| 112 MockStepIsSupportedForMaster) | |
| 113 | |
| 114 root_pipeline = AnalyzeBuildFailurePipeline(master_name, | 106 root_pipeline = AnalyzeBuildFailurePipeline(master_name, |
| 115 builder_name, | 107 builder_name, |
| 116 build_number, | 108 build_number, |
| 117 False) | 109 False) |
| 118 root_pipeline.start(queue_name='default') | 110 root_pipeline.start(queue_name='default') |
| 119 self.execute_queued_tasks() | 111 self.execute_queued_tasks() |
| 120 | 112 |
| 121 expected_analysis_result = { | 113 expected_analysis_result = { |
| 122 'failures': [ | 114 'failures': [ |
| 123 { | 115 { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 199 |
| 208 root_pipeline = AnalyzeBuildFailurePipeline(master_name, | 200 root_pipeline = AnalyzeBuildFailurePipeline(master_name, |
| 209 builder_name, | 201 builder_name, |
| 210 build_number, | 202 build_number, |
| 211 False) | 203 False) |
| 212 root_pipeline._LogUnexpectedAborting(False) | 204 root_pipeline._LogUnexpectedAborting(False) |
| 213 | 205 |
| 214 analysis = WfAnalysis.Get(master_name, builder_name, build_number) | 206 analysis = WfAnalysis.Get(master_name, builder_name, build_number) |
| 215 self.assertIsNotNone(analysis) | 207 self.assertIsNotNone(analysis) |
| 216 self.assertNotEqual(wf_analysis_status.ERROR, analysis.status) | 208 self.assertNotEqual(wf_analysis_status.ERROR, analysis.status) |
| OLD | NEW |