Bug 1678421 - Better fail heading for crashes, when possible (#6917)

This commit is contained in:
Cameron Dawson 2020-12-18 15:08:02 -08:00 коммит произвёл GitHub
Родитель cfcf1aa12e
Коммит 26079021e5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 11 добавлений и 21 удалений

Просмотреть файл

@ -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(

Просмотреть файл

@ -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

Просмотреть файл

@ -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 ''

Просмотреть файл

@ -246,7 +246,7 @@ class Test extends PureComponent {
>
<FontAwesomeIcon
icon={detailsShowing ? faCaretDown : faCaretRight}
className="mr-2 min-width-1"
className="mr-2 min-width-1 mt-1"
/>
</Button>
<Button