mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00: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:
@@ -0,0 +1,20 @@
|
||||
---
|
||||
- debug: msg="START cli/bad_operator.yaml"
|
||||
|
||||
- name: test bad operator
|
||||
vyos_command:
|
||||
commands:
|
||||
- show version
|
||||
- show interfaces
|
||||
wait_for:
|
||||
- result[0] is 'VyOS'
|
||||
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,21 @@
|
||||
---
|
||||
- debug: msg="START cli/contains.yaml"
|
||||
|
||||
- name: test contains operator
|
||||
vyos_command:
|
||||
commands:
|
||||
- show version
|
||||
- show interface
|
||||
wait_for:
|
||||
- result[0] contains VyOS
|
||||
- result[1] contains eth0
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
- result.stdout is defined
|
||||
- result.stdout_lines is defined
|
||||
|
||||
- debug: msg="END cli/contains.yaml"
|
||||
24
test/integration/targets/vyos_command/tests/cli/invalid.yaml
Normal file
24
test/integration/targets/vyos_command/tests/cli/invalid.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
- debug: msg="START cli/invalid.yaml"
|
||||
|
||||
- name: run invalid command
|
||||
vyos_command:
|
||||
commands: show foo
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert: { that: result.failed }
|
||||
|
||||
- name: run commands that include invalid command
|
||||
vyos_command:
|
||||
commands:
|
||||
- show version
|
||||
- show foo
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert: { that: result.failed }
|
||||
|
||||
- debug: msg="END cli/invalid.yaml"
|
||||
30
test/integration/targets/vyos_command/tests/cli/output.yaml
Normal file
30
test/integration/targets/vyos_command/tests/cli/output.yaml
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
- debug: msg="START cli/output.yaml"
|
||||
|
||||
- name: get output for single command
|
||||
vyos_command:
|
||||
commands: show version
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
- result.stdout is defined
|
||||
- result.stdout_lines is defined
|
||||
|
||||
- name: get output for multiple commands
|
||||
vyos_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"
|
||||
19
test/integration/targets/vyos_command/tests/cli/timeout.yaml
Normal file
19
test/integration/targets/vyos_command/tests/cli/timeout.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
- debug: msg="START cli/timeout.yaml"
|
||||
|
||||
- name: test bad condition
|
||||
vyos_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"
|
||||
Reference in New Issue
Block a user