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

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

Issue 1154593005: [Findit] Add a sub-pipeline to analyze failures caused by DEPS rolls. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Unittests will be added in next patch. Created 5 years, 6 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 import unittest 5 import unittest
6 6
7 from common.diff import ChangeType 7 from common.diff import ChangeType
8 from waterfall import build_failure_analysis 8 from waterfall import build_failure_analysis
9 from waterfall.failure_signal import FailureSignal 9 from waterfall.failure_signal import FailureSignal
10 10
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 justification = build_failure_analysis._CheckFiles( 144 justification = build_failure_analysis._CheckFiles(
145 FailureSignal.FromDict(failure_signal_json), change_log_json) 145 FailureSignal.FromDict(failure_signal_json), change_log_json)
146 self.assertIsNone(justification) 146 self.assertIsNone(justification)
147 147
148 def testAnalyzeSuccessfulBuild(self): 148 def testAnalyzeSuccessfulBuild(self):
149 failure_info = { 149 failure_info = {
150 'failed': False, 150 'failed': False,
151 } 151 }
152 result = build_failure_analysis.AnalyzeBuildFailure( 152 result = build_failure_analysis.AnalyzeBuildFailure(
153 failure_info, None, None) 153 failure_info, None, None, None)
154 self.assertEqual(0, len(result['failures'])) 154 self.assertEqual(0, len(result['failures']))
155 155
156 def testAnalyzeBuildFailure(self): 156 def testAnalyzeBuildFailure(self):
157 failure_info = { 157 failure_info = {
158 'failed': True, 158 'failed': True,
159 'failed_steps': { 159 'failed_steps': {
160 'a': { 160 'a': {
161 'current_failure': 99, 161 'current_failure': 99,
162 'first_failure': 98, 162 'first_failure': 98,
163 }, 163 },
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 'revision': 'r96_1', 232 'revision': 'r96_1',
233 'touched_files': [ 233 'touched_files': [
234 { 234 {
235 'change_type': ChangeType.MODIFY, 235 'change_type': ChangeType.MODIFY,
236 'old_path': 'a/b/f96_1.cc', 236 'old_path': 'a/b/f96_1.cc',
237 'new_path': 'a/b/f96_1.cc' 237 'new_path': 'a/b/f96_1.cc'
238 }, 238 },
239 ], 239 ],
240 }, 240 },
241 } 241 }
242 deps_info = {
243 'deps_rolls': {},
244 'current_deps': {},
245 }
242 failure_signals_json = { 246 failure_signals_json = {
243 'a': { 247 'a': {
244 'files': { 248 'files': {
245 'src/a/b/f99_2.cc': [], 249 'src/a/b/f99_2.cc': [],
246 }, 250 },
247 }, 251 },
248 'b': { 252 'b': {
249 'files': { 253 'files': {
250 'x/y/f99_1.cc': [], 254 'x/y/f99_1.cc': [],
251 }, 255 },
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 'hints': { 290 'hints': {
287 'added x/y/f99_1.cc (and it was in log)': 5, 291 'added x/y/f99_1.cc (and it was in log)': 5,
288 }, 292 },
289 } 293 }
290 ], 294 ],
291 } 295 }
292 ] 296 ]
293 } 297 }
294 298
295 analysis_result = build_failure_analysis.AnalyzeBuildFailure( 299 analysis_result = build_failure_analysis.AnalyzeBuildFailure(
296 failure_info, change_logs, failure_signals_json) 300 failure_info, change_logs, deps_info, failure_signals_json)
297 self.assertEqual(expected_analysis_result, analysis_result) 301 self.assertEqual(expected_analysis_result, analysis_result)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698