diff options
Diffstat (limited to 'test/integration/targets/remote_tmp')
-rw-r--r-- | test/integration/targets/remote_tmp/aliases | 3 | ||||
-rw-r--r-- | test/integration/targets/remote_tmp/playbook.yml | 59 | ||||
-rwxr-xr-x | test/integration/targets/remote_tmp/runme.sh | 5 |
3 files changed, 67 insertions, 0 deletions
diff --git a/test/integration/targets/remote_tmp/aliases b/test/integration/targets/remote_tmp/aliases new file mode 100644 index 0000000..126e809 --- /dev/null +++ b/test/integration/targets/remote_tmp/aliases @@ -0,0 +1,3 @@ +shippable/posix/group2 +context/target +needs/target/setup_remote_tmp_dir diff --git a/test/integration/targets/remote_tmp/playbook.yml b/test/integration/targets/remote_tmp/playbook.yml new file mode 100644 index 0000000..5adef62 --- /dev/null +++ b/test/integration/targets/remote_tmp/playbook.yml @@ -0,0 +1,59 @@ +- name: Test temp dir on de escalation + hosts: testhost + become: yes + tasks: + - name: create test user + user: + name: tmptest + state: present + group: '{{ "staff" if ansible_facts.distribution == "MacOSX" else omit }}' + + - name: execute test case + become_user: tmptest + block: + - name: Test case from issue 41340 + blockinfile: + create: yes + block: | + export foo=bar + marker: "# {mark} Here there be a marker" + dest: /tmp/testing.txt + mode: 0644 + always: + - name: clean up file + file: path=/tmp/testing.txt state=absent + + - name: clean up test user + user: name=tmptest state=absent + become_user: root + +- name: Test tempdir is removed + hosts: testhost + gather_facts: false + tasks: + - import_role: + name: ../setup_remote_tmp_dir + + - file: + state: touch + path: "{{ remote_tmp_dir }}/65393" + + - 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 + + - debug: + var: result + + - assert: + that: + # Should find nothing since pipelining is used + - result.files|length == 0 diff --git a/test/integration/targets/remote_tmp/runme.sh b/test/integration/targets/remote_tmp/runme.sh new file mode 100755 index 0000000..69efd6e --- /dev/null +++ b/test/integration/targets/remote_tmp/runme.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -ux + +ansible-playbook -i ../../inventory playbook.yml -v "$@" |