From 41929d02c0d9d270d899a6c39d665654bb31b28b Mon Sep 17 00:00:00 2001 From: vitthalmagadum Date: Tue, 8 Apr 2025 08:19:25 -0400 Subject: [PATCH 1/2] Updated test VerifyLoggingErrors to add logs in failure msg --- anta/tests/logging.py | 2 +- tests/units/anta_tests/test_logging.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/anta/tests/logging.py b/anta/tests/logging.py index f13860e20..4f4dc5889 100644 --- a/anta/tests/logging.py +++ b/anta/tests/logging.py @@ -433,7 +433,7 @@ def test(self) -> None: if len(command_output) == 0: self.result.is_success() else: - self.result.is_failure("Device has reported syslog messages with a severity of ERRORS or higher") + self.result.is_failure(f"Device has reported syslog messages at threshold level or above:\n{command_output}") class VerifyLoggingEntries(AntaTest): diff --git a/tests/units/anta_tests/test_logging.py b/tests/units/anta_tests/test_logging.py index 5f7958956..83875882a 100644 --- a/tests/units/anta_tests/test_logging.py +++ b/tests/units/anta_tests/test_logging.py @@ -277,7 +277,14 @@ "Aug 2 19:57:42 DC1-LEAF1A Mlag: %FWK-3-SOCKET_CLOSE_REMOTE: Connection to Mlag (pid:27200) at tbt://192.168.0.1:4432/+n closed by peer (EOF)", ], "inputs": None, - "expected": {"result": "failure", "messages": ["Device has reported syslog messages with a severity of ERRORS or higher"]}, + "expected": { + "result": "failure", + "messages": [ + "Device has reported syslog messages at threshold level or above:\n" + "Aug 2 19:57:42 DC1-LEAF1A Mlag: %FWK-3-SOCKET_CLOSE_REMOTE: Connection to Mlag " + "(pid:27200) at tbt://192.168.0.1:4432/+n closed by peer (EOF)" + ] + }, }, { "name": "success", From 5a4aea4ca355406870aa8d51bfd97c4907651aa3 Mon Sep 17 00:00:00 2001 From: vitthalmagadum Date: Tue, 8 Apr 2025 10:40:29 -0400 Subject: [PATCH 2/2] addressed review comments: updated failure msgs --- anta/tests/logging.py | 2 +- tests/units/anta_tests/test_logging.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/anta/tests/logging.py b/anta/tests/logging.py index 4f4dc5889..f140ad4e8 100644 --- a/anta/tests/logging.py +++ b/anta/tests/logging.py @@ -433,7 +433,7 @@ def test(self) -> None: if len(command_output) == 0: self.result.is_success() else: - self.result.is_failure(f"Device has reported syslog messages at threshold level or above:\n{command_output}") + self.result.is_failure(f"Device has reported syslog messages with a severity of ERRORS or higher:\n{command_output}") class VerifyLoggingEntries(AntaTest): diff --git a/tests/units/anta_tests/test_logging.py b/tests/units/anta_tests/test_logging.py index 83875882a..2628e7d47 100644 --- a/tests/units/anta_tests/test_logging.py +++ b/tests/units/anta_tests/test_logging.py @@ -280,10 +280,10 @@ "expected": { "result": "failure", "messages": [ - "Device has reported syslog messages at threshold level or above:\n" + "Device has reported syslog messages with a severity of ERRORS or higher:\n" "Aug 2 19:57:42 DC1-LEAF1A Mlag: %FWK-3-SOCKET_CLOSE_REMOTE: Connection to Mlag " "(pid:27200) at tbt://192.168.0.1:4432/+n closed by peer (EOF)" - ] + ], }, }, {