|
|
|
@ -193,3 +193,77 @@
|
|
|
|
|
assert:
|
|
|
|
|
that:
|
|
|
|
|
- "result.skipped == true"
|
|
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
|
# proper booleanification tests (issue #8629)
|
|
|
|
|
|
|
|
|
|
- name: set fact to string 'false'
|
|
|
|
|
set_fact: bool_test1=false
|
|
|
|
|
|
|
|
|
|
- name: set fact to string 'False'
|
|
|
|
|
set_fact: bool_test2=False
|
|
|
|
|
|
|
|
|
|
- name: set fact to a proper boolean using complex args
|
|
|
|
|
set_fact:
|
|
|
|
|
bool_test3: false
|
|
|
|
|
|
|
|
|
|
- name: "test boolean value 'false' string using 'when: var'"
|
|
|
|
|
command: echo 'hi'
|
|
|
|
|
when: bool_test1
|
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
- name: assert that the task did not run for 'false'
|
|
|
|
|
assert:
|
|
|
|
|
that:
|
|
|
|
|
- "result.skipped == true"
|
|
|
|
|
|
|
|
|
|
- name: "test boolean value 'false' string using 'when: not var'"
|
|
|
|
|
command: echo 'hi'
|
|
|
|
|
when: not bool_test1
|
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
- name: assert that the task DID run for not 'false'
|
|
|
|
|
assert:
|
|
|
|
|
that:
|
|
|
|
|
- "result.changed"
|
|
|
|
|
|
|
|
|
|
- name: "test boolean value of 'False' string using 'when: var'"
|
|
|
|
|
command: echo 'hi'
|
|
|
|
|
when: bool_test2
|
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
- name: assert that the task did not run for 'False'
|
|
|
|
|
assert:
|
|
|
|
|
that:
|
|
|
|
|
- "result.skipped == true"
|
|
|
|
|
|
|
|
|
|
- name: "test boolean value 'False' string using 'when: not var'"
|
|
|
|
|
command: echo 'hi'
|
|
|
|
|
when: not bool_test2
|
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
- name: assert that the task DID run for not 'False'
|
|
|
|
|
assert:
|
|
|
|
|
that:
|
|
|
|
|
- "result.changed"
|
|
|
|
|
|
|
|
|
|
- name: "test proper boolean value of complex arg using 'when: var'"
|
|
|
|
|
command: echo 'hi'
|
|
|
|
|
when: bool_test3
|
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
- name: assert that the task did not run for proper boolean false
|
|
|
|
|
assert:
|
|
|
|
|
that:
|
|
|
|
|
- "result.skipped == true"
|
|
|
|
|
|
|
|
|
|
- name: "test proper boolean value of complex arg using 'when: not var'"
|
|
|
|
|
command: echo 'hi'
|
|
|
|
|
when: not bool_test3
|
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
- name: assert that the task DID run for not false
|
|
|
|
|
assert:
|
|
|
|
|
that:
|
|
|
|
|
- "result.changed"
|
|
|
|
|
|
|
|
|
|