mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 14:20:22 -07:00
Split integration tests out from Makefile. (#17976)
This commit is contained in:
parent
bf3d546d9a
commit
80a5c70ad7
169 changed files with 612 additions and 420 deletions
|
@ -0,0 +1,3 @@
|
|||
{{ templated_var }}
|
||||
|
||||
{{ templated_dict | to_nice_json }}
|
5
test/integration/targets/delegate_to/runme.sh
Executable file
5
test/integration/targets/delegate_to/runme.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -eux
|
||||
|
||||
ANSIBLE_HOST_KEY_CHECKING=false ansible-playbook test_delegate_to.yml -i ../../inventory -v "$@"
|
56
test/integration/targets/delegate_to/test_delegate_to.yml
Normal file
56
test/integration/targets/delegate_to/test_delegate_to.yml
Normal file
|
@ -0,0 +1,56 @@
|
|||
- hosts: testhost3
|
||||
vars:
|
||||
- template_role: ./roles/test_template
|
||||
- output_dir: "{{ playbook_dir }}"
|
||||
- templated_var: foo
|
||||
- templated_dict: { 'hello': 'world' }
|
||||
tasks:
|
||||
- name: Test no delegate_to
|
||||
setup:
|
||||
register: setup_results
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- '"127.0.0.3" in setup_results.ansible_facts.ansible_env["SSH_CONNECTION"]'
|
||||
|
||||
- name: Test delegate_to with host in inventory
|
||||
setup:
|
||||
register: setup_results
|
||||
delegate_to: testhost4
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- '"127.0.0.4" in setup_results.ansible_facts.ansible_env["SSH_CONNECTION"]'
|
||||
|
||||
- name: Test delegate_to with host not in inventory
|
||||
setup:
|
||||
register: setup_results
|
||||
delegate_to: 127.0.0.254
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- '"127.0.0.254" in setup_results.ansible_facts.ansible_env["SSH_CONNECTION"]'
|
||||
#
|
||||
# Smoketest some other modules do not error as a canary
|
||||
#
|
||||
- name: Test file works with delegate_to and a host in inventory
|
||||
file: path={{ output_dir }}/foo.txt mode=0644 state=touch
|
||||
delegate_to: testhost4
|
||||
|
||||
- name: Test file works with delegate_to and a host not in inventory
|
||||
file: path={{ output_dir }}/tmp.txt mode=0644 state=touch
|
||||
delegate_to: 127.0.0.254
|
||||
|
||||
- name: Test template works with delegate_to and a host in inventory
|
||||
template: src={{ template_role }}/templates/foo.j2 dest={{ output_dir }}/foo.txt
|
||||
delegate_to: testhost4
|
||||
|
||||
- name: Test template works with delegate_to and a host not in inventory
|
||||
template: src={{ template_role }}/templates/foo.j2 dest={{ output_dir }}/foo.txt
|
||||
delegate_to: 127.0.0.254
|
||||
|
||||
- name: remove test file
|
||||
file: path={{ output_dir }}/foo.txt state=absent
|
||||
|
||||
- name: remove test file
|
||||
file: path={{ output_dir }}/tmp.txt state=absent
|
Loading…
Add table
Add a link
Reference in a new issue