Split ATVM failure notes from general status notes

This commit is contained in:
2026-03-30 22:31:41 -04:00
parent 18dcbc89f9
commit 7ab5daeca8
5 changed files with 49 additions and 16 deletions

View File

@@ -581,7 +581,22 @@ def extract_failure_from_mochawesome(
def summarize_host_detail_with_mochawesome(detail: str, testcase: str, message: str) -> str:
prefix_match = re.match(r"^(\d+ tests, \d+ failures(?:, \d+ pending)?)", detail)
prefix = prefix_match.group(1) if prefix_match else detail
message_summary = compact_failure_detail(message or testcase, limit=260)
normalized_message = " ".join((message or "").split())
message_summary = ""
for pattern in (
r"(md5sum:\s.*?)(?:$)",
r"(sshpass does not contain OK(?:\.\s*Output:)?)(?:$)",
r"(AssertionError:\s.*?)(?:$)",
r"(Timed out!? .*?)(?:$)",
r"(Error:\s.*?)(?:$)",
):
match = re.search(pattern, normalized_message, re.I)
if match:
message_summary = match.group(1)
break
if not message_summary:
message_summary = normalized_message or testcase
message_summary = compact_failure_detail(message_summary, limit=120)
testcase_summary = compact_failure_detail(testcase, limit=140)
return f"{prefix} - {testcase_summary} - {message_summary}"
@@ -1180,7 +1195,7 @@ def build_status_markdown(
longest = max((h for h in ordered_hosts if h.duration_seconds is not None), key=lambda h: h.duration_seconds, default=None)
average = (sum(durations) / len(durations)) if durations else None
additional_failure_notes: List[str] = []
failure_notes: List[str] = []
for host in ordered_hosts:
if host.status != "FAIL":
continue
@@ -1190,7 +1205,7 @@ def build_status_markdown(
testcase, message, estack = mochawesome_failure
host.detail = summarize_host_detail_with_mochawesome(host.detail, testcase, message)
failure_excerpt_source = estack or message
additional_failure_notes.append(
failure_notes.append(
f"{host.host} failure excerpt: `{compact_failure_detail(failure_excerpt_source, limit=420)}`"
)
@@ -1220,8 +1235,7 @@ def build_status_markdown(
notes = notes + [
"Both iscsi and fc disks were used for the reboot test. As a result, iscsi disks may not have attached before the mtdi started. So if the test failed, that is most likely the issue."
]
notes = notes + additional_failure_notes
failure_notes_block = "\n".join(f"- {note}" for note in failure_notes) if failure_notes else "- none"
notes_block = "\n".join(f"- {note}" for note in notes) if notes else "- none"
resolved_flow = extract_test_flow_from_generated_spec(reporter_root, log_text) or get_test_flow(metadata.get("template"))
test_flow_lines = [f"- {step}" for step in resolved_flow]
@@ -1261,6 +1275,9 @@ def build_status_markdown(
"**TEST FLOW:**",
*test_flow_lines,
"",
"**FAILURE NOTES:**",
failure_notes_block,
"",
"**NOTES:**",
notes_block,
]