mirror of https://github.com/ansible/ansible.git
Fix nxos_reload timeout and add integration tests (#49632)
* Fix timeout and add tests * Correct module namepull/49912/head
parent
b47cde9d4c
commit
0e4a7b0889
@ -0,0 +1,2 @@
|
||||
---
|
||||
testcase: "*"
|
@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- prepare_nxos_tests
|
@ -0,0 +1,27 @@
|
||||
---
|
||||
- name: collect common test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/common"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
connection: local
|
||||
register: test_cases
|
||||
|
||||
- name: collect cli test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/cli"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
connection: local
|
||||
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 cases (connection=network_cli)
|
||||
include: "{{ test_case_to_run }} ansible_connection=network_cli connection={{ cli }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
- include: cli.yaml
|
||||
tags: cli
|
||||
- include: nxapi.yaml
|
||||
tags: nxapi
|
@ -0,0 +1,35 @@
|
||||
---
|
||||
- name: collect common test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/common"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
connection: local
|
||||
register: test_cases
|
||||
|
||||
- name: collect nxapi test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/nxapi"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
connection: local
|
||||
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: run test cases (connection=httpapi)
|
||||
include: "{{ test_case_to_run }} ansible_connection=httpapi connection={{ nxapi }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
tags: nxapi_httpapi
|
||||
|
||||
- name: run test cases (connection=local)
|
||||
include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
tags: nxapi_local
|
@ -0,0 +1,26 @@
|
||||
---
|
||||
- debug: msg="START connection={{ ansible_connection }} nxos_reboot sanity test"
|
||||
- debug: msg="Using provider={{ connection.transport }}"
|
||||
when: ansible_connection == "local"
|
||||
|
||||
- debug: msg="***WARNING*** Remove meta end_play to verify this module ***WARNING***"
|
||||
|
||||
- meta: end_play
|
||||
|
||||
- block:
|
||||
- name: Reboot Switch
|
||||
nxos_reboot:
|
||||
confirm: True
|
||||
provider: "{{ connection }}"
|
||||
ignore_errors: yes
|
||||
|
||||
always:
|
||||
- name: Wait for device to come back up
|
||||
wait_for:
|
||||
port: 22
|
||||
state: started
|
||||
timeout: 600
|
||||
delay: 60
|
||||
host: "{{ inventory_hostname }}"
|
||||
|
||||
- debug: msg="END connection={{ ansible_connection }} nxos_reboot sanity test"
|
Loading…
Reference in New Issue