mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
Add integration tests and fix nxos providers (#26913)
* fix issues with python3.x * Add integration testa and fix for nxos_evpn_vni * add nxos_evpn_vni to nxos.yaml * fix get_vtp_config() * add new integration tests * fix rollback * add integration test files
This commit is contained in:
parent
cee9b08e70
commit
9b9a8749da
66 changed files with 1158 additions and 80 deletions
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
testcase: "*"
|
2
test/integration/targets/nxos_rollback/meta/main.yml
Normal file
2
test/integration/targets/nxos_rollback/meta/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- prepare_nxos_tests
|
15
test/integration/targets/nxos_rollback/tasks/cli.yaml
Normal file
15
test/integration/targets/nxos_rollback/tasks/cli.yaml
Normal file
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
- name: collect all cli test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/cli"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
3
test/integration/targets/nxos_rollback/tasks/main.yaml
Normal file
3
test/integration/targets/nxos_rollback/tasks/main.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
- { include: nxapi.yaml, tags: ['nxapi'] }
|
28
test/integration/targets/nxos_rollback/tasks/nxapi.yaml
Normal file
28
test/integration/targets/nxos_rollback/tasks/nxapi.yaml
Normal file
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
- name: collect all nxapi test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/nxapi"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: enable nxapi
|
||||
nxos_config:
|
||||
lines:
|
||||
- feature nxapi
|
||||
- nxapi http port 80
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
- name: disable nxapi
|
||||
nxos_config:
|
||||
lines:
|
||||
- no feature nxapi
|
||||
provider: "{{ cli }}"
|
29
test/integration/targets/nxos_rollback/tests/cli/sanity.yaml
Normal file
29
test/integration/targets/nxos_rollback/tests/cli/sanity.yaml
Normal file
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
- debug: msg="START TRANSPORT:CLI nxos_rollback sanity test"
|
||||
|
||||
- name: delete existing checkpoint file
|
||||
nxos_config: &delete
|
||||
commands:
|
||||
- terminal dont-ask
|
||||
- delete backup.cfg
|
||||
match: none
|
||||
provider: "{{ cli }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Create checkpoint file
|
||||
nxos_rollback:
|
||||
checkpoint_file: backup.cfg
|
||||
timeout: 300
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: rollback to the previously created checkpoint file
|
||||
nxos_rollback:
|
||||
rollback_to: backup.cfg
|
||||
timeout: 300
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: cleanup checkpoint file
|
||||
nxos_config: *delete
|
||||
ignore_errors: yes
|
||||
|
||||
- debug: msg="END TRANSPORT:CLI nxos_rollback sanity test"
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
- debug: msg="START TRANSPORT:NXAPI nxos_rollback sanity test"
|
||||
|
||||
- name: delete existing checkpoint file
|
||||
nxos_config: &delete
|
||||
commands:
|
||||
- terminal dont-ask
|
||||
- delete backup.cfg
|
||||
match: none
|
||||
provider: "{{ nxapi }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Create checkpoint file
|
||||
nxos_rollback:
|
||||
checkpoint_file: backup.cfg
|
||||
timeout: 300
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
- name: rollback to the previously created checkpoint file
|
||||
nxos_rollback:
|
||||
rollback_to: backup.cfg
|
||||
timeout: 300
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
- name: cleanup checkpoint file
|
||||
nxos_config: *delete
|
||||
ignore_errors: yes
|
||||
|
||||
- debug: msg="END TRANSPORT:NXAPI nxos_rollback sanity test"
|
Loading…
Add table
Add a link
Reference in a new issue