From 60d9e5c2a47bf3a541c6f176cc9d4744d0e3aa59 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 11 Feb 2025 14:13:49 +0100 Subject: [PATCH 1/2] ci: pre-commit autoupdate (#1034) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.9.4 → v0.9.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.4...v0.9.6) - [github.com/pre-commit/mirrors-mypy: v1.14.1 → v1.15.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.14.1...v1.15.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Guillaume Mulocher --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c8b864193..bbbb977dd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -46,7 +46,7 @@ repos: - '' - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.4 + rev: v0.9.6 hooks: - id: ruff name: Run Ruff linter @@ -86,7 +86,7 @@ repos: args: ["--ignore-words", ".codespellignore"] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.14.1 + rev: v1.15.0 hooks: - id: mypy name: Check typing with mypy From b652ed18a764e29877e4e2feca42ccd1ccb01a7f Mon Sep 17 00:00:00 2001 From: geetanjalimanegslab <96573243+geetanjalimanegslab@users.noreply.github.com> Date: Thu, 13 Feb 2025 10:37:37 +0530 Subject: [PATCH 2/2] =?UTF-8?q?refactor(anta.tests):=20Nicer=20result=20fa?= =?UTF-8?q?ilure=20messages=20AVT,=20field=5Fnotice=20test=20module=C2=A0?= =?UTF-8?q?=20(#1036)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor(anta.tests): Nicer result failure messages AVT, Field_notice test module  * Remove comas from the input docstring --- anta/input_models/avt.py | 2 +- anta/tests/avt.py | 2 +- anta/tests/field_notices.py | 4 ++-- tests/units/anta_tests/test_avt.py | 18 +++++++++--------- tests/units/anta_tests/test_field_notices.py | 10 +++++----- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/anta/input_models/avt.py b/anta/input_models/avt.py index 6430045eb..44fd780fc 100644 --- a/anta/input_models/avt.py +++ b/anta/input_models/avt.py @@ -33,4 +33,4 @@ def __str__(self) -> str: AVT CONTROL-PLANE-PROFILE VRF: default (Destination: 10.101.255.2, Next-hop: 10.101.255.1) """ - return f"AVT {self.avt_name} VRF: {self.vrf} (Destination: {self.destination}, Next-hop: {self.next_hop})" + return f"AVT: {self.avt_name} VRF: {self.vrf} Destination: {self.destination} Next-hop: {self.next_hop}" diff --git a/anta/tests/avt.py b/anta/tests/avt.py index 365a2f72a..499b25057 100644 --- a/anta/tests/avt.py +++ b/anta/tests/avt.py @@ -192,4 +192,4 @@ def test(self) -> None: # Check if the AVT role matches the expected role if self.inputs.role != command_output.get("role"): - self.result.is_failure(f"Expected AVT role as `{self.inputs.role}`, but found `{command_output.get('role')}` instead.") + self.result.is_failure(f"AVT role mismatch - Expected: {self.inputs.role}, Actual: {command_output.get('role')}") diff --git a/anta/tests/field_notices.py b/anta/tests/field_notices.py index 0c093e796..cc7fab9f0 100644 --- a/anta/tests/field_notices.py +++ b/anta/tests/field_notices.py @@ -96,7 +96,7 @@ def test(self) -> None: for variant in variants: model = model.replace(variant, "") if model not in devices: - self.result.is_skipped("device is not impacted by FN044") + self.result.is_skipped("Device is not impacted by FN044") return for component in command_output["details"]["components"]: @@ -117,7 +117,7 @@ def test(self) -> None: ) ) if incorrect_aboot_version: - self.result.is_failure(f"device is running incorrect version of aboot ({aboot_version})") + self.result.is_failure(f"Device is running incorrect version of aboot {aboot_version}") class VerifyFieldNotice72Resolution(AntaTest): diff --git a/tests/units/anta_tests/test_avt.py b/tests/units/anta_tests/test_avt.py index bb6c6b903..60adbec28 100644 --- a/tests/units/anta_tests/test_avt.py +++ b/tests/units/anta_tests/test_avt.py @@ -444,7 +444,7 @@ }, "expected": { "result": "failure", - "messages": ["AVT MGMT-AVT-POLICY-DEFAULT VRF: default (Destination: 10.101.255.2, Next-hop: 10.101.255.1) - No AVT path configured"], + "messages": ["AVT: MGMT-AVT-POLICY-DEFAULT VRF: default Destination: 10.101.255.2 Next-hop: 10.101.255.1 - No AVT path configured"], }, }, { @@ -507,8 +507,8 @@ "expected": { "result": "failure", "messages": [ - "AVT DEFAULT-AVT-POLICY-CONTROL-PLANE VRF: default (Destination: 10.101.255.2, Next-hop: 10.101.255.11) Path Type: multihop - Path not found", - "AVT DATA-AVT-POLICY-CONTROL-PLANE VRF: data (Destination: 10.101.255.1, Next-hop: 10.101.255.21) Path Type: direct - Path not found", + "AVT: DEFAULT-AVT-POLICY-CONTROL-PLANE VRF: default Destination: 10.101.255.2 Next-hop: 10.101.255.11 Path Type: multihop - Path not found", + "AVT: DATA-AVT-POLICY-CONTROL-PLANE VRF: data Destination: 10.101.255.1 Next-hop: 10.101.255.21 Path Type: direct - Path not found", ], }, }, @@ -571,8 +571,8 @@ "expected": { "result": "failure", "messages": [ - "AVT DEFAULT-AVT-POLICY-CONTROL-PLANE VRF: default (Destination: 10.101.255.2, Next-hop: 10.101.255.11) - Path not found", - "AVT DATA-AVT-POLICY-CONTROL-PLANE VRF: data (Destination: 10.101.255.1, Next-hop: 10.101.255.21) - Path not found", + "AVT: DEFAULT-AVT-POLICY-CONTROL-PLANE VRF: default Destination: 10.101.255.2 Next-hop: 10.101.255.11 - Path not found", + "AVT: DATA-AVT-POLICY-CONTROL-PLANE VRF: data Destination: 10.101.255.1 Next-hop: 10.101.255.21 - Path not found", ], }, }, @@ -646,11 +646,11 @@ "expected": { "result": "failure", "messages": [ - "AVT DEFAULT-AVT-POLICY-CONTROL-PLANE VRF: default (Destination: 10.101.255.2, Next-hop: 10.101.255.1) - " + "AVT: DEFAULT-AVT-POLICY-CONTROL-PLANE VRF: default Destination: 10.101.255.2 Next-hop: 10.101.255.1 - " "Incorrect path multihop:3 - Valid: False, Active: True", - "AVT DATA-AVT-POLICY-CONTROL-PLANE VRF: data (Destination: 10.101.255.1, Next-hop: 10.101.255.1) - " + "AVT: DATA-AVT-POLICY-CONTROL-PLANE VRF: data Destination: 10.101.255.1 Next-hop: 10.101.255.1 - " "Incorrect path direct:10 - Valid: False, Active: True", - "AVT DATA-AVT-POLICY-CONTROL-PLANE VRF: data (Destination: 10.101.255.1, Next-hop: 10.101.255.1) - " + "AVT: DATA-AVT-POLICY-CONTROL-PLANE VRF: data Destination: 10.101.255.1 Next-hop: 10.101.255.1 - " "Incorrect path direct:9 - Valid: True, Active: False", ], }, @@ -667,6 +667,6 @@ "test": VerifyAVTRole, "eos_data": [{"role": "transit"}], "inputs": {"role": "edge"}, - "expected": {"result": "failure", "messages": ["Expected AVT role as `edge`, but found `transit` instead."]}, + "expected": {"result": "failure", "messages": ["AVT role mismatch - Expected: edge, Actual: transit"]}, }, ] diff --git a/tests/units/anta_tests/test_field_notices.py b/tests/units/anta_tests/test_field_notices.py index 13dd66095..f7c5fc681 100644 --- a/tests/units/anta_tests/test_field_notices.py +++ b/tests/units/anta_tests/test_field_notices.py @@ -45,7 +45,7 @@ "inputs": None, "expected": { "result": "failure", - "messages": ["device is running incorrect version of aboot (4.0.1)"], + "messages": ["Device is running incorrect version of aboot 4.0.1"], }, }, { @@ -65,7 +65,7 @@ "inputs": None, "expected": { "result": "failure", - "messages": ["device is running incorrect version of aboot (4.1.0)"], + "messages": ["Device is running incorrect version of aboot 4.1.0"], }, }, { @@ -85,7 +85,7 @@ "inputs": None, "expected": { "result": "failure", - "messages": ["device is running incorrect version of aboot (6.0.1)"], + "messages": ["Device is running incorrect version of aboot 6.0.1"], }, }, { @@ -105,7 +105,7 @@ "inputs": None, "expected": { "result": "failure", - "messages": ["device is running incorrect version of aboot (6.1.1)"], + "messages": ["Device is running incorrect version of aboot 6.1.1"], }, }, { @@ -125,7 +125,7 @@ "inputs": None, "expected": { "result": "skipped", - "messages": ["device is not impacted by FN044"], + "messages": ["Device is not impacted by FN044"], }, }, {