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

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

Issue 1810683002: [Findit] Fix KeyError when no failed targets are extracted. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | appengine/findit/waterfall/try_job_util.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import wf_analysis_status 7 from model import wf_analysis_status
8 from model.wf_analysis import WfAnalysis 8 from model.wf_analysis import WfAnalysis
9 from model.wf_try_job import WfTryJob 9 from model.wf_try_job import WfTryJob
10 from waterfall import try_job_util 10 from waterfall import try_job_util
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 377
378 try_job = WfTryJob.Get(master_name, builder_name, build_number) 378 try_job = WfTryJob.Get(master_name, builder_name, build_number)
379 379
380 self.assertTrue(_MockRootPipeline.STARTED) 380 self.assertTrue(_MockRootPipeline.STARTED)
381 self.assertIsNotNone(try_job) 381 self.assertIsNotNone(try_job)
382 382
383 def testGetFailedTargetsFromSignals(self): 383 def testGetFailedTargetsFromSignals(self):
384 self.assertEqual( 384 self.assertEqual(
385 try_job_util._GetFailedTargetsFromSignals({}, 'm', 'b'), []) 385 try_job_util._GetFailedTargetsFromSignals({}, 'm', 'b'), [])
386 386
387 self.assertEqual(
388 try_job_util._GetFailedTargetsFromSignals({'compile': {}}, 'm', 'b'),
389 [])
390
387 signals = { 391 signals = {
388 'compile': { 392 'compile': {
389 'failed_targets': [ 393 'failed_targets': [
390 {'target': 'a.exe'}, 394 {'target': 'a.exe'},
391 {'source': 'b.cc', 395 {'source': 'b.cc',
392 'target': 'b.o'}] 396 'target': 'b.o'}]
393 } 397 }
394 } 398 }
395 399
396 self.assertEqual( 400 self.assertEqual(
397 try_job_util._GetFailedTargetsFromSignals(signals, 'm', 'b'), ['a.exe']) 401 try_job_util._GetFailedTargetsFromSignals(signals, 'm', 'b'), ['a.exe'])
398 402
399 def testUseObjectFilesAsFailedTargetIfStrictRegexUsed(self): 403 def testUseObjectFilesAsFailedTargetIfStrictRegexUsed(self):
400 def Mocked_EnableStrictRegexForCompileLinkFailures(*_): 404 def Mocked_EnableStrictRegexForCompileLinkFailures(*_):
401 return True 405 return True
402 self.mock(waterfall_config, 'EnableStrictRegexForCompileLinkFailures', 406 self.mock(waterfall_config, 'EnableStrictRegexForCompileLinkFailures',
403 Mocked_EnableStrictRegexForCompileLinkFailures) 407 Mocked_EnableStrictRegexForCompileLinkFailures)
404 408
405 signals = { 409 signals = {
406 'compile': { 410 'compile': {
407 'failed_targets': [ 411 'failed_targets': [
408 {'source': 'b.cc', 'target': 'b.o'}, 412 {'source': 'b.cc', 'target': 'b.o'},
409 ] 413 ]
410 } 414 }
411 } 415 }
412 416
413 self.assertEqual( 417 self.assertEqual(
414 try_job_util._GetFailedTargetsFromSignals(signals, 'm', 'b'), ['b.o']) 418 try_job_util._GetFailedTargetsFromSignals(signals, 'm', 'b'), ['b.o'])
OLDNEW
« no previous file with comments | « no previous file | appengine/findit/waterfall/try_job_util.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698