summaryrefslogtreecommitdiff
path: root/test/integration/targets/remote_tmp
diff options
context:
space:
mode:
authorMatt Martz <matt@sivel.net>2019-12-06 16:29:26 -0600
committerMatt Clay <matt@mystile.com>2020-01-10 18:29:29 -0800
commit09e89d538cdd7ac20bae4df6c8247e5562415453 (patch)
tree9801db4382420874dc25fd8c294b8b2a3704c5ca /test/integration/targets/remote_tmp
parent56c6ebe2582090ee98f0468f1b9d26dcfbf23f84 (diff)
downloadansible-09e89d538cdd7ac20bae4df6c8247e5562415453.tar.gz
[stable-2.9] Add method to automatically clean up after an action plugin (#65509)
* Use correct var, move cleanup for async * Add changelog and tests. Fixes #65393. Fixes #65277. * Kill off all long running async tasks from listen_ports_facts * Update task to work with older jinja2 (cherry picked from commit 03a4edb) Co-authored-by: Matt Martz <matt@sivel.net>
Diffstat (limited to 'test/integration/targets/remote_tmp')
-rw-r--r--test/integration/targets/remote_tmp/playbook.yml29
-rwxr-xr-xtest/integration/targets/remote_tmp/runme.sh2
2 files changed, 30 insertions, 1 deletions
diff --git a/test/integration/targets/remote_tmp/playbook.yml b/test/integration/targets/remote_tmp/playbook.yml
index 46a2846590..cfd44b75e6 100644
--- a/test/integration/targets/remote_tmp/playbook.yml
+++ b/test/integration/targets/remote_tmp/playbook.yml
@@ -24,3 +24,32 @@
- name: clean up test user
user: name=tmptest state=absent
become_user: root
+
+- name: Test tempdir is removed
+ hosts: testhost
+ gather_facts: false
+ tasks:
+ - file:
+ state: touch
+ path: "/{{ output_dir }}/65393"
+
+ - copy:
+ src: "/{{ output_dir }}/65393"
+ dest: "/{{ output_dir }}/65393.2"
+ remote_src: true
+
+ - find:
+ path: "~/.ansible/tmp"
+ use_regex: yes
+ patterns: 'AnsiballZ_.+\.py'
+ recurse: true
+ register: result
+
+ - debug:
+ var: result
+
+ - assert:
+ that:
+ # Should only be AnsiballZ_find.py because find is actively running
+ - result.files|length == 1
+ - result.files[0].path.endswith('/AnsiballZ_find.py')
diff --git a/test/integration/targets/remote_tmp/runme.sh b/test/integration/targets/remote_tmp/runme.sh
index 69efd6e016..8d1eebd6b1 100755
--- a/test/integration/targets/remote_tmp/runme.sh
+++ b/test/integration/targets/remote_tmp/runme.sh
@@ -2,4 +2,4 @@
set -ux
-ansible-playbook -i ../../inventory playbook.yml -v "$@"
+ansible-playbook -i ../../inventory playbook.yml -e "output_dir=${OUTPUT_DIR}" -v "$@"