def testGetFailedStepsForEachCL(self): analysis = WfAnalysis.Create('m', 'b', 0) analysis.result = { 'failures': [{ 'step_name': 'a', 'first_failure': 3, 'last_pass': None, 'suspected_cls': [{ 'repo_name': 'chromium', 'revision': 'r99_1', 'commit_position': 123, 'url': None, 'score': 5, 'hints': { 'added x/y/f99_1.cc (and it was in log)': 5, } }], }, { 'step_name': 'b', 'first_failure': 2, 'last_pass': None, 'suspected_cls': [], }] } expected_failed_steps = {'chromium,r99_1': ['a']} failed_steps = check_duplicate_failures._GetFailedStepsForEachCL( analysis) self.assertEqual(expected_failed_steps, failed_steps)
def testGetFailedStepsForEachCL(self): analysis = WfAnalysis.Create('m', 'b', 0) analysis.result = { 'failures': [ { 'step_name': 'a', 'first_failure': 3, 'last_pass': None, 'suspected_cls': [{ 'repo_name': 'chromium', 'revision': 'r99_1', 'commit_position': 123, 'url': None, 'score': 5, 'hints': { 'added x/y/f99_1.cc (and it was in log)': 5, } }], }, { 'step_name': 'b', 'first_failure': 2, 'last_pass': None, 'suspected_cls': [], } ] } expected_failed_steps = { 'chromium,r99_1': ['a'] } failed_steps = check_duplicate_failures._GetFailedStepsForEachCL(analysis) self.assertEqual(expected_failed_steps, failed_steps)
def testGetFailedStepsForEachCLNoFailures(self): analysis = WfAnalysis.Create('m', 'b', 0) analysis.result = {'failures': []} analysis.result_status = result_status.FOUND_UNTRIAGED analysis.put() failed_steps = check_duplicate_failures._GetFailedStepsForEachCL( analysis) self.assertEqual({}, failed_steps)
def testGetFailedStepsForEachCLNoFailures(self): analysis = WfAnalysis.Create('m', 'b', 0) analysis.result = { 'failures': [] } analysis.result_status = wf_analysis_result_status.FOUND_UNTRIAGED analysis.put() failed_steps = check_duplicate_failures._GetFailedStepsForEachCL(analysis) self.assertEqual({}, failed_steps)