Fix remote_tmp tests so that they actually use the remote_tmp (#80969)

* Fix remote_tmp tests so that they actually use the remote_tmp

* Isolate remote_tmp dir during remote_tmp tests. Fixes #80965

* Do everything without become
pull/80983/head
Matt Martz 3 years ago committed by GitHub
parent 742d47fa15
commit ef3b806dd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -30,10 +30,22 @@
- name: Test tempdir is removed
hosts: testhost
gather_facts: false
vars:
# These tests cannot be run with pipelining as it defeats the purpose of
# ensuring remote_tmp is cleaned up. Pipelining is enabled in the test
# inventory
ansible_pipelining: false
# Ensure that the remote_tmp_dir we create allows the unpriv connection user
# to create the remote_tmp
ansible_become: false
tasks:
- import_role:
name: ../setup_remote_tmp_dir
- vars:
# Isolate the remote_tmp used by these tests
ansible_remote_tmp: "{{ remote_tmp_dir }}/remote_tmp"
block:
- file:
state: touch
path: "{{ remote_tmp_dir }}/65393"
@ -44,7 +56,7 @@
remote_src: true
- find:
path: "~/.ansible/tmp"
path: "{{ ansible_remote_tmp }}"
use_regex: yes
patterns: 'AnsiballZ_.+\.py'
recurse: true
@ -55,5 +67,6 @@
- assert:
that:
# Should find nothing since pipelining is used
- result.files|length == 0
# Should only be AnsiballZ_find.py because find is actively running
- result.files|length == 1
- result.files[0].path.endswith('/AnsiballZ_find.py')

Loading…
Cancel
Save