mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
More test fixes for split controller/remote tests.
This commit is contained in:
parent
73636175da
commit
a8116497ba
49 changed files with 217 additions and 135 deletions
|
@ -84,7 +84,7 @@
|
|||
- debug: msg="TEST COMPLETE"
|
||||
|
||||
- name: block with includes
|
||||
hosts: localhost
|
||||
hosts: testhost
|
||||
gather_facts: yes
|
||||
strategy: "{{test_strategy|default('linear')}}"
|
||||
vars:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
# Run withhout --check
|
||||
- hosts: localhost
|
||||
- hosts: testhost
|
||||
gather_facts: False
|
||||
tasks:
|
||||
- command: 'echo ran'
|
||||
|
@ -12,7 +12,7 @@
|
|||
that:
|
||||
- '"ran" in command_out["stdout"]'
|
||||
|
||||
- hosts: localhost
|
||||
- hosts: testhost
|
||||
gather_facts: False
|
||||
check_mode: True
|
||||
tasks:
|
||||
|
@ -24,7 +24,7 @@
|
|||
that:
|
||||
- '"check mode" in command_out["msg"]'
|
||||
|
||||
- hosts: localhost
|
||||
- hosts: testhost
|
||||
gather_facts: False
|
||||
tasks:
|
||||
- command: 'echo ran'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
# Run with --check
|
||||
- hosts: localhost
|
||||
- hosts: testhost
|
||||
gather_facts: False
|
||||
tasks:
|
||||
- command: 'echo ran'
|
||||
|
@ -11,7 +11,7 @@
|
|||
that:
|
||||
- '"check mode" in command_out["msg"]'
|
||||
|
||||
- hosts: localhost
|
||||
- hosts: testhost
|
||||
gather_facts: False
|
||||
check_mode: False
|
||||
tasks:
|
||||
|
@ -23,7 +23,7 @@
|
|||
that:
|
||||
- '"ran" in command_out["stdout"]'
|
||||
|
||||
- hosts: localhost
|
||||
- hosts: testhost
|
||||
gather_facts: False
|
||||
tasks:
|
||||
- command: 'echo ran'
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
- hosts: testhost
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- name: get PATH from target
|
||||
command: echo $PATH
|
||||
register: target_path
|
||||
|
||||
- hosts: testhost
|
||||
vars:
|
||||
- test1:
|
||||
|
@ -9,7 +16,7 @@
|
|||
- name: ensure special case with ansible_env is skipped but others still work
|
||||
assert:
|
||||
that:
|
||||
- lookup('env', 'PATH') == ansible_env.PATH
|
||||
- target_path.stdout == ansible_env.PATH
|
||||
- "'/lola' not in ansible_env.PATH"
|
||||
- ansible_env.lola == 'ido'
|
||||
|
||||
|
|
|
@ -396,8 +396,8 @@
|
|||
- name: Test headers string
|
||||
assert:
|
||||
that:
|
||||
- (result["content"] | b64decode | from_json).headers.get('Foo') == 'bar'
|
||||
- (result["content"] | b64decode | from_json).headers.get('Baz') == 'qux'
|
||||
- (result.content | b64decode | from_json).headers.get('Foo') == 'bar'
|
||||
- (result.content | b64decode | from_json).headers.get('Baz') == 'qux'
|
||||
|
||||
- name: Test headers string invalid format
|
||||
get_url:
|
||||
|
@ -425,8 +425,8 @@
|
|||
- name: Test headers dict
|
||||
assert:
|
||||
that:
|
||||
- (result["content"] | b64decode | from_json).headers.get('Foo') == 'bar'
|
||||
- (result["content"] | b64decode | from_json).headers.get('Baz') == 'qux'
|
||||
- (result.content | b64decode | from_json).headers.get('Foo') == 'bar'
|
||||
- (result.content | b64decode | from_json).headers.get('Baz') == 'qux'
|
||||
|
||||
- name: Test client cert auth, with certs
|
||||
get_url:
|
||||
|
@ -444,5 +444,5 @@
|
|||
- name: Assert that the ssl_client_verify file contains the correct content
|
||||
assert:
|
||||
that:
|
||||
- '(result["content"] | b64decode) == "ansible.http.tests:SUCCESS"'
|
||||
- '(result.content | b64decode) == "ansible.http.tests:SUCCESS"'
|
||||
when: has_httptester
|
||||
|
|
|
@ -169,7 +169,7 @@
|
|||
- name: DEPTH | check update arrived
|
||||
assert:
|
||||
that:
|
||||
- "{{ a_file['content'] | b64decode | trim }} == 3"
|
||||
- "{{ a_file.content | b64decode | trim }} == 3"
|
||||
- git_fetch is changed
|
||||
|
||||
- name: DEPTH | clear checkout_dir
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
- name: LOCALMODS | check update arrived
|
||||
assert:
|
||||
that:
|
||||
- "{{ a_file['content'] | b64decode | trim }} == 2"
|
||||
- "{{ a_file.content | b64decode | trim }} == 2"
|
||||
- git_fetch_force is changed
|
||||
|
||||
- name: LOCALMODS | clear checkout_dir
|
||||
|
@ -105,7 +105,7 @@
|
|||
- name: LOCALMODS | check update arrived
|
||||
assert:
|
||||
that:
|
||||
- "{{ a_file['content'] | b64decode | trim }} == 2"
|
||||
- "{{ a_file.content | b64decode | trim }} == 2"
|
||||
- git_fetch_force is changed
|
||||
|
||||
- name: LOCALMODS | clear checkout_dir
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
|
||||
- name: debug hash behaviour result
|
||||
debug:
|
||||
var: ansible_env.ANSIBLE_HASH_BEHAVIOUR
|
||||
var: "{{ lookup('env', 'ANSIBLE_HASH_BEHAVIOUR') }}"
|
||||
verbosity: 2
|
||||
|
||||
- name: assert hash behaviour is merge or replace
|
||||
assert:
|
||||
that:
|
||||
- ansible_env.ANSIBLE_HASH_BEHAVIOUR in ('merge', 'replace')
|
||||
- lookup('env', 'ANSIBLE_HASH_BEHAVIOUR') in ('merge', 'replace')
|
||||
|
||||
- name: debug test_hash var
|
||||
debug:
|
||||
|
@ -34,4 +34,4 @@
|
|||
- name: assert the dictionary values match
|
||||
assert:
|
||||
that:
|
||||
- "ansible_env.ANSIBLE_HASH_BEHAVIOUR == 'merge' and test_hash == merged_hash or ansible_env.ANSIBLE_HASH_BEHAVIOUR == 'replace' and test_hash == replaced_hash"
|
||||
- "lookup('env', 'ANSIBLE_HASH_BEHAVIOUR') == 'merge' and test_hash == merged_hash or lookup('env', 'ANSIBLE_HASH_BEHAVIOUR') == 'replace' and test_hash == replaced_hash"
|
||||
|
|
2
test/integration/targets/ini_file/meta/main.yml
Normal file
2
test/integration/targets/ini_file/meta/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- setup_remote_tmp_dir
|
|
@ -18,7 +18,7 @@
|
|||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: record the output directory
|
||||
set_fact: output_file={{output_dir}}/foo.ini
|
||||
set_fact: output_file={{ remote_tmp_dir }}/foo.ini
|
||||
|
||||
- name: add "fav=lemonade" is in section "[drinks]" in specified file
|
||||
ini_file:
|
||||
|
@ -34,13 +34,18 @@
|
|||
- result1.changed == True
|
||||
- result1.msg == 'section and option added'
|
||||
|
||||
- name: read content from output file
|
||||
slurp:
|
||||
src: "{{ output_file }}"
|
||||
register: output_content
|
||||
|
||||
- name: set expected content and get current ini file content
|
||||
set_fact:
|
||||
expected1: |-
|
||||
expected1: |
|
||||
|
||||
[drinks]
|
||||
fav = lemonade
|
||||
content1: "{{ lookup('file', output_file) }}"
|
||||
content1: "{{ output_content.content | b64decode }}"
|
||||
|
||||
- name: Verify content of ini file is as expected
|
||||
assert:
|
||||
|
@ -69,14 +74,19 @@
|
|||
value: coke
|
||||
register: result3
|
||||
|
||||
- name: read content from output file
|
||||
slurp:
|
||||
src: "{{ output_file }}"
|
||||
register: output_content
|
||||
|
||||
- name: set expected content and get current ini file content
|
||||
set_fact:
|
||||
expected3: |-
|
||||
expected3: |
|
||||
|
||||
[drinks]
|
||||
fav = lemonade
|
||||
beverage = coke
|
||||
content3: "{{ lookup('file', output_file) }}"
|
||||
content3: "{{ output_content.content | b64decode }}"
|
||||
|
||||
- name: assert 'changed' is true and content is OK
|
||||
assert:
|
||||
|
@ -93,9 +103,14 @@
|
|||
state: absent
|
||||
register: result4
|
||||
|
||||
- name: read content from output file
|
||||
slurp:
|
||||
src: "{{ output_file }}"
|
||||
register: output_content
|
||||
|
||||
- name: get ini file content
|
||||
set_fact:
|
||||
content4: "{{ lookup('file', output_file) }}"
|
||||
content4: "{{ output_content.content | b64decode }}"
|
||||
|
||||
- name: assert changed and content is as expected
|
||||
assert:
|
||||
|
@ -111,16 +126,21 @@
|
|||
state: absent
|
||||
register: result5
|
||||
|
||||
- name: read content from output file
|
||||
slurp:
|
||||
src: "{{ output_file }}"
|
||||
register: output_content
|
||||
|
||||
- name: get current ini file content
|
||||
set_fact:
|
||||
content5: "{{ lookup('file', output_file) }}"
|
||||
content5: "{{ output_content.content | b64decode }}"
|
||||
|
||||
- name: assert changed and content is empty
|
||||
assert:
|
||||
that:
|
||||
- result5.changed == True
|
||||
- result5.msg == 'section removed'
|
||||
- content5 == ""
|
||||
- content5 == "\n"
|
||||
|
||||
# allow_no_value
|
||||
|
||||
|
@ -163,10 +183,15 @@
|
|||
- { o: "skip-name-resolve", v: null }
|
||||
- { o: "max_connections", v: "500" }
|
||||
|
||||
- name: read content from output file
|
||||
slurp:
|
||||
src: "{{ output_file }}"
|
||||
register: output_content
|
||||
|
||||
- name: set expected content and get current ini file content
|
||||
set_fact:
|
||||
content7: "{{ lookup('file', output_file) }}"
|
||||
expected7: |-
|
||||
content7: "{{ output_content.content | b64decode }}"
|
||||
expected7: |
|
||||
|
||||
[mysqld]
|
||||
skip-name
|
||||
|
@ -186,10 +211,15 @@
|
|||
value: myvalue
|
||||
register: result8
|
||||
|
||||
- name: read content from output file
|
||||
slurp:
|
||||
src: "{{ output_file }}"
|
||||
register: output_content
|
||||
|
||||
- name: set expected content and get current ini file content
|
||||
set_fact:
|
||||
content8: "{{ lookup('file', output_file) }}"
|
||||
expected8: |-
|
||||
content8: "{{ output_content.content | b64decode }}"
|
||||
expected8: |
|
||||
|
||||
[mysqld]
|
||||
skip-name = myvalue
|
||||
|
@ -211,10 +241,15 @@
|
|||
allow_no_value: yes
|
||||
register: result9
|
||||
|
||||
- name: read content from output file
|
||||
slurp:
|
||||
src: "{{ output_file }}"
|
||||
register: output_content
|
||||
|
||||
- name: set expected content and get current ini file content
|
||||
set_fact:
|
||||
content9: "{{ lookup('file', output_file) }}"
|
||||
expected9: |-
|
||||
content9: "{{ output_content.content | b64decode }}"
|
||||
expected9: |
|
||||
|
||||
[mysqld]
|
||||
skip-name
|
||||
|
@ -236,10 +271,15 @@
|
|||
state: absent
|
||||
register: result10
|
||||
|
||||
- name: read content from output file
|
||||
slurp:
|
||||
src: "{{ output_file }}"
|
||||
register: output_content
|
||||
|
||||
- name: set expected content and get current ini file content
|
||||
set_fact:
|
||||
content10: "{{ lookup('file', output_file) }}"
|
||||
expected10: |-
|
||||
content10: "{{ output_content.content | b64decode }}"
|
||||
expected10: |
|
||||
|
||||
[mysqld]
|
||||
skip-name
|
||||
|
@ -266,10 +306,15 @@
|
|||
value: coke
|
||||
register: result11
|
||||
|
||||
- name: read content from output file
|
||||
slurp:
|
||||
src: "{{ output_file }}"
|
||||
register: output_content
|
||||
|
||||
- name: set expected content and get current ini file content
|
||||
set_fact:
|
||||
expected11: "beverage = coke"
|
||||
content11: "{{ lookup('file', output_file) }}"
|
||||
expected11: "beverage = coke\n\n"
|
||||
content11: "{{ output_content.content | b64decode }}"
|
||||
|
||||
- name: assert 'changed' is true and content is OK (no section)
|
||||
assert:
|
||||
|
@ -286,11 +331,16 @@
|
|||
section:
|
||||
register: result12
|
||||
|
||||
- name: read content from output file
|
||||
slurp:
|
||||
src: "{{ output_file }}"
|
||||
register: output_content
|
||||
|
||||
- name: set expected content and get current ini file content
|
||||
set_fact:
|
||||
expected12: "beverage = water"
|
||||
expected12: "beverage = water\n\n"
|
||||
|
||||
content12: "{{ lookup('file', output_file) }}"
|
||||
content12: "{{ output_content.content | b64decode }}"
|
||||
|
||||
- name: assert 'changed' is true and content is OK (no section)
|
||||
assert:
|
||||
|
@ -307,16 +357,21 @@
|
|||
state: absent
|
||||
register: result13
|
||||
|
||||
- name: read content from output file
|
||||
slurp:
|
||||
src: "{{ output_file }}"
|
||||
register: output_content
|
||||
|
||||
- name: get current ini file content
|
||||
set_fact:
|
||||
content13: "{{ lookup('file', output_file) }}"
|
||||
content13: "{{ output_content.content | b64decode }}"
|
||||
|
||||
- name: assert changed (no section)
|
||||
assert:
|
||||
that:
|
||||
- result13 is changed
|
||||
- result13.msg == 'option changed'
|
||||
- content13 == ""
|
||||
- content13 == "\n"
|
||||
|
||||
- name: Check add option without section before existing section
|
||||
block:
|
||||
|
@ -333,14 +388,19 @@
|
|||
option: like
|
||||
value: tea
|
||||
|
||||
- name: read content from output file
|
||||
slurp:
|
||||
src: "{{ output_file }}"
|
||||
register: output_content
|
||||
|
||||
- name: set expected content and get current ini file content
|
||||
set_fact:
|
||||
expected14: |-
|
||||
expected14: |
|
||||
like = tea
|
||||
|
||||
[drinks]
|
||||
beverage = water
|
||||
content14: "{{ lookup('file', output_file) }}"
|
||||
content14: "{{ output_content.content | b64decode }}"
|
||||
|
||||
- name: Verify content of ini file is as expected
|
||||
assert:
|
||||
|
|
1
test/integration/targets/iterators/files/bar1
Normal file
1
test/integration/targets/iterators/files/bar1
Normal file
|
@ -0,0 +1 @@
|
|||
bar
|
1
test/integration/targets/iterators/files/foo1
Normal file
1
test/integration/targets/iterators/files/foo1
Normal file
|
@ -0,0 +1 @@
|
|||
foo
|
|
@ -201,25 +201,19 @@
|
|||
|
||||
# WITH_FIRST_FOUND
|
||||
|
||||
- name: create file for test
|
||||
shell: echo "foo" > {{ output_dir }}/foo1
|
||||
|
||||
- name: create file for test
|
||||
shell: echo "bar" > {{ output_dir }}/bar1
|
||||
|
||||
- name: test with_first_found
|
||||
#shell: echo {{ item }}
|
||||
set_fact: "first_found={{ item }}"
|
||||
with_first_found:
|
||||
- "{{ output_dir + '/does_not_exist' }}"
|
||||
- "{{ output_dir + '/foo1' }}"
|
||||
- "{{ output_dir + '/bar1' }}"
|
||||
- "{{ role_path + '/files/does_not_exist' }}"
|
||||
- "{{ role_path + '/files/foo1' }}"
|
||||
- "{{ role_path + '/files/bar1' }}"
|
||||
|
||||
- name: set expected
|
||||
set_fact: first_expected="{{ output_dir | expanduser + '/foo1' }}"
|
||||
set_fact: first_expected="{{ role_path + '/files/foo1' }}"
|
||||
|
||||
- name: set unexpected
|
||||
set_fact: first_unexpected="{{ output_dir | expanduser + '/bar1' }}"
|
||||
set_fact: first_unexpected="{{ role_path + '/files/bar1' }}"
|
||||
|
||||
- name: verify with_first_found results
|
||||
assert:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- hosts: localhost
|
||||
- hosts: testhost
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- name: Use standard ping module
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- hosts: localhost
|
||||
- hosts: testhost
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- name: Use ping from library path
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- hosts: localhost
|
||||
- hosts: testhost
|
||||
gather_facts: no
|
||||
vars:
|
||||
expected_location: "role: foo"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- hosts: localhost
|
||||
- hosts: testhost
|
||||
gather_facts: no
|
||||
vars:
|
||||
expected_location: "role: bar"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- hosts: localhost
|
||||
- hosts: testhost
|
||||
gather_facts: no
|
||||
roles:
|
||||
- foo
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- hosts: localhost
|
||||
- hosts: testhost
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- name: Use a specially crafted module to see if things were imported correctly
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- hosts: localhost
|
||||
- hosts: testhost
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- name: Use a specially crafted module to see if things were imported correctly
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- setup_remote_tmp_dir
|
|
@ -27,8 +27,13 @@
|
|||
that:
|
||||
- 'goodbye_ansible.msg == "Goodbye, Ansible!"'
|
||||
|
||||
- name: Copy module to remote
|
||||
copy:
|
||||
src: "{{ role_path }}/library/helloworld.sh"
|
||||
dest: "{{ remote_tmp_dir }}/helloworld.sh"
|
||||
|
||||
- name: Execute module directly
|
||||
command: '/bin/sh {{ role_path }}/library/helloworld.sh'
|
||||
command: '/bin/sh {{ remote_tmp_dir }}/helloworld.sh'
|
||||
register: direct
|
||||
ignore_errors: true
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- hosts: localhost
|
||||
- hosts: testhost
|
||||
serial: "{{ testing_omitted_variable | default(omit) }}"
|
||||
tasks:
|
||||
- debug:
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
setup/always/setup_pexpect
|
||||
needs/target/setup_pexpect
|
||||
shippable/posix/group3
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- name: Test pause module in default state
|
||||
hosts: testhost
|
||||
hosts: localhost
|
||||
become: no
|
||||
gather_facts: no
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- name: Test pause module with custom prompt
|
||||
hosts: testhost
|
||||
hosts: localhost
|
||||
become: no
|
||||
gather_facts: no
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- name: Test pause module with pause
|
||||
hosts: testhost
|
||||
hosts: localhost
|
||||
become: no
|
||||
gather_facts: no
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- name: Test pause module with pause and custom prompt
|
||||
hosts: testhost
|
||||
hosts: localhost
|
||||
become: no
|
||||
gather_facts: no
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- name: Test pause module echo output
|
||||
hosts: testhost
|
||||
hosts: localhost
|
||||
become: no
|
||||
gather_facts: no
|
||||
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
|
||||
set -eux
|
||||
|
||||
ANSIBLE_ROLES_PATH=../ ansible-playbook setup.yml
|
||||
|
||||
# Test pause module when no tty and non-interactive. This is to prevent playbooks
|
||||
# from hanging in cron and Tower jobs.
|
||||
/usr/bin/env bash << EOF
|
||||
ansible-playbook test-pause-no-tty.yml -i ../../inventory 2>&1 | \
|
||||
ansible-playbook test-pause-no-tty.yml 2>&1 | \
|
||||
grep '\[WARNING\]: Not waiting for response to prompt as stdin is not interactive' && {
|
||||
echo 'Successfully skipped pause in no TTY mode' >&2
|
||||
exit 0
|
||||
|
@ -17,12 +19,12 @@ EOF
|
|||
|
||||
# Test redirecting stdout
|
||||
# Issue #41717
|
||||
ansible-playbook pause-3.yml -i ../../inventory > /dev/null \
|
||||
ansible-playbook pause-3.yml > /dev/null \
|
||||
&& echo "Successfully redirected stdout" \
|
||||
|| echo "Failure when attempting to redirect stdout"
|
||||
|
||||
# Test pause with seconds and minutes specified
|
||||
ansible-playbook test-pause.yml -i ../../inventory "$@"
|
||||
ansible-playbook test-pause.yml "$@"
|
||||
|
||||
# Interactively test pause
|
||||
python test-pause.py -i ../../inventory "$@"
|
||||
python test-pause.py "$@"
|
||||
|
|
4
test/integration/targets/pause/setup.yml
Normal file
4
test/integration/targets/pause/setup.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
- hosts: localhost
|
||||
gather_facts: no
|
||||
roles:
|
||||
- setup_pexpect
|
|
@ -1,5 +1,5 @@
|
|||
- name: Test pause
|
||||
hosts: testhost
|
||||
hosts: localhost
|
||||
gather_facts: no
|
||||
become: no
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- name: Test pause
|
||||
hosts: testhost
|
||||
hosts: localhost
|
||||
gather_facts: no
|
||||
become: no
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
unique: no
|
||||
delimiter: ';'
|
||||
register: users_nonunique
|
||||
delegate_to: localhost
|
||||
|
||||
- assert:
|
||||
that:
|
||||
|
@ -96,7 +95,6 @@
|
|||
dag,500,500,Dag Wieërs
|
||||
jeroen,501,500,Jeroen Hoekx
|
||||
dest: users_noheader.csv
|
||||
delegate_to: localhost
|
||||
|
||||
# Read a CSV file and access user 'dag'
|
||||
- name: Read users from CSV file and return a dictionary
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
assert:
|
||||
that:
|
||||
- "script_result0.rc == 0"
|
||||
- "script_result0.stderr == ''"
|
||||
- "script_result0.stdout == 'win'"
|
||||
|
||||
- name: Execute a script with a space in the path
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
shippable/posix/group1
|
||||
needs/root
|
||||
|
|
|
@ -22,24 +22,23 @@
|
|||
- default
|
||||
register: client
|
||||
|
||||
- name: Retrieve configuration file stat
|
||||
stat:
|
||||
path: "{{ client_file }}"
|
||||
register: client_stat
|
||||
- name: Retrieve configuration file
|
||||
slurp:
|
||||
src: "{{ client_file }}"
|
||||
register: client_config
|
||||
|
||||
- name: Assert that client data was set successfully and properly
|
||||
assert:
|
||||
that:
|
||||
- "client is successful"
|
||||
- "client is changed"
|
||||
- "client_stat.stat.exists == true"
|
||||
- "client['config']['name'] == 'client'"
|
||||
- "'default' in client['config']['subscriptions']"
|
||||
- "client['file'] == client_file"
|
||||
|
||||
- name: Assert that the client configuration file is actually configured properly
|
||||
vars:
|
||||
config: "{{ lookup('file', client_file) | from_json }}"
|
||||
config: "{{ client_config.content | b64decode | from_json }}"
|
||||
assert:
|
||||
that:
|
||||
- "config['client']['keepalives'] == true"
|
||||
|
@ -129,10 +128,10 @@
|
|||
occurrences: "3"
|
||||
register: client_twice
|
||||
|
||||
- name: Retrieve configuration file stat
|
||||
stat:
|
||||
path: "{{ client_file }}"
|
||||
register: client_stat
|
||||
- name: Retrieve configuration file
|
||||
slurp:
|
||||
src: "{{ client_file }}"
|
||||
register: client_config
|
||||
|
||||
- name: Assert that client data was set successfully and properly
|
||||
assert:
|
||||
|
@ -141,7 +140,6 @@
|
|||
- "client is changed"
|
||||
- "client_twice is successful"
|
||||
- "client_twice is not changed"
|
||||
- "client_stat.stat.exists == true"
|
||||
- "client['config']['name'] == 'custom'"
|
||||
- "client['config']['address'] == 'host.fqdn'"
|
||||
- "'default' in client['config']['subscriptions']"
|
||||
|
@ -155,7 +153,7 @@
|
|||
|
||||
- name: Assert that the client configuration file is actually configured properly
|
||||
vars:
|
||||
config: "{{ lookup('file', client_file) | from_json }}"
|
||||
config: "{{ client_config.content | b64decode | from_json }}"
|
||||
assert:
|
||||
that:
|
||||
- "config['client']['name'] == 'custom'"
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
shippable/posix/group1
|
||||
needs/root
|
||||
|
|
|
@ -28,10 +28,10 @@
|
|||
state: "present"
|
||||
register: handler_twice
|
||||
|
||||
- name: Retrieve configuration file stat
|
||||
stat:
|
||||
path: "{{ handler['file'] }}"
|
||||
register: handler_stat
|
||||
- name: Retrieve configuration file
|
||||
slurp:
|
||||
src: "{{ handler['file'] }}"
|
||||
register: handler_config
|
||||
|
||||
- name: Assert that handler data was set successfully and properly
|
||||
assert:
|
||||
|
@ -40,7 +40,6 @@
|
|||
- "handler is changed"
|
||||
- "handler_twice is successful"
|
||||
- "handler_twice is not changed"
|
||||
- "handler_stat.stat.exists == true"
|
||||
- "handler['name'] == 'handler'"
|
||||
- "handler['file'] == '/etc/sensu/conf.d/handlers/handler.json'"
|
||||
- "handler['config']['type'] == 'pipe'"
|
||||
|
@ -51,7 +50,7 @@
|
|||
|
||||
- name: Assert that the handler configuration file is actually configured properly
|
||||
vars:
|
||||
config: "{{ lookup('file', handler['file']) | from_json }}"
|
||||
config: "{{ handler_config.content | b64decode | from_json }}"
|
||||
assert:
|
||||
that:
|
||||
- "'handler' in config['handlers']"
|
||||
|
|
|
@ -19,17 +19,16 @@
|
|||
- anotherhandler
|
||||
register: handler
|
||||
|
||||
- name: Retrieve configuration file stat
|
||||
stat:
|
||||
path: "{{ handler['file'] }}"
|
||||
register: handler_stat
|
||||
- name: Retrieve configuration file
|
||||
slurp:
|
||||
src: "{{ handler['file'] }}"
|
||||
register: handler_config
|
||||
|
||||
- name: Validate set handler return data
|
||||
assert:
|
||||
that:
|
||||
- "handler is successful"
|
||||
- "handler is changed"
|
||||
- "handler_stat.stat.exists == true"
|
||||
- "handler['name'] == 'set'"
|
||||
- "handler['file'] == '/etc/sensu/conf.d/handlers/set.json'"
|
||||
- "handler['config']['type'] == 'set'"
|
||||
|
@ -39,7 +38,7 @@
|
|||
|
||||
- name: Assert that the handler configuration file is actually configured properly
|
||||
vars:
|
||||
config: "{{ lookup('file', handler['file']) | from_json }}"
|
||||
config: "{{ handler_config.content | b64decode | from_json }}"
|
||||
assert:
|
||||
that:
|
||||
- "'set' in config['handlers']"
|
||||
|
|
|
@ -20,17 +20,16 @@
|
|||
port: 8000
|
||||
register: handler
|
||||
|
||||
- name: Retrieve configuration file stat
|
||||
stat:
|
||||
path: "{{ handler['file'] }}"
|
||||
register: handler_stat
|
||||
- name: Retrieve configuration file
|
||||
slurp:
|
||||
src: "{{ handler['file'] }}"
|
||||
register: handler_config
|
||||
|
||||
- name: Validate tcp handler return data
|
||||
assert:
|
||||
that:
|
||||
- "handler is successful"
|
||||
- "handler is changed"
|
||||
- "handler_stat.stat.exists == true"
|
||||
- "handler['name'] == 'tcp'"
|
||||
- "handler['file'] == '/etc/sensu/conf.d/handlers/tcp.json'"
|
||||
- "handler['config']['type'] == 'tcp'"
|
||||
|
@ -41,7 +40,7 @@
|
|||
|
||||
- name: Assert that the handler configuration file is actually configured properly
|
||||
vars:
|
||||
config: "{{ lookup('file', handler['file']) | from_json }}"
|
||||
config: "{{ handler_config.content | b64decode | from_json }}"
|
||||
assert:
|
||||
that:
|
||||
- "'tcp' in config['handlers']"
|
||||
|
|
|
@ -20,17 +20,16 @@
|
|||
name: "transport_handler"
|
||||
register: handler
|
||||
|
||||
- name: Retrieve configuration file stat
|
||||
stat:
|
||||
path: "{{ handler['file'] }}"
|
||||
register: handler_stat
|
||||
- name: Retrieve configuration file
|
||||
slurp:
|
||||
src: "{{ handler['file'] }}"
|
||||
register: handler_config
|
||||
|
||||
- name: Validate transport handler return data
|
||||
assert:
|
||||
that:
|
||||
- "handler is successful"
|
||||
- "handler is changed"
|
||||
- "handler_stat.stat.exists == true"
|
||||
- "handler['name'] == 'transport'"
|
||||
- "handler['file'] == '/etc/sensu/conf.d/handlers/transport.json'"
|
||||
- "handler['config']['type'] == 'transport'"
|
||||
|
@ -41,7 +40,7 @@
|
|||
|
||||
- name: Assert that the handler configuration file is actually configured properly
|
||||
vars:
|
||||
config: "{{ lookup('file', handler['file']) | from_json }}"
|
||||
config: "{{ handler_config.content | b64decode | from_json }}"
|
||||
assert:
|
||||
that:
|
||||
- "'transport' in config['handlers']"
|
||||
|
|
|
@ -20,17 +20,16 @@
|
|||
port: 8000
|
||||
register: handler
|
||||
|
||||
- name: Retrieve configuration file stat
|
||||
stat:
|
||||
path: "{{ handler['file'] }}"
|
||||
register: handler_stat
|
||||
- name: Retrieve configuration file
|
||||
slurp:
|
||||
src: "{{ handler['file'] }}"
|
||||
register: handler_config
|
||||
|
||||
- name: Validate udp handler return data
|
||||
assert:
|
||||
that:
|
||||
- "handler is successful"
|
||||
- "handler is changed"
|
||||
- "handler_stat.stat.exists == true"
|
||||
- "handler['name'] == 'udp'"
|
||||
- "handler['file'] == '/etc/sensu/conf.d/handlers/udp.json'"
|
||||
- "handler['config']['type'] == 'udp'"
|
||||
|
@ -41,7 +40,7 @@
|
|||
|
||||
- name: Assert that the handler configuration file is actually configured properly
|
||||
vars:
|
||||
config: "{{ lookup('file', handler['file']) | from_json }}"
|
||||
config: "{{ handler_config.content | b64decode | from_json }}"
|
||||
assert:
|
||||
that:
|
||||
- "'udp' in config['handlers']"
|
||||
|
|
2
test/integration/targets/task_ordering/meta/main.yml
Normal file
2
test/integration/targets/task_ordering/meta/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- setup_remote_tmp_dir
|
|
@ -1,12 +1,15 @@
|
|||
- shell: mktemp
|
||||
register: temppath
|
||||
- set_fact:
|
||||
temppath: "{{ remote_tmp_dir }}/output.txt"
|
||||
|
||||
- include: taskorder-include.yml
|
||||
with_items:
|
||||
- 1
|
||||
- 2
|
||||
- 3
|
||||
|
||||
- assert:
|
||||
that: lookup('file', temppath.stdout) == "one.1.two.1.three.1.four.1.one.2.two.2.three.2.four.2.one.3.two.3.three.3.four.3."
|
||||
- slurp:
|
||||
src: "{{ temppath }}"
|
||||
register: tempout
|
||||
|
||||
- file: path="{{temppath.stdout}}" state=absent
|
||||
- assert:
|
||||
that: tempout.content | b64decode == "one.1.two.1.three.1.four.1.one.2.two.2.three.2.four.2.one.3.two.3.three.3.four.3."
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
# There have been regressions where included tasks and
|
||||
# nested blocks ran out of order...
|
||||
|
||||
- shell: printf one.{{ item }}. >> {{ temppath.stdout }}
|
||||
- shell: printf one.{{ item }}. >> {{ temppath }}
|
||||
- block:
|
||||
- shell: printf two.{{ item }}. >> {{ temppath.stdout }}
|
||||
- shell: printf two.{{ item }}. >> {{ temppath }}
|
||||
- block:
|
||||
- shell: printf three.{{ item }}. >> {{ temppath.stdout }}
|
||||
- shell: printf four.{{ item }}. >> {{ temppath.stdout }}
|
||||
- shell: printf three.{{ item }}. >> {{ temppath }}
|
||||
- shell: printf four.{{ item }}. >> {{ temppath }}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
- name: 'Test templating in name'
|
||||
hosts: localhost
|
||||
hosts: testhost
|
||||
connection: local
|
||||
vars:
|
||||
a_list:
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- setup_remote_tmp_dir
|
|
@ -27,8 +27,13 @@
|
|||
that:
|
||||
- 'goodbye_ansible.msg == "Goodbye, Ansible!"'
|
||||
|
||||
- name: Copy module to remote
|
||||
copy:
|
||||
src: "{{ role_path }}/library/helloworld.py"
|
||||
dest: "{{ remote_tmp_dir }}/helloworld.py"
|
||||
|
||||
- name: Execute module directly
|
||||
command: '{{ ansible_python_interpreter|default(ansible_playbook_python) }} {{ role_path }}/library/helloworld.py'
|
||||
command: '{{ ansible_python_interpreter|default(ansible_playbook_python) }} {{ remote_tmp_dir }}/helloworld.py'
|
||||
register: direct
|
||||
ignore_errors: true
|
||||
|
||||
|
|
Loading…
Reference in a new issue