summaryrefslogtreecommitdiff
path: root/test/integration/targets/lookups
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2019-06-25 18:39:41 -0700
committerGitHub <noreply@github.com>2019-06-25 18:39:41 -0700
commit013b0039bab4b14c9888b2dfb49466a773f8c1f4 (patch)
treed127ed09a30a3f858ddc21b418972f12f07fa2c6 /test/integration/targets/lookups
parentc604e347b251214d5a31ed078e6e17494a2b582a (diff)
downloadansible-013b0039bab4b14c9888b2dfb49466a773f8c1f4.tar.gz
Fix incorrect assumptions in integration tests. (#58365)
* Fix nested template test. There were two issues with the previous implementation: 1. The LOGNAME environment variable may not be set. 2. The comparison assumed that testhost is localhost. * Fix variable display for cartesian lookup test. * Fix vars list test. The test assumed that the ansible_user variable is always set, which is not guaranteed when using connections other than local. * Fix supervisorctl integration test. Use ansible_user_id instead of ansible_user since ansible_user is not guaranteed to be available when the connection is not local. * Fix file integration test. Use ansible_user_id instead of ansible_user since ansible_user is not guaranteed to be available when the connection is not local. * Fix expect integration test. Do not assume module_utils is available for utility scripts. * Fix python_requirements_info integration test. Check for pip instead of ansible, since ansible is not guaranteed to be installed when using a connection other than local. * Fix ansible-runner integration test. Use implicit localhost to run the test since it requires access to the ansible installation currently being tested. * Fix tower_common integration test. Accept errors on stdout or stderr. * Fix tower_user integration test. Recognize errors on stdout or stderr.
Diffstat (limited to 'test/integration/targets/lookups')
-rw-r--r--test/integration/targets/lookups/tasks/main.yml21
1 files changed, 11 insertions, 10 deletions
diff --git a/test/integration/targets/lookups/tasks/main.yml b/test/integration/targets/lookups/tasks/main.yml
index ba2a024637..7700758164 100644
--- a/test/integration/targets/lookups/tasks/main.yml
+++ b/test/integration/targets/lookups/tasks/main.yml
@@ -188,23 +188,24 @@
- name: set variable that clashes
set_fact:
- LOGNAME: foobar
+ PATH: foobar
-- name: get LOGNAME environment var value
- shell: echo {{ '$LOGNAME' }}
- register: known_var_value
+- name: get PATH environment var value
+ set_fact:
+ known_var_value: "{{ lookup('pipe', 'echo $PATH') }}"
-- name: do the lookup for env LOGNAME
+- name: do the lookup for env PATH
set_fact:
- test_val: "{{ lookup('env', 'LOGNAME') }}"
+ test_val: "{{ lookup('env', 'PATH') }}"
- debug: var=test_val
- name: compare values
assert:
that:
- - "test_val == known_var_value.stdout"
+ - "test_val != ''"
+ - "test_val == known_var_value"
- name: set with_dict
@@ -243,7 +244,7 @@
- "'{{ badssl_host_substring }}' in web_data"
- name: Test cartesian lookup
- debug: var={{item}}
+ debug: var=item
with_cartesian:
- ["A", "B", "C"]
- ["1", "2", "3"]
@@ -296,9 +297,9 @@
- name: Test that we can give a list of values to var and receive a list of values back
set_fact:
- var_host_info: '{{ query("vars", "ansible_host", "ansible_user") }}'
+ var_host_info: '{{ query("vars", "ansible_host", "ansible_connection") }}'
- assert:
that:
- 'var_host_info[0] == ansible_host'
- - 'var_host_info[1] == ansible_user'
+ - 'var_host_info[1] == ansible_connection'