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

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

Issue 2302223002: [Findit] Change the criteria of sending notification to code review. (Closed)
Patch Set: Created 4 years, 3 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 common.git_repository import GitRepository 7 from common.git_repository import GitRepository
8 from common.waterfall import failure_type 8 from common.waterfall import failure_type
9 from model import analysis_status 9 from model import analysis_status
10 from model import result_status 10 from model import result_status
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 'Test1': { 924 'Test1': {
925 'revision': 'rev1' 925 'revision': 'rev1'
926 } 926 }
927 } 927 }
928 } 928 }
929 } 929 }
930 930
931 self.assertEqual(culprit_map, expected_culprit_map) 931 self.assertEqual(culprit_map, expected_culprit_map)
932 self.assertEqual(failed_revisions, ['rev1']) 932 self.assertEqual(failed_revisions, ['rev1'])
933 933
934 def testReturnNoneIfNoTryJob(self):
935 master_name = 'm'
936 builder_name = 'b'
937 build_number = 8
938
939 try_job = WfTryJob.Create(master_name, builder_name, build_number).put()
940 pipeline = IdentifyTryJobCulpritPipeline()
941 culprit = pipeline.run(master_name, builder_name, build_number, ['rev1'],
942 failure_type.TEST, None, None)
943 self.assertIsNone(culprit)
944
945 try_job = WfTryJob.Get(master_name, builder_name, build_number)
946 self.assertEqual(try_job.test_results, [])
947 self.assertEqual(try_job.status, analysis_status.COMPLETED)
948
949
934 def testNotifyCulprits(self): 950 def testNotifyCulprits(self):
935 instances = [] 951 instances = []
936 class Mocked_SendNotificationForCulpritPipeline(object): 952 class Mocked_SendNotificationForCulpritPipeline(object):
937 def __init__(self, *args): 953 def __init__(self, *args):
938 self.args = args 954 self.args = args
939 self.started = False 955 self.started = False
940 instances.append(self) 956 instances.append(self)
941 957
942 def start(self): 958 def start(self):
943 self.started = True 959 self.started = True
944 960
945 self.mock( 961 self.mock(
946 identify_try_job_culprit_pipeline, 'SendNotificationForCulpritPipeline', 962 identify_try_job_culprit_pipeline, 'SendNotificationForCulpritPipeline',
947 Mocked_SendNotificationForCulpritPipeline) 963 Mocked_SendNotificationForCulpritPipeline)
948 964
949 culprits = { 965 culprits = {
950 'r1': { 966 'r1': {
951 'repo_name': 'chromium', 967 'repo_name': 'chromium',
952 'revision': 'r1', 968 'revision': 'r1',
953 } 969 }
954 } 970 }
971 heuristic_cls = [('chromium', 'r1')]
955 972
956 identify_try_job_culprit_pipeline._NotifyCulprits('m', 'b', 1, culprits) 973
974 identify_try_job_culprit_pipeline._NotifyCulprits(
975 'm', 'b', 1, culprits, heuristic_cls)
957 self.assertEqual(1, len(instances)) 976 self.assertEqual(1, len(instances))
958 self.assertTrue(instances[0].started) 977 self.assertTrue(instances[0].started)
959
960 def testReturnNoneIfNoTryJob(self):
961 master_name = 'm'
962 builder_name = 'b'
963 build_number = 8
964
965 try_job = WfTryJob.Create(master_name, builder_name, build_number).put()
966 pipeline = IdentifyTryJobCulpritPipeline()
967 culprit = pipeline.run(master_name, builder_name, build_number, ['rev1'],
968 failure_type.TEST, None, None)
969 self.assertIsNone(culprit)
970
971 try_job = WfTryJob.Get(master_name, builder_name, build_number)
972 self.assertEqual(try_job.test_results, [])
973 self.assertEqual(try_job.status, analysis_status.COMPLETED)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698