ansible/test/integration/targets/module_utils/module_utils_basic_setcwd.yml
Matt Clay 3204d260dd [stable-2.10] Add integration tests for basic.py _set_cwd.
These tests verify that AnsibleModule can be instantiated when cwd does not exist or is unreadable.
(cherry picked from commit d6fb42d1c5)

Co-authored-by: Matt Clay <matt@mystile.com>
2020-07-13 18:16:00 -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