1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/eos_config/tests/cli/check_mode.yaml
Nathaniel Case 0bead3672f eos_config: Fix test issues (#56180)
* Alter tests to pass

* Change diff_against to make changed work again

* Add another diff_against

* Expose supports_sessions across all EOS connection types

* Change session warning to failure

* supports_sessions needs to be a method to survive the rpc boundary

* Alter tests to match
2019-05-09 18:02:24 +05:30

93 lines
2 KiB
YAML

---
- debug:
msg: "START cli/check_mode.yaml on connection={{ ansible_connection }}"
- name: invalid configuration in check mode
eos_config:
lines:
- ip address 119.31.1.1 255.255.255.256
parents: interface Loopback911
become: yes
check_mode: 1
vars:
ansible_eos_use_sessions: 1
register: result
ignore_errors: yes
- assert:
that:
- "result.msg is defined"
- "result.failed == true"
- "'Invalid input' in result.msg"
- name: valid configuration in check mode
eos_config:
before:
- "no ip access-list test"
src: basic/cmds.j2
become: yes
check_mode: yes
register: config
- name: check if session is removed
eos_command:
commands:
- show configuration sessions | json
become: yes
register: result
- assert:
that:
- "config.session not in result.stdout[0].sessions"
- name: configuration in check mode + no config session
eos_config:
lines:
- ip address 119.31.1.1 255.255.255.254
parents: interface Loopback911
become: yes
check_mode: 1
vars:
ansible_eos_use_sessions: 0
register: result
ignore_errors: yes
- assert:
that:
- "result.failed == true"
- name: invalid configuration in check mode + no config session
eos_config:
lines:
- ip address 119.31.1.1 255.255.255.256
parents: interface Loopback911
diff_against: running
become: yes
check_mode: 1
vars:
ansible_eos_use_sessions: 0
register: result
ignore_errors: yes
- assert:
that:
- "result.changed == true"
- name: valid configuration in check mode + no config session
eos_config:
lines:
- ip address 119.31.1.1 255.255.255.255
parents: interface Loopback911
diff_against: running
become: yes
check_mode: yes
register: result
vars:
ansible_eos_use_sessions: 0
- assert:
that:
- "result.changed == true"
- "'session' not in result"
- debug: msg="END cli/check_mode.yaml on connection={{ ansible_connection }}"