From 5884f68dd1f7c50e44f7be3a20c5d50924603521 Mon Sep 17 00:00:00 2001 From: ankita Date: Mon, 10 Mar 2025 13:43:04 +0530 Subject: [PATCH 1/2] junit: Add system properties to the junit file Signed-off-by: ankita --- lisa/notifiers/junit.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lisa/notifiers/junit.py b/lisa/notifiers/junit.py index 602fcb5765..c70796b35d 100644 --- a/lisa/notifiers/junit.py +++ b/lisa/notifiers/junit.py @@ -300,6 +300,18 @@ def _add_test_case_result( testcase.attrib["classname"] = class_name testcase.attrib["time"] = self._get_elapsed_str(elapsed) + # Add a standard system-properties element for all test cases + if hasattr(message, 'information') and isinstance(message.information, dict): + # Create a system-properties element + system_props = ET.SubElement(testcase, "system-properties") + + # Add VM size and encrypt_disk if they exist + for key in ['vmsize', 'encrypt_disk']: + if key in message.information: + prop = ET.SubElement(system_props, "property") + prop.attrib["name"] = key + prop.attrib["value"] = str(message.information[key]) + if message.status == TestStatus.FAILED: failure = ET.SubElement(testcase, "failure") failure.attrib["message"] = message.message From f370a0368902c3459c5694d8dab69c9b31ab3e3c Mon Sep 17 00:00:00 2001 From: ankita Date: Mon, 10 Mar 2025 18:13:09 +0530 Subject: [PATCH 2/2] junit: Fix formatting errors Signed-off-by: ankita --- lisa/notifiers/junit.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisa/notifiers/junit.py b/lisa/notifiers/junit.py index c70796b35d..bb91a3886a 100644 --- a/lisa/notifiers/junit.py +++ b/lisa/notifiers/junit.py @@ -301,12 +301,12 @@ def _add_test_case_result( testcase.attrib["time"] = self._get_elapsed_str(elapsed) # Add a standard system-properties element for all test cases - if hasattr(message, 'information') and isinstance(message.information, dict): + if hasattr(message, "information") and isinstance(message.information, dict): # Create a system-properties element system_props = ET.SubElement(testcase, "system-properties") - + # Add VM size and encrypt_disk if they exist - for key in ['vmsize', 'encrypt_disk']: + for key in ["vmsize", "encrypt_disk"]: if key in message.information: prop = ET.SubElement(system_props, "property") prop.attrib["name"] = key