Refine categorized timing metrics and coverage output
This commit is contained in:
@@ -733,6 +733,23 @@ def get_test_flow(template_name: object) -> List[str]:
|
||||
return TEMPLATE_TEST_FLOWS.get(template_name, DEFAULT_TEST_FLOW)
|
||||
|
||||
|
||||
def infer_missing_host_durations(ordered_hosts: List[HostResult], end_ts: Optional[datetime]) -> None:
|
||||
timed_hosts = [host for host in ordered_hosts if host.timestamp]
|
||||
if not timed_hosts:
|
||||
return
|
||||
timed_hosts.sort(key=lambda host: host.timestamp or datetime.fromtimestamp(0, tz=timezone.utc))
|
||||
for index, host in enumerate(timed_hosts):
|
||||
if host.duration_seconds is not None:
|
||||
continue
|
||||
current_ts = host.timestamp
|
||||
if current_ts is None:
|
||||
continue
|
||||
next_ts = timed_hosts[index + 1].timestamp if index + 1 < len(timed_hosts) else end_ts
|
||||
if next_ts is None or next_ts <= current_ts:
|
||||
continue
|
||||
host.duration_seconds = (next_ts - current_ts).total_seconds()
|
||||
|
||||
|
||||
def build_status_markdown(
|
||||
build_name: str,
|
||||
metadata: Dict[str, object],
|
||||
@@ -744,6 +761,7 @@ def build_status_markdown(
|
||||
notes: List[str],
|
||||
) -> str:
|
||||
ordered_hosts = list(host_results.values())
|
||||
infer_missing_host_durations(ordered_hosts, end_ts)
|
||||
finished = len([h for h in ordered_hosts if h.status in {"PASS", "FAIL"}])
|
||||
passed = len([h for h in ordered_hosts if h.status == "PASS"])
|
||||
failed = len([h for h in ordered_hosts if h.status == "FAIL"])
|
||||
@@ -772,6 +790,9 @@ def build_status_markdown(
|
||||
|
||||
notes_block = "\n".join(f"- {note}" for note in notes) if notes else "- none"
|
||||
test_flow_lines = [f"- {step}" for step in get_test_flow(metadata.get("template"))]
|
||||
coverage_options = list(metadata.get("extra_options", [])) if isinstance(metadata.get("extra_options"), list) else []
|
||||
if metadata.get("categorized"):
|
||||
coverage_options = [value for value in coverage_options if value != "--categorize"]
|
||||
|
||||
lines = [
|
||||
"## ATVM Run Status",
|
||||
@@ -808,7 +829,7 @@ def build_status_markdown(
|
||||
f"- config file: `{metadata.get('config_file', 'unknown')}`",
|
||||
f"- migration style: {metadata['migration_style']}",
|
||||
f"- integration/plugin path: `{metadata['integration_plugin']}`",
|
||||
f"- run options: {', '.join(f'`{value}`' for value in metadata.get('extra_options', [])) or 'none'}",
|
||||
f"- run options: {', '.join(f'`{value}`' for value in coverage_options) or 'none'}",
|
||||
"",
|
||||
"**TEST FLOW:**",
|
||||
*test_flow_lines,
|
||||
|
||||
Reference in New Issue
Block a user