1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

NXOS Commit Integration tests to Ansible (part 1) (#28935)

* cleanup nxos_bgp_neighbor_af tests

* add timeout and to_json to nxapi testing for nxos_command

* maintain folder naming consistency with other tests
This commit is contained in:
rahushen 2017-09-13 09:31:47 -04:00 committed by John R Barker
parent 5537218c94
commit caafc8e591
7 changed files with 30 additions and 21 deletions

View file

@ -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: find:
paths: "{{ role_path }}/tests/cli" paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml" patterns: "{{ testcase }}.yaml"
register: test_cases register: cli_cases
- set_fact:
test_cases:
files: "{{ test_cases.files }} + {{ cli_cases.files }}"
- name: set test_items - name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case - name: run test case
include: "{{ test_case_to_run }}" include: "{{ test_case_to_run }} connection={{ cli }}"
with_items: "{{ test_items }}" with_items: "{{ test_items }}"
loop_control: loop_control:
loop_var: test_case_to_run loop_var: test_case_to_run

View file

@ -1,7 +1,3 @@
--- ---
# Use block to ensure that both cli and nxapi tests - { include: cli.yaml, tags: ['cli'] }
# will run even if there are failures or errors. - { include: nxapi.yaml, tags: ['nxapi'] }
- block:
- { include: cli.yaml, tags: ['cli'] }
always:
- { include: nxapi.yaml, tags: ['nxapi'] }

View file

@ -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: find:
paths: "{{ role_path }}/tests/nxapi" paths: "{{ role_path }}/tests/nxapi"
patterns: "{{ testcase }}.yaml" patterns: "{{ testcase }}.yaml"
register: test_cases register: nxapi_cases
- set_fact:
test_cases:
files: "{{ test_cases.files }} + {{ nxapi_cases.files }}"
- name: set test_items - name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
@ -16,7 +26,7 @@
provider: "{{ cli }}" provider: "{{ cli }}"
- name: run test case - name: run test case
include: "{{ test_case_to_run }}" include: "{{ test_case_to_run }} connection={{ nxapi }}"
with_items: "{{ test_items }}" with_items: "{{ test_items }}"
loop_control: loop_control:
loop_var: test_case_to_run loop_var: test_case_to_run

View file

@ -1,4 +0,0 @@
---
- set_fact: connection="{{ cli }}"
- import_tasks: "{{ role_path }}/tests/common/sanity.yaml"

View file

@ -1,4 +0,0 @@
---
- set_fact: connection="{{ nxapi }}"
- import_tasks: "{{ role_path }}/tests/common/sanity.yaml"

View file

@ -45,12 +45,13 @@
- command: sh running-config bgp - command: sh running-config bgp
output: text output: text
provider: "{{ nxapi }}" provider: "{{ nxapi }}"
timeout: 120
register: result register: result
- assert: - assert:
that: that:
- "result.failed == false" - "result.failed == false"
- "'65535' in result.stdout[0]" - "'65535' in result.stdout[0]|to_json"
- name: "Run an invalid command - should fail" - name: "Run an invalid command - should fail"
nxos_command: nxos_command: