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