mirror of
https://github.com/zebrajr/ansible.git
synced 2025-12-06 00:19:48 +01:00
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
This commit is contained in:
parent
742d47fa15
commit
ef3b806dd3
|
|
@ -30,30 +30,43 @@
|
||||||
- name: Test tempdir is removed
|
- name: Test tempdir is removed
|
||||||
hosts: testhost
|
hosts: testhost
|
||||||
gather_facts: false
|
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:
|
tasks:
|
||||||
- import_role:
|
- import_role:
|
||||||
name: ../setup_remote_tmp_dir
|
name: ../setup_remote_tmp_dir
|
||||||
|
|
||||||
- file:
|
- vars:
|
||||||
state: touch
|
# Isolate the remote_tmp used by these tests
|
||||||
path: "{{ remote_tmp_dir }}/65393"
|
ansible_remote_tmp: "{{ remote_tmp_dir }}/remote_tmp"
|
||||||
|
block:
|
||||||
|
- file:
|
||||||
|
state: touch
|
||||||
|
path: "{{ remote_tmp_dir }}/65393"
|
||||||
|
|
||||||
- copy:
|
- copy:
|
||||||
src: "{{ remote_tmp_dir }}/65393"
|
src: "{{ remote_tmp_dir }}/65393"
|
||||||
dest: "{{ remote_tmp_dir }}/65393.2"
|
dest: "{{ remote_tmp_dir }}/65393.2"
|
||||||
remote_src: true
|
remote_src: true
|
||||||
|
|
||||||
- find:
|
- find:
|
||||||
path: "~/.ansible/tmp"
|
path: "{{ ansible_remote_tmp }}"
|
||||||
use_regex: yes
|
use_regex: yes
|
||||||
patterns: 'AnsiballZ_.+\.py'
|
patterns: 'AnsiballZ_.+\.py'
|
||||||
recurse: true
|
recurse: true
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- debug:
|
- debug:
|
||||||
var: result
|
var: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
# Should find nothing since pipelining is used
|
# Should only be AnsiballZ_find.py because find is actively running
|
||||||
- result.files|length == 0
|
- result.files|length == 1
|
||||||
|
- result.files[0].path.endswith('/AnsiballZ_find.py')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user