From 26079021e586717c8e9889e208728883973f4168 Mon Sep 17 00:00:00 2001 From: Cameron Dawson Date: Fri, 18 Dec 2020 15:08:02 -0800 Subject: [PATCH] Bug 1678421 - Better fail heading for crashes, when possible (#6917) --- tests/push_health/test_utils.py | 8 ++++---- treeherder/push_health/tests.py | 12 ++++-------- treeherder/push_health/utils.py | 10 ++-------- ui/push-health/Test.jsx | 2 +- 4 files changed, 11 insertions(+), 21 deletions(-) diff --git a/tests/push_health/test_utils.py b/tests/push_health/test_utils.py index e3f1dfb6a..d4cb21e62 100644 --- a/tests/push_health/test_utils.py +++ b/tests/push_health/test_utils.py @@ -12,9 +12,9 @@ from treeherder.push_health.utils import ( ('action', 'test', 'signature', 'message', 'expected'), [ ('test_result', 'dis/dat/da/odder/ting', 'sig', 'mess', 'dis/dat/da/odder/ting'), - ('crash', 'dis/dat/da/odder/ting', 'sig', 'mess', 'sig'), - ('log', 'dis/dat/da/odder/ting', 'sig', 'mess', 'mess'), - ('meh', 'dis/dat/da/odder/ting', 'sig', 'mess', 'Non-Test Error'), + ('crash', None, 'sig', 'mess', 'sig'), + ('log', None, None, 'mess', 'mess'), + ('meh', None, None, None, 'Non-Test Error'), ('test_result', 'pid:dis/dat/da/odder/ting', 'sig', 'mess', None), ( 'test_result', @@ -55,7 +55,7 @@ from treeherder.push_health.utils import ( ], ) def test_clean_test(action, test, signature, message, expected): - assert expected == clean_test(action, test, signature, message) + assert expected == clean_test(test, signature, message) @pytest.mark.parametrize( diff --git a/treeherder/push_health/tests.py b/treeherder/push_health/tests.py index 3b9629471..a60304fde 100644 --- a/treeherder/push_health/tests.py +++ b/treeherder/push_health/tests.py @@ -59,11 +59,9 @@ def get_history( ) previous_failures = defaultdict(lambda: defaultdict(lambda: defaultdict(int))) for line in failure_lines: - previous_failures[ - clean_test(line['action'], line['test'], line['signature'], line['message']) - ][clean_platform(line['job_log__job__machine_platform__platform'])][ - clean_config(option_map[line['job_log__job__option_collection_hash']]) - ] += 1 + previous_failures[clean_test(line['test'], line['signature'], line['message'])][ + clean_platform(line['job_log__job__machine_platform__platform']) + ][clean_config(option_map[line['job_log__job__option_collection_hash']])] += 1 cache.set(cache_key, json.dumps(previous_failures), ONE_WEEK_IN_SECONDS) else: @@ -95,9 +93,7 @@ def get_current_test_failures(push, option_map, jobs, investigatedTests=None): tests = {} all_failed_jobs = {} for failure_line in new_failure_lines: - test_name = clean_test( - failure_line.action, failure_line.test, failure_line.signature, failure_line.message - ) + test_name = clean_test(failure_line.test, failure_line.signature, failure_line.message) if not test_name: continue job = failure_line.job_log.job diff --git a/treeherder/push_health/utils.py b/treeherder/push_health/utils.py index 5ad56fb64..3c7ba51b3 100644 --- a/treeherder/push_health/utils.py +++ b/treeherder/push_health/utils.py @@ -8,15 +8,9 @@ trim_parts = [ ] -def clean_test(action, test, signature, message): +def clean_test(test, signature, message): try: - clean_name = 'Non-Test Error' - if action == 'test_result': - clean_name = test - elif action == 'crash': - clean_name = signature - elif action == 'log': - clean_name = message + clean_name = test or signature or message or 'Non-Test Error' except UnicodeEncodeError: return '' diff --git a/ui/push-health/Test.jsx b/ui/push-health/Test.jsx index 2a4491384..36585f2ab 100644 --- a/ui/push-health/Test.jsx +++ b/ui/push-health/Test.jsx @@ -246,7 +246,7 @@ class Test extends PureComponent { >