summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/copy/tasks/dest_in_non_existent_directories.yml
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/targets/copy/tasks/dest_in_non_existent_directories.yml')
-rw-r--r--test/integration/targets/copy/tasks/dest_in_non_existent_directories.yml29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/integration/targets/copy/tasks/dest_in_non_existent_directories.yml b/test/integration/targets/copy/tasks/dest_in_non_existent_directories.yml
new file mode 100644
index 0000000..c86caa1
--- /dev/null
+++ b/test/integration/targets/copy/tasks/dest_in_non_existent_directories.yml
@@ -0,0 +1,29 @@
+# src is a file, dest is a non-existent directory (2 levels of directories):
+# checks that dest is created
+- name: Ensure that dest top directory doesn't exist
+ file:
+ path: '{{ remote_dir }}/{{ item.dest.split("/")[0] }}'
+ state: absent
+
+- name: Copy file, dest is a nonexistent target directory
+ copy:
+ src: '{{ item.src }}'
+ dest: '{{ remote_dir }}/{{ item.dest }}'
+ register: copy_result
+
+- name: assert copy worked
+ assert:
+ that:
+ - 'copy_result is successful'
+ - 'copy_result is changed'
+
+- name: stat copied file
+ stat:
+ path: '{{ remote_dir }}/{{ item.check }}'
+ register: stat_file_in_dir_result
+
+- name: assert that file exists
+ assert:
+ that:
+ - stat_file_in_dir_result.stat.exists
+ - stat_file_in_dir_result.stat.isreg