mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-22 03:53:59 -07:00
NXOS: Integration tests to Ansible (part 3) (#29030)
* Add nxos_file_copy IT * Restructure nxos_igmp tests * add nxos_igmp_interface IT * add nxos_igmp_snooping IT * add nxos_ntp_auth IT * Add nxos_ntp_options IT * update nxos.yaml with new tests * update nxos_ntp_options test * update nxos_ntp_auth IT
This commit is contained in:
parent
279b7ce671
commit
ab84718a01
37 changed files with 903 additions and 20 deletions
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
testcase: "*"
|
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- prepare_nxos_tests
|
25
test/integration/targets/nxos_igmp_snooping/tasks/cli.yaml
Normal file
25
test/integration/targets/nxos_igmp_snooping/tasks/cli.yaml
Normal file
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
- 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: 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 }} connection={{ cli }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
- { include: nxapi.yaml, tags: ['nxapi'] }
|
38
test/integration/targets/nxos_igmp_snooping/tasks/nxapi.yaml
Normal file
38
test/integration/targets/nxos_igmp_snooping/tasks/nxapi.yaml
Normal file
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
- 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: 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 }}"
|
||||
|
||||
- name: enable nxapi
|
||||
nxos_config:
|
||||
lines:
|
||||
- feature nxapi
|
||||
- nxapi http port 80
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }} connection={{ nxapi }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
- name: disable nxapi
|
||||
nxos_config:
|
||||
lines:
|
||||
- no feature nxapi
|
||||
provider: "{{ cli }}"
|
|
@ -0,0 +1,48 @@
|
|||
---
|
||||
- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_igmp_snooping sanity test"
|
||||
|
||||
- block:
|
||||
|
||||
- name: Configure igmp snooping with non-default values
|
||||
nxos_igmp_snooping: &non-default
|
||||
snooping: true
|
||||
group_timeout: never
|
||||
link_local_grp_supp: true
|
||||
report_supp: true
|
||||
v3_report_supp: true
|
||||
state: present
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert: &true
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- name: "Check Idempotence - Configure igmp snooping with non-default values"
|
||||
nxos_igmp_snooping: *non-default
|
||||
register: result
|
||||
|
||||
- assert: &false
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: Configure igmp snooping with default values
|
||||
nxos_igmp_snooping: &default
|
||||
state: default
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence - Configure igmp snooping with default values"
|
||||
nxos_igmp_snooping: *default
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
always:
|
||||
- name: Configure igmp snooping with default values
|
||||
nxos_igmp_snooping: *default
|
||||
register: result
|
||||
|
||||
- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_igmp_snooping sanity test"
|
Loading…
Add table
Add a link
Reference in a new issue