Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: appengine/findit/waterfall/test/identify_culprit_pipeline_test.py

Issue 1866883002: [Findit] A huge refactoring and some bug fixing. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Fix nit. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 testing_utils import testing 5 from testing_utils import testing
6 6
7 from model.wf_analysis import WfAnalysis 7 from model.wf_analysis import WfAnalysis
8 from model import wf_analysis_status 8 from model import analysis_status
9 from model import wf_analysis_result_status 9 from model import result_status
10 from pipeline_wrapper import pipeline_handlers 10 from pipeline_wrapper import pipeline_handlers
11 from waterfall import build_failure_analysis 11 from waterfall import build_failure_analysis
12 from waterfall import identify_culprit_pipeline 12 from waterfall import identify_culprit_pipeline
13 13
14 14
15 class IdentifyCulpritPipelineTest(testing.AppengineTestCase): 15 class IdentifyCulpritPipelineTest(testing.AppengineTestCase):
16 app_module = pipeline_handlers._APP 16 app_module = pipeline_handlers._APP
17 17
18 def testGetSuspectedCLs(self): 18 def testGetSuspectedCLs(self):
19 dummy_result = { 19 dummy_result = {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 'score': 5, 164 'score': 5,
165 'hints': { 165 'hints': {
166 'added x/y/f99_1.cc (and it was in log)': 5, 166 'added x/y/f99_1.cc (and it was in log)': 5,
167 }, 167 },
168 } 168 }
169 ], 169 ],
170 } 170 }
171 ] 171 ]
172 } 172 }
173 173
174 self.assertEqual(wf_analysis_result_status.FOUND_UNTRIAGED, 174 self.assertEqual(result_status.FOUND_UNTRIAGED,
175 identify_culprit_pipeline._GetResultAnalysisStatus( 175 identify_culprit_pipeline._GetResultAnalysisStatus(
176 dummy_result)) 176 dummy_result))
177 177
178 def testGetResultAnalysisStatusNotFoundUntriaged(self): 178 def testGetResultAnalysisStatusNotFoundUntriaged(self):
179 dummy_result = { 179 dummy_result = {
180 'failures': [ 180 'failures': [
181 { 181 {
182 'step_name': 'a', 182 'step_name': 'a',
183 'first_failure': 98, 183 'first_failure': 98,
184 'last_pass': None, 184 'last_pass': None,
185 'suspected_cls': [], 185 'suspected_cls': [],
186 }, 186 },
187 { 187 {
188 'step_name': 'b', 188 'step_name': 'b',
189 'first_failure': 98, 189 'first_failure': 98,
190 'last_pass': None, 190 'last_pass': None,
191 'suspected_cls': [], 191 'suspected_cls': [],
192 } 192 }
193 ] 193 ]
194 } 194 }
195 195
196 self.assertEqual(wf_analysis_result_status.NOT_FOUND_UNTRIAGED, 196 self.assertEqual(result_status.NOT_FOUND_UNTRIAGED,
197 identify_culprit_pipeline._GetResultAnalysisStatus( 197 identify_culprit_pipeline._GetResultAnalysisStatus(
198 dummy_result)) 198 dummy_result))
199 199
200 def testIdentifyCulpritPipeline(self): 200 def testIdentifyCulpritPipeline(self):
201 master_name = 'm' 201 master_name = 'm'
202 builder_name = 'b' 202 builder_name = 'b'
203 build_number = 123 203 build_number = 123
204 204
205 analysis = WfAnalysis.Create(master_name, builder_name, build_number) 205 analysis = WfAnalysis.Create(master_name, builder_name, build_number)
206 analysis.result = None 206 analysis.result = None
207 analysis.status = wf_analysis_status.ANALYZING 207 analysis.status = analysis_status.RUNNING
208 analysis.put() 208 analysis.put()
209 209
210 failure_info = { 210 failure_info = {
211 'master_name': master_name, 211 'master_name': master_name,
212 'builder_name': builder_name, 212 'builder_name': builder_name,
213 'build_number': build_number, 213 'build_number': build_number,
214 } 214 }
215 change_logs = {} 215 change_logs = {}
216 deps_info = {} 216 deps_info = {}
217 signals = {} 217 signals = {}
(...skipping 10 matching lines...) Expand all
228 failure_info, change_logs, deps_info, signals, True) 228 failure_info, change_logs, deps_info, signals, True)
229 pipeline.start() 229 pipeline.start()
230 self.execute_queued_tasks() 230 self.execute_queued_tasks()
231 231
232 expected_suspected_cls = [] 232 expected_suspected_cls = []
233 233
234 analysis = WfAnalysis.Get(master_name, builder_name, build_number) 234 analysis = WfAnalysis.Get(master_name, builder_name, build_number)
235 self.assertTrue(analysis.build_completed) 235 self.assertTrue(analysis.build_completed)
236 self.assertIsNotNone(analysis) 236 self.assertIsNotNone(analysis)
237 self.assertEqual(dummy_result, analysis.result) 237 self.assertEqual(dummy_result, analysis.result)
238 self.assertEqual(wf_analysis_status.ANALYZED, analysis.status) 238 self.assertEqual(analysis_status.COMPLETED, analysis.status)
239 self.assertIsNone(analysis.result_status) 239 self.assertIsNone(analysis.result_status)
240 self.assertEqual(expected_suspected_cls, analysis.suspected_cls) 240 self.assertEqual(expected_suspected_cls, analysis.suspected_cls)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698