mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 14:40:19 -07:00
ios integration tests to network_cli (#33920)
* Preliminary steps * Fix Python3 network_cli ios * Add connection to debug strings * Fix ios confirm prompt by way of optional newline Also update ios_user delete tests
This commit is contained in:
parent
8d5c8b252d
commit
cb1b705218
56 changed files with 358 additions and 102 deletions
|
@ -9,8 +9,14 @@
|
|||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
- name: run test cases (connection=network_cli)
|
||||
include: "{{ test_case_to_run }} ansible_connection=network_cli"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
- name: run test case (connection=local)
|
||||
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
|
||||
with_first_found: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/bad_operator.yaml"
|
||||
- debug: msg="START cli/bad_operator.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: test bad operator
|
||||
ios_command:
|
||||
|
@ -9,6 +9,7 @@
|
|||
authorize: yes
|
||||
wait_for:
|
||||
- "result[0] contains 'Description: Foo'"
|
||||
become: yes
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
|
@ -17,4 +18,4 @@
|
|||
- "result.failed == true"
|
||||
- "result.msg is defined"
|
||||
|
||||
- debug: msg="END cli/bad_operator.yaml"
|
||||
- debug: msg="END cli/bad_operator.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/contains.yaml"
|
||||
- debug: msg="START cli/contains.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: test contains operator
|
||||
ios_command:
|
||||
|
@ -10,6 +10,7 @@
|
|||
wait_for:
|
||||
- "result[0] contains Cisco"
|
||||
- "result[1] contains Loopback888"
|
||||
become: yes
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
@ -17,4 +18,4 @@
|
|||
- "result.changed == false"
|
||||
- "result.stdout is defined"
|
||||
|
||||
- debug: msg="END cli/contains.yaml"
|
||||
- debug: msg="END cli/contains.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
---
|
||||
- debug: msg="START cli/invalid.yaml"
|
||||
- debug: msg="START cli/invalid.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: run invalid command
|
||||
ios_command:
|
||||
commands: show foo
|
||||
authorize: yes
|
||||
become: yes
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
|
@ -18,6 +19,7 @@
|
|||
- show version
|
||||
- show foo
|
||||
authorize: yes
|
||||
become: yes
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
|
@ -25,4 +27,4 @@
|
|||
that:
|
||||
- "result.failed"
|
||||
|
||||
- debug: msg="END cli/invalid.yaml"
|
||||
- debug: msg="END cli/invalid.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
---
|
||||
- debug: msg="START cli/output.yaml"
|
||||
- debug: msg="START cli/output.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: get output for single command
|
||||
ios_command:
|
||||
commands:
|
||||
- show version
|
||||
authorize: yes
|
||||
become: yes
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
@ -19,6 +20,7 @@
|
|||
- show version
|
||||
- show interfaces
|
||||
authorize: yes
|
||||
become: yes
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
@ -27,4 +29,4 @@
|
|||
- "result.stdout is defined"
|
||||
- "result.stdout | length == 2"
|
||||
|
||||
- debug: msg="END cli/output.yaml"
|
||||
- debug: msg="END cli/output.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/timeout.yaml"
|
||||
- debug: msg="START cli/timeout.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: test bad condition
|
||||
ios_command:
|
||||
|
@ -8,6 +8,7 @@
|
|||
authorize: yes
|
||||
wait_for:
|
||||
- "result[0] contains bad_value_string"
|
||||
become: yes
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
|
@ -16,4 +17,4 @@
|
|||
- "result.failed == true"
|
||||
- "result.msg is defined"
|
||||
|
||||
- debug: msg="END cli/timeout.yaml"
|
||||
- debug: msg="END cli/timeout.yaml on connection={{ ansible_connection }}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue