From 4c1d8447d0a669bec424543dd43e889eba4a585c Mon Sep 17 00:00:00 2001 From: Vinay M <63404819+roverflow@users.noreply.github.com> Date: Thu, 9 Jan 2025 13:04:28 +0530 Subject: [PATCH] Fix `nxos_facts` integration test (#917) * Add/Test Integration * test - 2 * fix facts tests and changes in integation * fix * remove file_copy ignore * file copy fix * fixes fstring error * added changelog * file copy * remove vpc merging this with upstream ci fail as these are related to cml --- changelogs/fragments/tests_fix.yaml | 5 +++++ plugins/action/nxos.py | 3 +-- tests/integration/targets/nxos_facts/vars/main.yml | 2 ++ .../targets/nxos_file_copy/tests/cli/input_validation.yaml | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/tests_fix.yaml diff --git a/changelogs/fragments/tests_fix.yaml b/changelogs/fragments/tests_fix.yaml new file mode 100644 index 000000000..bd6d86e79 --- /dev/null +++ b/changelogs/fragments/tests_fix.yaml @@ -0,0 +1,5 @@ +--- +bugfixes: + - Fixes mixed usage of f-string and format string in action plugin for consistency. +trivial: + - Added tests fixes for nxos_facts. diff --git a/plugins/action/nxos.py b/plugins/action/nxos.py index e57c08aeb..c636c636d 100644 --- a/plugins/action/nxos.py +++ b/plugins/action/nxos.py @@ -60,8 +60,7 @@ def run(self, tmp=None, task_vars=None): "msg": ( f"Connection type must be fully qualified name for " f"network_cli connection type, got {self._play_context.connection}" - ) - % self._play_context.connection, + ), } conn = Connection(self._connection.socket_path) diff --git a/tests/integration/targets/nxos_facts/vars/main.yml b/tests/integration/targets/nxos_facts/vars/main.yml index f010eb0ac..65cf3ce18 100644 --- a/tests/integration/targets/nxos_facts/vars/main.yml +++ b/tests/integration/targets/nxos_facts/vars/main.yml @@ -28,4 +28,6 @@ available_network_resources: - static_routes - telemetry - vlans + - vrf_address_family - vrf_global + - vrf_interfaces diff --git a/tests/integration/targets/nxos_file_copy/tests/cli/input_validation.yaml b/tests/integration/targets/nxos_file_copy/tests/cli/input_validation.yaml index bcda7b4fa..e05edc3fb 100644 --- a/tests/integration/targets/nxos_file_copy/tests/cli/input_validation.yaml +++ b/tests/integration/targets/nxos_file_copy/tests/cli/input_validation.yaml @@ -21,7 +21,7 @@ - ansible.builtin.assert: that: - - result is search("argument 'file_pull_timeout' is of type .* and we were unable to convert to int") + - result.msg is ansible.builtin.search("argument 'file_pull_timeout' is of type .* and we were unable to convert to int", multiline=true) - name: Input validation - param should be type register: result