diff --git a/config/reports/test-report.jinja2 b/config/reports/test-report.jinja2 index 8df11e4df..2ce108ce1 100644 --- a/config/reports/test-report.jinja2 +++ b/config/reports/test-report.jinja2 @@ -11,30 +11,30 @@ Describe: {{ root.revision.describe }} URL: {{ root.revision.url }} SHA1: {{ root.revision.commit }} -{%- if groups.items() %} +{%- if jobs.items() %} {{ '%-17s %s %-8s %s %-8s %s %-8s'|format( "Name", "|", "Result", "|", "Total", "|", "Failures") }} {{ '%s%s%s%s%s%s%s'|format( "-"*18, "+", "-"*10, "+", "-"*10, "+", "-"*9) }} -{%- for group_name, group in groups.items() %} +{%- for job_name, job in jobs.items() %} {{ '%-17s %s %-8s %s %8d %s %8d'|format( -group_name, "|", -group.root.result, "|", -group.nodes, "|", -group.failures|count) }} +job_name, "|", +job.root.result, "|", +job.nodes, "|", +job.failures|count) }} {%- endfor %} Failing tests ============= -{%- for group_name, group in groups.items() %} -{%- if group.failures|count %} +{%- for job_name, job in jobs.items() %} +{%- if job.failures|count %} -{{ group_name }} -{{ '-'*group_name|length }} +{{ job_name }} +{{ '-'*job_name|length }} -{% for failure in group.failures %}* {{ failure.path }} +{% for failure in job.failures %}* {{ failure.path }} {% endfor %} {%- endif %} {%- endfor %} diff --git a/src/test_report.py b/src/test_report.py index 56d44e012..b15608c31 100755 --- a/src/test_report.py +++ b/src/test_report.py @@ -37,37 +37,37 @@ def __init__(self, configs, args): def _dump_report(self, content): print(content, flush=True) - def _get_group_stats(self, groups_data): + def _get_job_stats(self, jobs_data): failures = 0 - for _, group in groups_data.items(): - if group['root']['result'] == 'fail': + for _, job in jobs_data.items(): + if job['root']['result'] == 'fail': failures += 1 return { - 'total': len(groups_data), + 'total': len(jobs_data), 'failures': failures, } - def _get_group_data(self, checkout_node, group): + def _get_job_data(self, checkout_node, job): revision = checkout_node['revision'] root_node = self._api.get_nodes({ 'revision.commit': revision['commit'], 'revision.tree': revision['tree'], 'revision.branch': revision['branch'], - 'name': group, + 'name': job, })[0] - group_nodes = self._api.count_nodes({ + job_nodes = self._api.count_nodes({ 'revision.commit': revision['commit'], 'revision.tree': revision['tree'], 'revision.branch': revision['branch'], - 'group': group, + 'group': job, }) failures = self._api.get_nodes({ 'revision.commit': revision['commit'], 'revision.tree': revision['tree'], 'revision.branch': revision['branch'], - 'group': group, + 'group': job, 'result': 'fail', }) failures = [ @@ -79,10 +79,10 @@ def _get_group_data(self, checkout_node, group): if node['id'] == root_node['id']: parent_path_len = len(checkout_node['path']) node['path'] = '.'.join(node['path'][parent_path_len:]) - return {'root': root_node, 'nodes': group_nodes, 'failures': failures} + return {'root': root_node, 'nodes': job_nodes, 'failures': failures} - def _get_groups(self, root_node): - groups = [] + def _get_jobs(self, root_node): + jobs = [] revision = root_node['revision'] nodes = self._api.get_nodes({ 'revision.commit': revision['commit'], @@ -90,21 +90,21 @@ def _get_groups(self, root_node): 'revision.branch': revision['branch'] }) for node in nodes: - if node['group'] and node['group'] not in groups: - groups.append(node['group']) - return groups + if node['group'] and node['group'] not in jobs: + jobs.append(node['group']) + return jobs def _get_results_data(self, root_node): - groups = self._get_groups(root_node) + jobs = self._get_jobs(root_node) - groups_data = { - group: self._get_group_data(root_node, group) - for group in groups + jobs_data = { + job: self._get_job_data(root_node, job) + for job in jobs } - group_stats = self._get_group_stats(groups_data) + jobs_stats = self._get_job_stats(jobs_data) return { - 'stats': group_stats, - 'groups': groups_data, + 'stats': jobs_stats, + 'jobs': jobs_data, } def _get_report(self, root_node): @@ -115,12 +115,12 @@ def _get_report(self, root_node): revision = root_node['revision'] results = self._get_results_data(root_node) stats = results['stats'] - groups = results['groups'] + jobs = results['jobs'] subject = f"\ [STAGING] {revision['tree']}/{revision['branch']} {revision['describe']}: \ {stats['total']} runs {stats['failures']} failures" content = template.render( - subject=subject, root=root_node, groups=groups + subject=subject, root=root_node, jobs=jobs ) return content, subject