Skip to content

Commit 2e1b9c1

Browse files
committed
Enhance telemetry data duration calculation and improve HTML report test group naming logic
1 parent b332dd6 commit 2e1b9c1

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

src/roles/misc/tasks/post-telemetry-data.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,19 @@
2929
"OsVersion": "{{ target_os_family | default(ansible_distribution | default('') ~ ' ' ~ ansible_distribution_version | default('')) }}",
3030
"TestCaseMessage": "{{ test_case_message | default('') }}",
3131
"TestCaseDetails": "{{ test_case_details | default('') }}",
32-
"DurationSeconds": "{{
33-
((test_execution_end_time | default(now(utc=true, fmt='%Y-%m-%d %H:%M:%S')) | to_datetime)
34-
- (test_execution_start_time | default(test_case_start_time_epoch) | to_datetime))
35-
}}",
32+
"DurationSeconds": "{{
33+
(
34+
(test_execution_end_time
35+
| default(now(utc=true, fmt='%Y-%m-%d %H:%M:%S'))
36+
| to_datetime('%s')
37+
| int)
38+
-
39+
(test_execution_start_time
40+
| default(test_case_start_time_epoch)
41+
| to_datetime('%s')
42+
| int)
43+
)
44+
}}",
3645
"DbFencingType": "{{ database_cluster_type if (database_high_availability | default(false)) else 'DB not HA' }}",
3746
"ScsFencingType": "{{ scs_cluster_type if (scs_high_availability | default(false)) else 'SCS not HA' }}",
3847
"StorageType": "{{ NFS_provider | default('unknown') }}",

src/roles/misc/tasks/render-html-report.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,27 @@
2222
- name: "Read the log file and create a HTML report"
2323
render_html_report:
2424
test_group_invocation_id: "{{ test_group_invocation_id }}"
25-
test_group_name: "{{ report_file_name | default(test_group_name + '_' + ansible_os_family | upper) }}"
25+
test_group_name: "{{
26+
report_file_name
27+
| default(
28+
(
29+
(test_group_name
30+
if (test_group_name is defined)
31+
else 'TESTS')
32+
~ '_'
33+
~ (
34+
(target_os_family
35+
if (target_os_family is defined)
36+
else (
37+
(ansible_os_family
38+
if (ansible_os_family is defined)
39+
else 'UNKNOWN')
40+
))
41+
| upper
42+
)
43+
)
44+
)
45+
}}"
2646
report_template: "{{ html_report_template }}"
2747
workspace_directory: "{{ _workspace_directory }}"
2848
test_case_results: "{{ all_results | default([]) }}"

0 commit comments

Comments
 (0)