| Index: appengine/findit/waterfall/test/identify_culprit_pipeline_test.py
|
| diff --git a/appengine/findit/waterfall/test/identify_culprit_pipeline_test.py b/appengine/findit/waterfall/test/identify_culprit_pipeline_test.py
|
| index 9d4bcdce1ff46ea75beaac3819d3292587289184..b9bf73938a1aac4148ff73bdbe7ae804d3a8b186 100644
|
| --- a/appengine/findit/waterfall/test/identify_culprit_pipeline_test.py
|
| +++ b/appengine/findit/waterfall/test/identify_culprit_pipeline_test.py
|
| @@ -238,3 +238,113 @@ class IdentifyCulpritPipelineTest(testing.AppengineTestCase):
|
| self.assertEqual(analysis_status.COMPLETED, analysis.status)
|
| self.assertIsNone(analysis.result_status)
|
| self.assertEqual(expected_suspected_cls, analysis.suspected_cls)
|
| +
|
| + def testGetSuspectedCLFoundByHeuristicForCompile(self):
|
| + master_name = 'm'
|
| + builder_name = 'b'
|
| + build_number = 9
|
| + analysis = WfAnalysis.Create(master_name, builder_name, build_number)
|
| + analysis.result = {
|
| + 'failures': [
|
| + {
|
| + 'step_name': 'other_step',
|
| + 'suspected_cls': [
|
| + {
|
| + 'repo_name': 'chromium',
|
| + 'revision': 'rev1'
|
| + }
|
| + ]
|
| + },
|
| + {
|
| + 'step_name': 'compile',
|
| + 'suspected_cls': [
|
| + {
|
| + 'repo_name': 'chromium',
|
| + 'revision': 'rev1'
|
| + }
|
| + ]
|
| + }
|
| + ]
|
| + }
|
| + analysis.put()
|
| +
|
| + cl = (identify_culprit_pipeline. \
|
| + _GetSuspectedCLFoundByHeuristicForCompile(analysis))
|
| +
|
| + expected_cl = {
|
| + 'repo_name': 'chromium',
|
| + 'revision': 'rev1'
|
| + }
|
| +
|
| + self.assertEqual(cl, expected_cl)
|
| +
|
| +
|
| + def testGetSuspectedCLFoundByHeuristicForCompileReturnNoneIfNoAnalysis(self):
|
| + self.assertIsNone(identify_culprit_pipeline. \
|
| + _GetSuspectedCLFoundByHeuristicForCompile(None))
|
| +
|
| +
|
| + def testGetSuspectedCLFoundByHeuristicForCompileReturnNone(self):
|
| + master_name = 'm'
|
| + builder_name = 'b'
|
| + build_number = 9
|
| + analysis = WfAnalysis.Create(master_name, builder_name, build_number)
|
| + analysis.result = {
|
| + 'failures': [
|
| + {
|
| + 'step_name': 'other_step',
|
| + 'suspected_cls': [
|
| + {
|
| + 'repo_name': 'chromium',
|
| + 'revision': 'rev1'
|
| + }
|
| + ]
|
| + }
|
| + ]
|
| + }
|
| + analysis.put()
|
| +
|
| + self.assertIsNone(identify_culprit_pipeline. \
|
| + _GetSuspectedCLFoundByHeuristicForCompile(analysis))
|
| +
|
| +
|
| +
|
| + def testNotifyCulpritsIfHeuristicFoundCulpritForCompile(self):
|
| + master_name = 'm'
|
| + builder_name = 'b'
|
| + build_number = 9
|
| + analysis = WfAnalysis.Create(master_name, builder_name, build_number)
|
| + analysis.result = {
|
| + 'failures': [
|
| + {
|
| + 'step_name': 'compile',
|
| + 'suspected_cls': [
|
| + {
|
| + 'repo_name': 'chromium',
|
| + 'revision': 'rev1'
|
| + }
|
| + ]
|
| + }
|
| + ]
|
| + }
|
| + analysis.put()
|
| +
|
| + instances = []
|
| + class Mocked_SendNotificationForCulpritPipeline(object):
|
| + def __init__(self, *args):
|
| + self.args = args
|
| + self.started = False
|
| + instances.append(self)
|
| +
|
| + def start(self):
|
| + self.started = True
|
| +
|
| + self.mock(
|
| + identify_culprit_pipeline, 'SendNotificationForCulpritPipeline',
|
| + Mocked_SendNotificationForCulpritPipeline)
|
| +
|
| +
|
| + identify_culprit_pipeline._NotifyCompileCulprits(
|
| + master_name, builder_name, build_number, analysis)
|
| + self.assertEqual(1, len(instances))
|
| + self.assertTrue(instances[0].started)
|
|
|