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

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

Issue 1912243003: [Findit] Add more tests to improve code coverage. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: 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 | « appengine/findit/waterfall/detect_first_failure_pipeline.py ('k') | 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
11 from common.http_client_appengine import HttpClientAppengine as HttpClient 11 from common.http_client_appengine import HttpClientAppengine as HttpClient
12 from common.pipeline_wrapper import pipeline_handlers 12 from common.pipeline_wrapper import pipeline_handlers
13 from common.waterfall import failure_type
13 from model import analysis_status 14 from model import analysis_status
14 from model.wf_analysis import WfAnalysis 15 from model.wf_analysis import WfAnalysis
15 from model.wf_build import WfBuild 16 from model.wf_build import WfBuild
16 from model.wf_step import WfStep 17 from model.wf_step import WfStep
17 from waterfall import buildbot 18 from waterfall import buildbot
18 from waterfall import lock_util 19 from waterfall import lock_util
19 from waterfall import swarming_util 20 from waterfall import swarming_util
21 from waterfall.build_info import BuildInfo
20 from waterfall.detect_first_failure_pipeline import DetectFirstFailurePipeline 22 from waterfall.detect_first_failure_pipeline import DetectFirstFailurePipeline
21 from waterfall.test import wf_testcase 23 from waterfall.test import wf_testcase
22 24
23 25
24 class DetectFirstFailureTest(wf_testcase.WaterfallTestCase): 26 class DetectFirstFailureTest(wf_testcase.WaterfallTestCase):
25 app_module = pipeline_handlers._APP 27 app_module = pipeline_handlers._APP
26 28
27 def setUp(self): 29 def setUp(self):
28 super(DetectFirstFailureTest, self).setUp() 30 super(DetectFirstFailureTest, self).setUp()
29 31
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 221: '{"Unittest3.Subtest3": "YS9iL3UzczIuY2M6MTEwOiBGYWlsdXJlCg=="}' 661 221: '{"Unittest3.Subtest3": "YS9iL3UzczIuY2M6MTEwOiBGYWlsdXJlCg=="}'
660 } 662 }
661 663
662 for n in xrange(223, 220, -1): 664 for n in xrange(223, 220, -1):
663 step = WfStep.Get(master_name, builder_name, n, 'abc_test') 665 step = WfStep.Get(master_name, builder_name, n, 'abc_test')
664 self.assertIsNotNone(step) 666 self.assertIsNotNone(step)
665 self.assertTrue(step.isolated) 667 self.assertTrue(step.isolated)
666 self.assertEqual(expected_step_log_data[n], step.log_data) 668 self.assertEqual(expected_step_log_data[n], step.log_data)
667 669
668 self.assertEqual(expected_failed_steps, failure_info['failed_steps']) 670 self.assertEqual(expected_failed_steps, failure_info['failed_steps'])
671
672 def testGetFailureType(self):
673 cases = {
674 failure_type.UNKNOWN: [],
675 failure_type.COMPILE: ['compile', 'slave_steps'],
676 failure_type.TEST: ['browser_tests'],
677 }
678 for expected_type, failed_steps in cases.iteritems():
679 build_info = BuildInfo('m', 'b', 123)
680 build_info.failed_steps = failed_steps
681 self.assertEqual(
682 expected_type, DetectFirstFailurePipeline._GetFailureType(build_info))
OLDNEW
« no previous file with comments | « appengine/findit/waterfall/detect_first_failure_pipeline.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698