diff --git a/test/integration/targets/ansible-runner/inventory b/test/integration/targets/ansible-runner/inventory new file mode 100644 index 00000000000..009f6c3376e --- /dev/null +++ b/test/integration/targets/ansible-runner/inventory @@ -0,0 +1 @@ +# no hosts required, test only requires implicit localhost diff --git a/test/integration/targets/ansible-runner/runme.sh b/test/integration/targets/ansible-runner/runme.sh new file mode 100755 index 00000000000..2996fa1a830 --- /dev/null +++ b/test/integration/targets/ansible-runner/runme.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -eux + +ANSIBLE_ROLES_PATH=../ ansible-playbook test.yml -e '@../../integration_config.yml' -i inventory "$@" diff --git a/test/integration/targets/ansible-runner/test.yml b/test/integration/targets/ansible-runner/test.yml new file mode 100644 index 00000000000..113f8e7ca65 --- /dev/null +++ b/test/integration/targets/ansible-runner/test.yml @@ -0,0 +1,3 @@ +- hosts: localhost + roles: + - ansible-runner diff --git a/test/integration/targets/expect/files/test_command.py b/test/integration/targets/expect/files/test_command.py index 387dbbe3e91..685c50c229b 100644 --- a/test/integration/targets/expect/files/test_command.py +++ b/test/integration/targets/expect/files/test_command.py @@ -1,10 +1,12 @@ import sys -from ansible.module_utils.six.moves import input - +try: + input_function = raw_input +except NameError: + input_function = input prompts = sys.argv[1:] or ['foo'] for prompt in prompts: - user_input = input(prompt) + user_input = input_function(prompt) print(user_input) diff --git a/test/integration/targets/file/tasks/main.yml b/test/integration/targets/file/tasks/main.yml index 09796df4e8c..f6ec387b7a9 100644 --- a/test/integration/targets/file/tasks/main.yml +++ b/test/integration/targets/file/tasks/main.yml @@ -515,7 +515,7 @@ # https://github.com/ansible/ansible/issues/50943 # Need to use /tmp as nobody can't access output_dir at all - name: create file as root with all write permissions - file: dest=/tmp/write_utime state=touch mode=0666 owner={{ansible_user}} + file: dest=/tmp/write_utime state=touch mode=0666 owner={{ansible_user_id}} - name: Pause to ensure stat times are not the exact same pause: diff --git a/test/integration/targets/lookups/tasks/main.yml b/test/integration/targets/lookups/tasks/main.yml index ba2a0246371..77007581648 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' diff --git a/test/integration/targets/python_requirements_info/tasks/main.yml b/test/integration/targets/python_requirements_info/tasks/main.yml index 9ef340513a5..2aca16b9fe1 100644 --- a/test/integration/targets/python_requirements_info/tasks/main.yml +++ b/test/integration/targets/python_requirements_info/tasks/main.yml @@ -12,11 +12,11 @@ python_requirements_info: dependencies: - notreal<1 - - ansible>2 + - pip>1 register: dep_info - name: ensure python_requirements_info returns desired info assert: that: - - "'installed' in dep_info.valid.ansible" + - "'installed' in dep_info.valid.pip" - "'notreal' in dep_info.not_found" diff --git a/test/integration/targets/supervisorctl/templates/supervisord.conf b/test/integration/targets/supervisorctl/templates/supervisord.conf index 5ad95ebadcf..2e805bd8d92 100644 --- a/test/integration/targets/supervisorctl/templates/supervisord.conf +++ b/test/integration/targets/supervisorctl/templates/supervisord.conf @@ -4,7 +4,7 @@ logfile={{ remote_dir }}/supervisord.log [program:py1] command={{ ansible_python.executable }} -i -u - -user={{ ansible_user }} +user={{ ansible_user_id }} autostart=false autorestart=false stdout_logfile={{ remote_dir }}/py1.log @@ -12,7 +12,7 @@ redirect_stderr=yes [program:py2] command={{ ansible_python.executable }} -i -u - -user={{ ansible_user }} +user={{ ansible_user_id }} autostart=false autorestart=false stdout_logfile={{ remote_dir }}/py2.log diff --git a/test/integration/targets/tower_common/tasks/main.yml b/test/integration/targets/tower_common/tasks/main.yml index cdcf47acb0d..6cef98f5368 100644 --- a/test/integration/targets/tower_common/tasks/main.yml +++ b/test/integration/targets/tower_common/tasks/main.yml @@ -21,8 +21,8 @@ that: - check_ssl_is_used is failed - > - 'Could not establish a secure connection' in check_ssl_is_used.module_stderr - or 'OpenSSL.SSL.Error' in check_ssl_is_used.module_stderr + 'Could not establish a secure connection' in (check_ssl_is_used.module_stderr + check_ssl_is_used.module_stdout) + or 'OpenSSL.SSL.Error' in (check_ssl_is_used.module_stderr + check_ssl_is_used.module_stdout) # 'Could not establish a secure connection': when pyOpenSSL isn't available # 'OpenSSL.SSL.Error': with pyOpenSSL, see https://github.com/urllib3/urllib3/pull/1517 diff --git a/test/integration/targets/tower_user/tasks/main.yml b/test/integration/targets/tower_user/tasks/main.yml index 22e07413b97..41264b63b45 100644 --- a/test/integration/targets/tower_user/tasks/main.yml +++ b/test/integration/targets/tower_user/tasks/main.yml @@ -90,4 +90,4 @@ - assert: that: - - "'not verify ssl with non-https protocol' in result.exception" + - "'not verify ssl with non-https protocol' in (result.module_stdout + result.module_stderr)"