mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Migrate Network Tests into ansible/ansible (#18233)
* Docs Networking tests * Copy networking tests from test-network-modules * Networking transport settings - group_vars * Network playbooks * Debug should be off by default * Update nxos.yaml * Remove items from top level * Use dependencies, not pre-tasks * Remove trailing blank lines * Remove backup files * newlines
This commit is contained in:
parent
4a067c3f50
commit
e0cc7b3415
489 changed files with 13144 additions and 2 deletions
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
testcase: "*"
|
18
test/integration/targets/dellos9_command/tasks/cli.yaml
Normal file
18
test/integration/targets/dellos9_command/tasks/cli.yaml
Normal file
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
- 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/dellos9_command/tasks/main.yaml
Normal file
3
test/integration/targets/dellos9_command/tasks/main.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
- debug: msg="START cli/bad_operator.yaml"
|
||||
|
||||
- name: test bad operator
|
||||
dellos9_command:
|
||||
commands:
|
||||
- show version
|
||||
- show interfaces TenGigabitEthernet 0/0
|
||||
wait_for:
|
||||
- "result[0] contains 'Description : blah'"
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.failed == true"
|
||||
- "result.msg is defined"
|
||||
|
||||
- debug: msg="END cli/bad_operator.yaml"
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
- debug: msg="START cli/contains.yaml"
|
||||
|
||||
- name: test contains operator
|
||||
dellos9_command:
|
||||
commands:
|
||||
- show version
|
||||
- show interface TenGigabitEthernet 0/0
|
||||
wait_for:
|
||||
- "result[0] contains 2.0"
|
||||
- "result[1] contains TenGigabitEthernet "
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.stdout is defined"
|
||||
|
||||
- debug: msg="END cli/contains.yaml"
|
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
- debug: msg="START cli/invalid.yaml"
|
||||
|
||||
- name: run invalid command
|
||||
dellos9_command:
|
||||
commands: ['show foo']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.failed"
|
||||
|
||||
- name: run commands that include invalid command
|
||||
dellos9_command:
|
||||
commands:
|
||||
- show version
|
||||
- show foo
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.failed"
|
||||
|
||||
- debug: msg="END cli/invalid.yaml"
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
- debug: msg="START cli/output.yaml"
|
||||
|
||||
- name: get output for single command
|
||||
dellos9_command:
|
||||
commands: ['show version']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.stdout is defined"
|
||||
|
||||
- name: get output for multiple commands
|
||||
dellos9_command:
|
||||
commands:
|
||||
- show version
|
||||
- show interfaces
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.stdout is defined"
|
||||
- "result.stdout | length == 2"
|
||||
|
||||
- debug: msg="END cli/output.yaml"
|
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
- debug: msg="START cli/timeout.yaml"
|
||||
|
||||
- name: test bad condition
|
||||
dellos9_command:
|
||||
commands:
|
||||
- show version
|
||||
wait_for:
|
||||
- "result[0] contains bad_value_string"
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.failed == true"
|
||||
- "result.msg is defined"
|
||||
|
||||
- debug: msg="END cli/timeout.yaml"
|
Loading…
Add table
Add a link
Reference in a new issue