diff options
author | Matt Martz <matt@sivel.net> | 2023-06-06 17:24:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-06 17:24:53 +0200 |
commit | ef3b806dd30814ba259c3399dd25ae6998749e23 (patch) | |
tree | e1c8abb62192487c12ebdd1a69a6f2a7d64c8c5d /test | |
parent | replace deprecated ast.value.s with ast.value.value (#80968) (diff) | |
download | ansible-ef3b806dd30814ba259c3399dd25ae6998749e23.tar.xz ansible-ef3b806dd30814ba259c3399dd25ae6998749e23.zip |
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
Diffstat (limited to 'test')
-rw-r--r-- | test/integration/targets/remote_tmp/playbook.yml | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/test/integration/targets/remote_tmp/playbook.yml b/test/integration/targets/remote_tmp/playbook.yml index 5adef62690..2d0db4e8a8 100644 --- a/test/integration/targets/remote_tmp/playbook.yml +++ b/test/integration/targets/remote_tmp/playbook.yml @@ -30,30 +30,43 @@ - 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 - - file: - state: touch - path: "{{ remote_tmp_dir }}/65393" + - 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" - - copy: - src: "{{ remote_tmp_dir }}/65393" - dest: "{{ remote_tmp_dir }}/65393.2" - remote_src: true + - copy: + src: "{{ remote_tmp_dir }}/65393" + dest: "{{ remote_tmp_dir }}/65393.2" + remote_src: true - - find: - path: "~/.ansible/tmp" - use_regex: yes - patterns: 'AnsiballZ_.+\.py' - recurse: true - register: result + - find: + path: "{{ ansible_remote_tmp }}" + use_regex: yes + patterns: 'AnsiballZ_.+\.py' + recurse: true + register: result - debug: var: result - 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') |