Skip to content

Commit

Permalink
fluster report: fix test results formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Jeny Sadadia <[email protected]>
  • Loading branch information
Jeny Sadadia authored and spbnick committed Sep 17, 2024
1 parent e0001b2 commit faecdc6
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions kcidb/templates/fluster_test.j2
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,31 @@
{% set _ = boards_titles_statuses_counts.update({board: titles_statuses_counts}) %}
{% endif %}
{% endfor %}
{% set ns = namespace(max_test_count=0) %}
{% for _, titles_statuses_counts in boards_titles_statuses_counts.items() %}
{% for _, statuses_counts in titles_statuses_counts.items() %}
{% set ns.max_test_count = [statuses_counts.values() | sum, ns.max_test_count] | max %}
{% endfor %}
{% endfor %}
{% set field_width = ( ns.max_test_count + 1 ) | string %}
{% for board, titles_statuses_counts in boards_titles_statuses_counts | dictsort %}
{{- "\n" + indent + board + ":\n" -}}
{% for title in test_names_titles.values() | sort %}
{% set statuses_counts = titles_statuses_counts.get(
title, {"PASS": 0, "FAIL": 0}
) %}
{{- indent + " " + title +
{{ indent + " " + title +
":" + " " * (stats_indent|length - indent|length - title|length) +
"✅ " + statuses_counts.get("PASS", 0) | string +
" ❌ " + statuses_counts.get("FAIL", 0) | string+
" Σ " + statuses_counts.values() | sum | string +
"\n" -}}
(
"✅{0: >" + field_width + "}" +
" ❌{1: >" + field_width + "}" +
" Σ{2: >" + field_width + "}"
).format(
statuses_counts.get("PASS", 0),
statuses_counts.get("FAIL", 0),
statuses_counts.values() | sum
)
}}
{% endfor %}
{% else %}
{{- "\n No tests found" }}
Expand Down

0 comments on commit faecdc6

Please sign in to comment.