ansible/test/integration/targets/module_utils/module_utils_basic_setcwd.yml
Matt Clay d6fb42d1c5 Add integration tests for basic.py _set_cwd.
These tests verify that AnsibleModule can be instantiated when cwd does not exist or is unreadable.
2020-06-26 16:40:52 -07:00

22 lines
777 B
YAML

- hosts: testhost
gather_facts: no
tasks:
- name: make sure the nobody user is available
include_role:
name: setup_nobody
- name: verify AnsibleModule works when cwd is missing
test_cwd_missing:
register: missing
- name: verify AnsibleModule works when cwd is unreadable
test_cwd_unreadable:
register: unreadable
become: yes
become_user: nobody # root can read cwd regardless of permissions, so a non-root user is required here
- name: verify AnsibleModule was able to adjust cwd as expected
assert:
that:
- missing.before != missing.after
- unreadable.before != unreadable.after or unreadable.before == '/' # allow / fallback on macOS when using an unprivileged user