mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 22:33:25 +00:00
[PR #5996/24efe9ee backport][stable-6] Normalize bools in tests (#5997)
Normalize bools in tests (#5996)
* Normalize bools in tests.
* Fix typo.
(cherry picked from commit 24efe9ee9a)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
package:
|
||||
name:
|
||||
- iptables
|
||||
become: yes
|
||||
become: true
|
||||
|
||||
|
||||
- name: include tasks
|
||||
@@ -35,4 +35,4 @@
|
||||
- xtables_lock is undefined
|
||||
- ansible_connection in ['ssh', 'paramiko', 'smart']
|
||||
|
||||
become: yes
|
||||
become: true
|
||||
|
||||
@@ -22,14 +22,14 @@
|
||||
iptables_state:
|
||||
name: foobar
|
||||
register: iptables_state
|
||||
ignore_errors: yes
|
||||
ignore_errors: true
|
||||
|
||||
- name: "assert that results are as expected"
|
||||
assert:
|
||||
that:
|
||||
- iptables_state is failed
|
||||
- iptables_state.msg is match("Invalid options")
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
|
||||
|
||||
@@ -37,14 +37,14 @@
|
||||
iptables_state:
|
||||
path: foobar
|
||||
register: iptables_state
|
||||
ignore_errors: yes
|
||||
ignore_errors: true
|
||||
|
||||
- name: "assert that results are as expected"
|
||||
assert:
|
||||
that:
|
||||
- iptables_state is failed
|
||||
- iptables_state.msg is match("missing required arguments")
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
|
||||
|
||||
@@ -52,14 +52,14 @@
|
||||
iptables_state:
|
||||
state: saved
|
||||
register: iptables_state
|
||||
ignore_errors: yes
|
||||
ignore_errors: true
|
||||
|
||||
- name: "assert that results are as expected"
|
||||
assert:
|
||||
that:
|
||||
- iptables_state is failed
|
||||
- iptables_state.msg is match("missing required arguments")
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
|
||||
|
||||
@@ -68,14 +68,14 @@
|
||||
path: foobar
|
||||
state: present
|
||||
register: iptables_state
|
||||
ignore_errors: yes
|
||||
ignore_errors: true
|
||||
|
||||
- name: "assert that results are as expected"
|
||||
assert:
|
||||
that:
|
||||
- iptables_state is failed
|
||||
- iptables_state.msg is match("value of state must be one of")
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
|
||||
#
|
||||
@@ -89,14 +89,14 @@
|
||||
path: "{{ iptables_saved }}"
|
||||
state: saved
|
||||
register: iptables_state
|
||||
check_mode: yes
|
||||
check_mode: true
|
||||
|
||||
- name: "assert that results are as expected"
|
||||
assert:
|
||||
that:
|
||||
- iptables_state is changed
|
||||
- iptables_state.initial_state == iptables_state.saved
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
that:
|
||||
- iptables_state is changed
|
||||
- iptables_state.initial_state == iptables_state.saved
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
that:
|
||||
- iptables_state is not changed
|
||||
- iptables_state.initial_state == iptables_state.saved
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
|
||||
|
||||
@@ -135,14 +135,14 @@
|
||||
path: "{{ iptables_saved }}"
|
||||
state: saved
|
||||
register: iptables_state
|
||||
check_mode: yes
|
||||
check_mode: true
|
||||
|
||||
- name: "assert that results are as expected"
|
||||
assert:
|
||||
that:
|
||||
- iptables_state is not changed
|
||||
- iptables_state.initial_state == iptables_state.saved
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
|
||||
|
||||
@@ -157,14 +157,14 @@
|
||||
path: "{{ iptables_saved }}"
|
||||
state: restored
|
||||
register: iptables_state
|
||||
check_mode: yes
|
||||
check_mode: true
|
||||
|
||||
- name: "assert that results are as expected"
|
||||
assert:
|
||||
that:
|
||||
- iptables_state is not changed
|
||||
- iptables_state.initial_state == iptables_state.restored
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
rescue:
|
||||
- name: "assert that results are not as expected for only one reason (xtables lock)"
|
||||
@@ -172,7 +172,7 @@
|
||||
that:
|
||||
- iptables_state is failed
|
||||
- iptables_state.stderr is search('xtables lock')
|
||||
quiet: yes
|
||||
quiet: true
|
||||
register: xtables_lock
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@
|
||||
that:
|
||||
- iptables_state is not changed
|
||||
- iptables_state.initial_state == iptables_state.restored
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
rescue:
|
||||
- name: "assert that results are not as expected for only one reason (xtables lock)"
|
||||
@@ -198,7 +198,7 @@
|
||||
that:
|
||||
- iptables_state is failed
|
||||
- iptables_state.stderr is search('xtables lock')
|
||||
quiet: yes
|
||||
quiet: true
|
||||
register: xtables_lock
|
||||
|
||||
|
||||
@@ -217,14 +217,14 @@
|
||||
path: "{{ iptables_saved }}"
|
||||
state: restored
|
||||
register: iptables_state
|
||||
check_mode: yes
|
||||
check_mode: true
|
||||
|
||||
- name: "assert that results are as expected"
|
||||
assert:
|
||||
that:
|
||||
- iptables_state is changed
|
||||
- iptables_state.initial_state != iptables_state.restored
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
rescue:
|
||||
- name: "assert that results are not as expected for only one reason (xtables lock)"
|
||||
@@ -232,7 +232,7 @@
|
||||
that:
|
||||
- iptables_state is failed
|
||||
- iptables_state.stderr is search('xtables lock')
|
||||
quiet: yes
|
||||
quiet: true
|
||||
register: xtables_lock
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@
|
||||
- iptables_state is changed
|
||||
- iptables_state.initial_state != iptables_state.restored
|
||||
- iptables_state.applied
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
rescue:
|
||||
- name: "assert that results are not as expected for only one reason (xtables lock)"
|
||||
@@ -261,7 +261,7 @@
|
||||
that:
|
||||
- iptables_state is failed
|
||||
- iptables_state.stderr is search('xtables lock')
|
||||
quiet: yes
|
||||
quiet: true
|
||||
register: xtables_lock
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@
|
||||
that:
|
||||
- iptables_state is not changed
|
||||
- iptables_state.initial_state == iptables_state.restored
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
rescue:
|
||||
- name: "assert that results are not as expected for only one reason (xtables lock)"
|
||||
@@ -289,7 +289,7 @@
|
||||
that:
|
||||
- iptables_state is failed
|
||||
- iptables_state.stderr is search('xtables lock')
|
||||
quiet: yes
|
||||
quiet: true
|
||||
register: xtables_lock
|
||||
|
||||
|
||||
@@ -301,14 +301,14 @@
|
||||
path: "{{ iptables_saved }}"
|
||||
state: restored
|
||||
register: iptables_state
|
||||
check_mode: yes
|
||||
check_mode: true
|
||||
|
||||
- name: "assert that results are as expected"
|
||||
assert:
|
||||
that:
|
||||
- iptables_state is not changed
|
||||
- iptables_state.initial_state == iptables_state.restored
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
rescue:
|
||||
- name: "assert that results are not as expected for only one reason (xtables lock)"
|
||||
@@ -316,5 +316,5 @@
|
||||
that:
|
||||
- iptables_state is failed
|
||||
- iptables_state.stderr is search('xtables lock')
|
||||
quiet: yes
|
||||
quiet: true
|
||||
register: xtables_lock
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
path: "{{ iptables_saved }}"
|
||||
register: iptables_state
|
||||
changed_when: false
|
||||
check_mode: yes
|
||||
check_mode: true
|
||||
|
||||
- name: "assert that results are as expected"
|
||||
assert:
|
||||
@@ -25,7 +25,7 @@
|
||||
- "'*filter' in iptables_state.initial_state"
|
||||
- iptables_state.tables.filter is defined
|
||||
- iptables_state.tables.nat is undefined
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
path: "{{ iptables_saved }}"
|
||||
register: iptables_state
|
||||
changed_when: false
|
||||
check_mode: yes
|
||||
check_mode: true
|
||||
|
||||
- name: "assert that results are as expected"
|
||||
assert:
|
||||
@@ -45,7 +45,7 @@
|
||||
- "'*filter' in iptables_state.initial_state"
|
||||
- iptables_state.tables.nat is defined
|
||||
- iptables_state.tables.filter is undefined
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
- "'*nat' not in iptables_state.saved"
|
||||
- iptables_state.tables.filter is defined
|
||||
- iptables_state.tables.nat is undefined
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
- "'*filter' not in iptables_state.saved"
|
||||
- iptables_state.tables.nat is defined
|
||||
- iptables_state.tables.filter is undefined
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
- "'*nat' in iptables_state.saved"
|
||||
- iptables_state.tables.filter is defined
|
||||
- iptables_state.tables.nat is defined
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
- iptables_state.tables.nat is defined
|
||||
- iptables_state.tables.filter is undefined
|
||||
- iptables_state is not changed
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
- "'-A INPUT -j ACCEPT' not in iptables_state.restored"
|
||||
- iptables_state.tables.filter is undefined
|
||||
- iptables_state is changed
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@
|
||||
- raw
|
||||
- mangle
|
||||
changed_when: false
|
||||
check_mode: yes
|
||||
check_mode: true
|
||||
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@
|
||||
- "'*nat' in iptables_state.saved"
|
||||
- "'raw' in iptables_state.tables"
|
||||
- "'*raw' in iptables_state.saved"
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@
|
||||
- "'*nat' not in iptables_state.restored"
|
||||
- "'*raw' not in iptables_state.restored"
|
||||
- iptables_state is not changed
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@
|
||||
- "'*nat' in iptables_state.restored"
|
||||
- "'*raw' in iptables_state.restored"
|
||||
- iptables_state is not changed
|
||||
quiet: yes
|
||||
quiet: true
|
||||
|
||||
|
||||
|
||||
@@ -279,7 +279,7 @@
|
||||
register: iptables_state
|
||||
async: "{{ ansible_timeout }}"
|
||||
poll: 0
|
||||
ignore_errors: yes
|
||||
ignore_errors: true
|
||||
|
||||
- name: "explain expected failure"
|
||||
assert:
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
path: "{{ iptables_tests }}"
|
||||
state: restored
|
||||
register: iptables_state
|
||||
check_mode: yes
|
||||
check_mode: true
|
||||
|
||||
- name: "assert that results are as expected"
|
||||
assert:
|
||||
|
||||
Reference in New Issue
Block a user