def testGroupTestsWithRelatedStepsWithoutHeuristicResult(self): master_name = 'm1' builder_name = 'b' build_number = 1 master_name_2 = 'm2' blame_list = ['a'] failed_steps = { 'step_a': { 'current_failure': 3, 'first_failure': 2, 'last_pass': 1 } } WfAnalysis.Create(master_name, builder_name, build_number).put() # Run pipeline with signals that have certain failed steps. # Observe new group creation. self.assertTrue( try_job_util._IsBuildFailureUniqueAcrossPlatforms( master_name, builder_name, build_number, failure_type.TEST, blame_list, failed_steps, None, None)) self.assertIsNotNone( WfFailureGroup.Get(master_name, builder_name, build_number)) WfAnalysis.Create(master_name_2, builder_name, build_number).put() # Run pipeline with signals that have the same failed steps. # Observe no new group creation. self.assertFalse( try_job_util._IsBuildFailureUniqueAcrossPlatforms( master_name_2, builder_name, build_number, failure_type.TEST, blame_list, failed_steps, None, None)) self.assertIsNone( WfFailureGroup.Get(master_name_2, builder_name, build_number))
def testDoNotGroupTestsWithDisjointBlameLists(self): master_name = 'm1' builder_name = 'b' build_number = 1 master_name_2 = 'm2' blame_list_1 = ['a'] blame_list_2 = ['b'] failed_steps = { 'step_a': { 'current_failure': 3, 'first_failure': 2, 'last_pass': 1 } } WfAnalysis.Create(master_name, builder_name, build_number).put() # Run pipeline with signals that have certain failed steps. # Observe new group creation. self.assertTrue( try_job_util._IsBuildFailureUniqueAcrossPlatforms( master_name, builder_name, build_number, failure_type.TEST, blame_list_1, failed_steps, None, None)) self.assertIsNotNone( WfFailureGroup.Get(master_name, builder_name, build_number)) WfAnalysis.Create(master_name_2, builder_name, build_number).put() # Run pipeline with signals that have different failed steps. # Observe new group creation. self.assertTrue( try_job_util._IsBuildFailureUniqueAcrossPlatforms( master_name_2, builder_name, build_number, failure_type.TEST, blame_list_2, failed_steps, None, None)) self.assertTrue( WfFailureGroup.Get(master_name_2, builder_name, build_number))
def testDoNotGroupCompilesWithDifferentOutputNodes(self): master_name = 'm1' builder_name = 'b' build_number = 1 master_name_2 = 'm2' blame_list = ['a'] signals_1 = {'compile': {'failed_output_nodes': ['abc.obj']}} signals_2 = {'compile': {'failed_output_nodes': ['def.obj']}} WfAnalysis.Create(master_name, builder_name, build_number).put() # Run pipeline with signals that have certain failed output nodes. # Observe new group creation. self.assertTrue( try_job_util._IsBuildFailureUniqueAcrossPlatforms( master_name, builder_name, build_number, failure_type.COMPILE, blame_list, None, signals_1, None)) self.assertIsNotNone( WfFailureGroup.Get(master_name, builder_name, build_number)) WfAnalysis.Create(master_name_2, builder_name, build_number).put() # Run pipeline with signals that have different failed output nodes. # Observe new group creation. self.assertTrue( try_job_util._IsBuildFailureUniqueAcrossPlatforms( master_name_2, builder_name, build_number, failure_type.COMPILE, blame_list, None, signals_2, None)) self.assertTrue( WfFailureGroup.Get(master_name_2, builder_name, build_number))
def testGroupCompilesWithRelatedFailuresWithoutHeuristicResult(self): master_name = 'm1' builder_name = 'b' build_number = 1 master_name_2 = 'm2' blame_list = ['a'] signals = {'compile': {'failed_output_nodes': ['abc.obj']}} WfAnalysis.Create(master_name, builder_name, build_number).put() # Run pipeline with signals that have certain failed output nodes. # Observe new group creation. self.assertTrue( try_job_util._IsBuildFailureUniqueAcrossPlatforms( master_name, builder_name, build_number, failure_type.COMPILE, blame_list, None, signals, None)) self.assertIsNotNone( WfFailureGroup.Get(master_name, builder_name, build_number)) WfAnalysis.Create(master_name_2, builder_name, build_number).put() # Run pipeline with signals that have the same failed output nodes. # Observe no new group creation. self.assertFalse( try_job_util._IsBuildFailureUniqueAcrossPlatforms( master_name_2, builder_name, build_number, failure_type.COMPILE, blame_list, None, signals, None)) self.assertIsNone( WfFailureGroup.Get(master_name_2, builder_name, build_number))
def testSecondAnalysisFailureGroupKeySet(self): master_name = 'm1' builder_name = 'b' build_number = 1 master_name_2 = 'm2' blame_list = ['a'] signals = {'compile': {'failed_output_nodes': ['abc.obj']}} WfAnalysis.Create(master_name, builder_name, build_number).put() # Run pipeline with signals that have certain failed output nodes. # Observe new group creation. self.assertTrue( try_job_util._IsBuildFailureUniqueAcrossPlatforms( master_name, builder_name, build_number, failure_type.COMPILE, blame_list, None, signals, None)) WfAnalysis.Create(master_name_2, builder_name, build_number).put() # Run pipeline with signals that have the same failed output nodes. # Observe no new group creation. self.assertFalse( try_job_util._IsBuildFailureUniqueAcrossPlatforms( master_name_2, builder_name, build_number, failure_type.COMPILE, blame_list, None, signals, None)) analysis_2 = WfAnalysis.Get(master_name_2, builder_name, build_number) self.assertEqual([master_name, builder_name, build_number], analysis_2.failure_group_key)
def testDoNotGroupTestsWithDifferentHeuristicResults(self): master_name = 'm1' builder_name = 'b' build_number = 1 master_name_2 = 'm2' blame_list = ['a'] failed_steps = { 'step_a': { 'current_failure': 3, 'first_failure': 2, 'last_pass': 1 } } heuristic_result_1 = { 'failures': [{ 'step_name': 'step1', 'suspected_cls': [{ 'revision': 'rev1', }], }] } heuristic_result_2 = { 'failures': [{ 'step_name': 'step1', 'suspected_cls': [{ 'revision': 'rev2', }], }] } WfAnalysis.Create(master_name, builder_name, build_number).put() # Run pipeline with signals that have certain failed steps. # Observe new group creation. self.assertTrue( try_job_util._IsBuildFailureUniqueAcrossPlatforms( master_name, builder_name, build_number, failure_type.TEST, blame_list, failed_steps, None, heuristic_result_1)) self.assertIsNotNone( WfFailureGroup.Get(master_name, builder_name, build_number)) WfAnalysis.Create(master_name_2, builder_name, build_number).put() # Run pipeline with signals that have different failed steps. # Observe new group creation. self.assertTrue( try_job_util._IsBuildFailureUniqueAcrossPlatforms( master_name_2, builder_name, build_number, failure_type.TEST, blame_list, failed_steps, None, heuristic_result_2)) self.assertTrue( WfFailureGroup.Get(master_name_2, builder_name, build_number))
def testDoNotGroupCompilesWithDifferentHeuristicResults(self): master_name = 'm1' builder_name = 'b' build_number = 1 master_name_2 = 'm2' blame_list = ['a'] signals = {'compile': {'failed_output_nodes': ['abc.obj']}} heuristic_result_1 = { 'failures': [{ 'step_name': 'step1', 'suspected_cls': [{ 'revision': 'rev1', }], }] } heuristic_result_2 = { 'failures': [{ 'step_name': 'step1', 'suspected_cls': [{ 'revision': 'rev2', }], }] } WfAnalysis.Create(master_name, builder_name, build_number).put() # Run pipeline with signals that have certain failed output nodes. # Observe new group creation. self.assertTrue( try_job_util._IsBuildFailureUniqueAcrossPlatforms( master_name, builder_name, build_number, failure_type.COMPILE, blame_list, None, signals, heuristic_result_1)) self.assertIsNotNone( WfFailureGroup.Get(master_name, builder_name, build_number)) WfAnalysis.Create(master_name_2, builder_name, build_number).put() # Run pipeline with signals that have different failed output nodes. # Observe new group creation. self.assertTrue( try_job_util._IsBuildFailureUniqueAcrossPlatforms( master_name_2, builder_name, build_number, failure_type.COMPILE, blame_list, None, signals, heuristic_result_2)) self.assertTrue( WfFailureGroup.Get(master_name_2, builder_name, build_number))
def testDoNotGroupInfraBuildFailure(self): master_name = 'm1' builder_name = 'b' build_number = 1 WfAnalysis.Create(master_name, builder_name, build_number).put() # Run pipeline with INFRA failure. # Observe that the build failure is unique, but there is no new group # creation. self.assertTrue( try_job_util._IsBuildFailureUniqueAcrossPlatforms( master_name, builder_name, build_number, failure_type.INFRA, None, None, None, None)) self.assertIsNone( WfFailureGroup.Get(master_name, builder_name, build_number))
def testDoNotGroupTestWithNoSteps(self): master_name = 'm1' builder_name = 'b' build_number = 1 blame_list = ['a'] failed_steps = {} WfAnalysis.Create(master_name, builder_name, build_number).put() # Run pipeline with signals that have zero failed steps. # Observe that the build failure is unique, but there is no new group # creation. self.assertTrue( try_job_util._IsBuildFailureUniqueAcrossPlatforms( master_name, builder_name, build_number, failure_type.TEST, blame_list, failed_steps, None, None)) self.assertIsNone( WfFailureGroup.Get(master_name, builder_name, build_number))
def testDoNotGroupCompileWithNoOutputNodes(self): master_name = 'm1' builder_name = 'b' build_number = 1 blame_list = ['a'] signals = {'compile': {'failed_output_nodes': []}} WfAnalysis.Create(master_name, builder_name, build_number).put() # Run pipeline with signals that have zero failed output nodes. # Observe that the build failure is unique, but there is no new group # creation. self.assertTrue( try_job_util._IsBuildFailureUniqueAcrossPlatforms( master_name, builder_name, build_number, failure_type.COMPILE, blame_list, None, signals, None)) self.assertIsNone( WfFailureGroup.Get(master_name, builder_name, build_number))