summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/unarchive/tasks/test_symlink.yml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 16:04:21 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 16:04:21 +0000
commit8a754e0858d922e955e71b253c139e071ecec432 (patch)
tree527d16e74bfd1840c85efd675fdecad056c54107 /test/integration/targets/unarchive/tasks/test_symlink.yml
parentInitial commit. (diff)
downloadansible-core-8a754e0858d922e955e71b253c139e071ecec432.tar.xz
ansible-core-8a754e0858d922e955e71b253c139e071ecec432.zip
Adding upstream version 2.14.3.upstream/2.14.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/integration/targets/unarchive/tasks/test_symlink.yml')
-rw-r--r--test/integration/targets/unarchive/tasks/test_symlink.yml64
1 files changed, 64 insertions, 0 deletions
diff --git a/test/integration/targets/unarchive/tasks/test_symlink.yml b/test/integration/targets/unarchive/tasks/test_symlink.yml
new file mode 100644
index 0000000..fcb7282
--- /dev/null
+++ b/test/integration/targets/unarchive/tasks/test_symlink.yml
@@ -0,0 +1,64 @@
+- name: Create a destination dir
+ file:
+ path: "{{ remote_tmp_dir }}/test-unarchive-tar-gz"
+ state: directory
+
+- name: Create a symlink to the detination dir
+ file:
+ path: "{{ remote_tmp_dir }}/link-to-unarchive-dir"
+ src: "{{ remote_tmp_dir }}/test-unarchive-tar-gz"
+ state: "link"
+
+- name: test that unarchive works when dest is a symlink to a dir
+ unarchive:
+ src: "{{ remote_tmp_dir }}/test-unarchive.tar.gz"
+ dest: "{{ remote_tmp_dir }}/link-to-unarchive-dir"
+ mode: "u+rwX,go+rX"
+ remote_src: yes
+ register: unarchive_11
+
+- name: Check that file is really there
+ stat:
+ path: "{{ remote_tmp_dir }}/test-unarchive-tar-gz/foo-unarchive.txt"
+ register: unarchive11_stat0
+
+- name: Assert that unarchive when dest is a symlink to a dir worked
+ assert:
+ that:
+ - "unarchive_11.changed == true"
+ - "unarchive11_stat0.stat.exists == true"
+
+- name: remove our tar.gz unarchive destination
+ file:
+ path: '{{ remote_tmp_dir }}/test-unarchive-tar-gz'
+ state: absent
+
+- name: Create a file
+ file:
+ path: "{{ remote_tmp_dir }}/test-unarchive-tar-gz"
+ state: touch
+
+- name: Create a symlink to the file
+ file:
+ src: "{{ remote_tmp_dir }}/test-unarchive-tar-gz"
+ path: "{{ remote_tmp_dir }}/link-to-unarchive-file"
+ state: "link"
+
+- name: test that unarchive fails when dest is a link to a file
+ unarchive:
+ src: "{{ remote_tmp_dir }}/test-unarchive.tar.gz"
+ dest: "{{ remote_tmp_dir }}/link-to-unarchive-file"
+ mode: "u+rwX,go+rX"
+ remote_src: yes
+ ignore_errors: True
+ register: unarchive_12
+
+- name: Assert that unarchive when dest is a file failed
+ assert:
+ that:
+ - "unarchive_12.failed == true"
+
+- name: remove our tar.gz unarchive destination
+ file:
+ path: '{{ remote_tmp_dir }}/test-unarchive-tar-gz'
+ state: absent