3204d260dd
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>
22 lines
777 B
YAML
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
|