diff --git a/test/integration/targets/nxos_bgp_neighbor_af/tasks/cli.yaml b/test/integration/targets/nxos_bgp_neighbor_af/tasks/cli.yaml index d675462dd0..0ab3f8f908 100644 --- a/test/integration/targets/nxos_bgp_neighbor_af/tasks/cli.yaml +++ b/test/integration/targets/nxos_bgp_neighbor_af/tasks/cli.yaml @@ -1,15 +1,25 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + register: cli_cases + +- set_fact: + test_cases: + files: "{{ test_cases.files }} + {{ cli_cases.files }}" - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: run test case - include: "{{ test_case_to_run }}" + include: "{{ test_case_to_run }} connection={{ cli }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_bgp_neighbor_af/tasks/main.yaml b/test/integration/targets/nxos_bgp_neighbor_af/tasks/main.yaml index fea9337c14..4b0f8c64d9 100644 --- a/test/integration/targets/nxos_bgp_neighbor_af/tasks/main.yaml +++ b/test/integration/targets/nxos_bgp_neighbor_af/tasks/main.yaml @@ -1,7 +1,3 @@ --- -# Use block to ensure that both cli and nxapi tests -# will run even if there are failures or errors. -- block: - - { include: cli.yaml, tags: ['cli'] } - always: - - { include: nxapi.yaml, tags: ['nxapi'] } +- { include: cli.yaml, tags: ['cli'] } +- { include: nxapi.yaml, tags: ['nxapi'] } diff --git a/test/integration/targets/nxos_bgp_neighbor_af/tasks/nxapi.yaml b/test/integration/targets/nxos_bgp_neighbor_af/tasks/nxapi.yaml index ea525379f7..e071f293a2 100644 --- a/test/integration/targets/nxos_bgp_neighbor_af/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_bgp_neighbor_af/tasks/nxapi.yaml @@ -1,9 +1,19 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + register: test_cases + +- name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" - register: test_cases + register: nxapi_cases + +- set_fact: + test_cases: + files: "{{ test_cases.files }} + {{ nxapi_cases.files }}" - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" @@ -16,7 +26,7 @@ provider: "{{ cli }}" - name: run test case - include: "{{ test_case_to_run }}" + include: "{{ test_case_to_run }} connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_bgp_neighbor_af/tests/cli/sanity.yaml b/test/integration/targets/nxos_bgp_neighbor_af/tests/cli/sanity.yaml deleted file mode 100644 index 420af7420e..0000000000 --- a/test/integration/targets/nxos_bgp_neighbor_af/tests/cli/sanity.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- set_fact: connection="{{ cli }}" - -- import_tasks: "{{ role_path }}/tests/common/sanity.yaml" diff --git a/test/integration/targets/nxos_bgp_neighbor_af/tests/nxapi/sanity.yaml b/test/integration/targets/nxos_bgp_neighbor_af/tests/nxapi/sanity.yaml deleted file mode 100644 index e30ea6eaf7..0000000000 --- a/test/integration/targets/nxos_bgp_neighbor_af/tests/nxapi/sanity.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- set_fact: connection="{{ nxapi }}" - -- import_tasks: "{{ role_path }}/tests/common/sanity.yaml" diff --git a/test/integration/targets/nxos_command/tests/nxapi/sanity.yaml b/test/integration/targets/nxos_command/tests/nxapi/sanity.yaml index b457624c96..a4cbae738d 100644 --- a/test/integration/targets/nxos_command/tests/nxapi/sanity.yaml +++ b/test/integration/targets/nxos_command/tests/nxapi/sanity.yaml @@ -45,12 +45,13 @@ - command: sh running-config bgp output: text provider: "{{ nxapi }}" + timeout: 120 register: result - assert: that: - "result.failed == false" - - "'65535' in result.stdout[0]" + - "'65535' in result.stdout[0]|to_json" - name: "Run an invalid command - should fail" nxos_command: diff --git a/test/integration/targets/nxos_evpn_global/tests/connection/sanity.yaml b/test/integration/targets/nxos_evpn_global/tests/common/sanity.yaml similarity index 100% rename from test/integration/targets/nxos_evpn_global/tests/connection/sanity.yaml rename to test/integration/targets/nxos_evpn_global/tests/common/sanity.yaml