Clean up various integration tests. (#60613)
* Fix var_blending test temp dir usage. * Fix filters integration test: - Fix use of `output_dir`. - Use `localhost` instead of `testhost` since we're only testing filters. - Fix `fileglob` test to actually test a directory that exists. * Fix lookups integration test: - Fix use of `output_dir`. - Use `localhost` instead of `testhost` since we're only testing lookups. * Fix ansible-runner test temp dir usage. * Fix template and template_jinja2_latest test. Use the `OUTPUT_DIR` env var to get the output directory for the tests. * Fix Python version compat in filters test. * Skip filters test on Python 2.6.
This commit is contained in:
parent
f52657fb7d
commit
0c74ee4352
23 changed files with 35 additions and 18 deletions
|
@ -2,4 +2,4 @@
|
|||
|
||||
set -eux
|
||||
|
||||
ANSIBLE_ROLES_PATH=../ ansible-playbook test.yml -e '@../../integration_config.yml' -i inventory "$@"
|
||||
ANSIBLE_ROLES_PATH=../ ansible-playbook test.yml -i inventory "$@"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- name: execute the script
|
||||
command: "'{{ ansible_python_interpreter }}' '{{ role_path }}/files/adhoc_example1.py' '{{ output_dir }}'"
|
||||
command: "'{{ ansible_python_interpreter }}' '{{ role_path }}/files/adhoc_example1.py' '{{ lookup('env', 'OUTPUT_DIR') }}'"
|
||||
environment:
|
||||
AWX_LIB_DIRECTORY: "{{ callback_path }}"
|
||||
register: script
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- name: execute the script
|
||||
command: "'{{ ansible_python_interpreter }}' '{{ role_path }}/files/playbook_example1.py' '{{ output_dir }}'"
|
||||
command: "'{{ ansible_python_interpreter }}' '{{ role_path }}/files/playbook_example1.py' '{{ lookup('env', 'OUTPUT_DIR') }}'"
|
||||
environment:
|
||||
AWX_LIB_DIRECTORY: "{{ callback_path }}"
|
||||
register: script
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
shippable/posix/group2
|
||||
skip/python2.6 # filters are controller only, and we no longer support Python 2.6 on the controller
|
||||
|
|
0
test/integration/targets/filters/files/fileglob/one.txt
Normal file
0
test/integration/targets/filters/files/fileglob/one.txt
Normal file
0
test/integration/targets/filters/files/fileglob/two.txt
Normal file
0
test/integration/targets/filters/files/fileglob/two.txt
Normal file
|
@ -44,7 +44,7 @@ quoted = quoted
|
|||
|
||||
The fileglob module returns the list of things matching a pattern.
|
||||
|
||||
fileglob = []
|
||||
fileglob = one.txt, two.txt
|
||||
|
||||
There are also various string operations that work on paths. These do not require
|
||||
files to exist and are passthrus to the python os.path functions
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- hosts: testhost
|
||||
- hosts: localhost
|
||||
gather_facts: yes
|
||||
roles:
|
||||
- { role: filters }
|
||||
|
|
|
@ -9,4 +9,4 @@ source virtualenv.sh
|
|||
|
||||
pip install jmespath netaddr
|
||||
|
||||
ANSIBLE_ROLES_PATH=../ ansible-playbook filters.yml -i ../../inventory -e @../../integration_config.yml "$@"
|
||||
ANSIBLE_ROLES_PATH=../ ansible-playbook filters.yml "$@"
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
# Copyright: (c) 2019, Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- set_fact:
|
||||
output_dir: "{{ lookup('env', 'OUTPUT_DIR') }}"
|
||||
|
||||
- name: a dummy task to test the changed and success filters
|
||||
shell: echo hi
|
||||
register: some_registered_var
|
||||
|
|
|
@ -38,7 +38,7 @@ quoted = {{ 'quoted' | quote }}
|
|||
|
||||
The fileglob module returns the list of things matching a pattern.
|
||||
|
||||
fileglob = {{ (output_dir + '/*') | fileglob }}
|
||||
fileglob = {{ (playbook_dir + '/files/fileglob/*') | fileglob | map('basename') | sort | join(', ') }}
|
||||
|
||||
There are also various string operations that work on paths. These do not require
|
||||
files to exist and are passthrus to the python os.path functions
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- hosts: testhost
|
||||
- hosts: localhost
|
||||
gather_facts: yes
|
||||
roles:
|
||||
- { role: lookups }
|
||||
|
|
|
@ -8,6 +8,6 @@ source virtualenv.sh
|
|||
# because plugins and requirements are loaded before the task runs
|
||||
pip install passlib
|
||||
|
||||
ANSIBLE_ROLES_PATH=../ ansible-playbook lookups.yml -i ../../inventory -e @../../integration_config.yml "$@"
|
||||
ANSIBLE_ROLES_PATH=../ ansible-playbook lookups.yml "$@"
|
||||
|
||||
ansible-playbook template_lookup_vaulted.yml -i ../../inventory -e @../../integration_config.yml --vault-password-file test_vault_pass "$@"
|
||||
ansible-playbook template_lookup_vaulted.yml --vault-password-file test_vault_pass "$@"
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
|
||||
# FILE LOOKUP
|
||||
|
||||
- set_fact:
|
||||
output_dir: "{{ lookup('env', 'OUTPUT_DIR') }}"
|
||||
|
||||
- name: make a new file to read
|
||||
copy: dest={{output_dir}}/foo.txt mode=0644 content="bar"
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
- hosts: testhost
|
||||
gather_facts: False
|
||||
tasks:
|
||||
- set_fact:
|
||||
output_dir: "{{ lookup('env', 'OUTPUT_DIR') }}"
|
||||
- file:
|
||||
path: '{{ output_dir }}/café.txt'
|
||||
state: 'absent'
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
---
|
||||
- set_fact:
|
||||
output_dir: "{{ lookup('env', 'OUTPUT_DIR') }}"
|
||||
|
||||
- template:
|
||||
src: test
|
||||
dest: "{{ output_dir }}/templated_test"
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
|
||||
set -eux
|
||||
|
||||
ANSIBLE_ROLES_PATH=../ ansible-playbook template.yml -i ../../inventory -e @../../integration_config.yml -v "$@"
|
||||
ANSIBLE_ROLES_PATH=../ ansible-playbook template.yml -i ../../inventory -v "$@"
|
||||
|
||||
# Test for #35571
|
||||
ansible testhost -i testhost, -m debug -a 'msg={{ hostvars["localhost"] }}' -e "vars1={{ undef }}" -e "vars2={{ vars1 }}"
|
||||
|
||||
# Test for https://github.com/ansible/ansible/issues/27262
|
||||
ansible-playbook ansible_managed.yml -c ansible_managed.cfg -i ../../inventory -e @../../integration_config.yml -v "$@"
|
||||
ansible-playbook ansible_managed.yml -c ansible_managed.cfg -i ../../inventory -v "$@"
|
||||
|
||||
# Test for #42585
|
||||
ANSIBLE_ROLES_PATH=../ ansible-playbook custom_template.yml -i ../../inventory -e @../../integration_config.yml -v "$@"
|
||||
ANSIBLE_ROLES_PATH=../ ansible-playbook custom_template.yml -i ../../inventory -v "$@"
|
||||
|
||||
|
||||
# Test for several corner cases #57188
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- set_fact:
|
||||
output_dir: "{{ lookup('env', 'OUTPUT_DIR') }}"
|
||||
|
||||
- name: show python interpreter
|
||||
debug:
|
||||
msg: "{{ ansible_python['executable'] }}"
|
||||
|
@ -395,7 +398,7 @@
|
|||
assert:
|
||||
that:
|
||||
- "template_result is not changed"
|
||||
- "'templated_var_loaded' in lookup('file', '{{output_dir | expanduser}}/short.templated')"
|
||||
- "'templated_var_loaded' in lookup('file', output_dir + '/short.templated')"
|
||||
|
||||
- name: change var for the template
|
||||
set_fact:
|
||||
|
@ -409,7 +412,7 @@
|
|||
- name: verify that the file was marked as changed in check mode but the content was not changed
|
||||
assert:
|
||||
that:
|
||||
- "'templated_var_loaded' in lookup('file', '{{output_dir | expanduser }}/short.templated')"
|
||||
- "'templated_var_loaded' in lookup('file', output_dir + '/short.templated')"
|
||||
- "template_result is changed"
|
||||
|
||||
# Create a template using a child template, to ensure that variables
|
||||
|
|
|
@ -9,4 +9,4 @@ pip install -U jinja2
|
|||
ANSIBLE_ROLES_PATH=../
|
||||
export ANSIBLE_ROLES_PATH
|
||||
|
||||
ansible-playbook -i ../../inventory main.yml -e @../../integration_config.yml -v "$@"
|
||||
ansible-playbook -i ../../inventory main.yml -v "$@"
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
|
||||
- include_vars: more_vars.yml
|
||||
|
||||
- set_fact:
|
||||
output_dir: "{{ lookup('env', 'OUTPUT_DIR') }}"
|
||||
|
||||
- name: deploy a template that will use variables at various levels
|
||||
template: src=foo.j2 dest={{output_dir}}/foo.templated
|
||||
register: template_result
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
set -eux
|
||||
|
||||
ansible-playbook test_var_blending.yml -i inventory -e @integration_config.yml -v "$@"
|
||||
ansible-playbook test_var_blending.yml -i inventory -e @test_vars.yml -v "$@"
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
output_dir: .
|
||||
etest: 'from -e'
|
Loading…
Reference in a new issue