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

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

Issue 1926573002: [Findit] Adding test to improve code coverage (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Fixing unintended change 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 datetime 5 import datetime
6 import json 6 import json
7 import os 7 import os
8 import urllib 8 import urllib
9 import zlib 9 import zlib
10 10
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 } 662 }
663 663
664 for n in xrange(223, 220, -1): 664 for n in xrange(223, 220, -1):
665 step = WfStep.Get(master_name, builder_name, n, 'abc_test') 665 step = WfStep.Get(master_name, builder_name, n, 'abc_test')
666 self.assertIsNotNone(step) 666 self.assertIsNotNone(step)
667 self.assertTrue(step.isolated) 667 self.assertTrue(step.isolated)
668 self.assertEqual(expected_step_log_data[n], step.log_data) 668 self.assertEqual(expected_step_log_data[n], step.log_data)
669 669
670 self.assertEqual(expected_failed_steps, failure_info['failed_steps']) 670 self.assertEqual(expected_failed_steps, failure_info['failed_steps'])
671 671
672 def testRunPipelineForCompileFailure(self):
673 def _MockExtractBuildInfo(*_):
674 build_info = BuildInfo('m', 'b', 25409)
675 build_info.failed_steps = {
676 'compile': {
677 'last_pass': '25408',
678 'current_failure': '25409',
679 'first_failure': '25409'
680 }
681 }
682 return build_info
683
684 self.mock(DetectFirstFailurePipeline, '_ExtractBuildInfo',
685 _MockExtractBuildInfo)
686
687 self._CreateAndSaveWfAnanlysis('m', 'b', 25409, analysis_status.RUNNING)
688 pipeline = DetectFirstFailurePipeline()
689 failure_info = pipeline.run('m', 'b', 25409)
690
691 expected_failure_info = {
692 'failed': True,
693 'master_name': 'm',
694 'builder_name': 'b',
695 'build_number': 25409,
696 'chromium_revision': None,
697 'builds': {
698 25409: {
699 'blame_list': [],
700 'chromium_revision': None
701 }
702 },
703 'failed_steps': {
704 'compile': {
705 'current_failure': 25409,
706 'first_failure': 25409
707 }
708 },
709 'failure_type': failure_type.COMPILE
710 }
711
712 self.assertEqual(failure_info, expected_failure_info)
713
672 def testGetFailureType(self): 714 def testGetFailureType(self):
673 cases = { 715 cases = {
674 failure_type.UNKNOWN: [], 716 failure_type.UNKNOWN: [],
675 failure_type.COMPILE: ['compile', 'slave_steps'], 717 failure_type.COMPILE: ['compile', 'slave_steps'],
676 failure_type.TEST: ['browser_tests'], 718 failure_type.TEST: ['browser_tests'],
677 } 719 }
678 for expected_type, failed_steps in cases.iteritems(): 720 for expected_type, failed_steps in cases.iteritems():
679 build_info = BuildInfo('m', 'b', 123) 721 build_info = BuildInfo('m', 'b', 123)
680 build_info.failed_steps = failed_steps 722 build_info.failed_steps = failed_steps
681 self.assertEqual( 723 self.assertEqual(
682 expected_type, DetectFirstFailurePipeline._GetFailureType(build_info)) 724 expected_type, DetectFirstFailurePipeline._GetFailureType(build_info))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698