ansible/test/integration/targets/tower_common/tasks/main.yml
Matt Clay 013b0039ba
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.
2019-06-25 18:39:41 -07:00

47 lines
1.5 KiB
YAML

# Test behaviour common to all tower modules
- name: Check that SSL is available
tower_organization:
name: Default
register: result
- name: Check we haven't changed anything
assert:
that: result is not changed
- name: Check that SSL is available and verify_ssl is enabled (task must fail)
tower_organization:
name: Default
environment:
TOWER_CERTIFICATE: /dev/null # force check failure
ignore_errors: true
register: check_ssl_is_used
- name: Check that connection failed
assert:
that:
- check_ssl_is_used is failed
- >
'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
- name: Disable verify_ssl in ~/.tower_cli.cfg
copy:
dest: ~/.tower_cli.cfg
content: |
[general]
verify_ssl = False
force: false # ensure remote file doesn't exist
- block:
- name: Check that verify_ssl is disabled (task must not fail)
tower_organization:
name: Default
environment:
TOWER_CERTIFICATE: /dev/null # should not fail because verify_ssl is disabled
always:
- name: Delete ~/.tower_cli.cfg
file:
path: ~/.tower_cli.cfg
state: absent