From efd17915f1584aad58aa429726286637c9c4ba8c Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Sun, 13 Aug 2017 14:40:22 +0200 Subject: [PATCH] copy: clearer comments, filenames, task names (tests) --- ...t_dir.yml => dest_in_non_existent_directories.yml} | 11 ++++++----- .../tasks/src_file_dest_file_in_non_existent_dir.yml | 4 ++-- test/integration/targets/copy/tasks/tests.yml | 5 +++-- 3 files changed, 11 insertions(+), 9 deletions(-) rename test/integration/targets/copy/tasks/{dest_in_non_existent_dir.yml => dest_in_non_existent_directories.yml} (65%) diff --git a/test/integration/targets/copy/tasks/dest_in_non_existent_dir.yml b/test/integration/targets/copy/tasks/dest_in_non_existent_directories.yml similarity index 65% rename from test/integration/targets/copy/tasks/dest_in_non_existent_dir.yml rename to test/integration/targets/copy/tasks/dest_in_non_existent_directories.yml index 88e7d5e936..70d3847067 100644 --- a/test/integration/targets/copy/tasks/dest_in_non_existent_dir.yml +++ b/test/integration/targets/copy/tasks/dest_in_non_existent_directories.yml @@ -1,10 +1,11 @@ -# src is a file, dest is a non-existent directory: checks that dest is created -- name: Ensure that dest directory doesn't exist +# 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 }}/new_sub_dir1/' state: absent -- name: Copy file, dest is a non-existing target directory +- name: Copy file, dest is a nonexistent target directory copy: src: '{{ item.src }}' dest: '{{ remote_dir }}/new_sub_dir1/{{ item.dest }}' @@ -16,12 +17,12 @@ - 'copy_result|success' - 'copy_result|changed' -- name: stat the copied path +- name: stat copied file stat: path: '{{ remote_dir }}/new_sub_dir1/sub_dir2/{{ item.check }}' register: stat_file_in_dir_result -- name: assert that the file exists +- name: assert that file exists assert: that: - stat_file_in_dir_result.stat.exists diff --git a/test/integration/targets/copy/tasks/src_file_dest_file_in_non_existent_dir.yml b/test/integration/targets/copy/tasks/src_file_dest_file_in_non_existent_dir.yml index 17cb6c4f8d..0061ad8254 100644 --- a/test/integration/targets/copy/tasks/src_file_dest_file_in_non_existent_dir.yml +++ b/test/integration/targets/copy/tasks/src_file_dest_file_in_non_existent_dir.yml @@ -1,4 +1,4 @@ -- name: Ensure that dest directory doesn't exist +- name: Ensure that dest top directory doesn't exist file: path: '{{ remote_dir }}/new_sub_dir1' state: absent @@ -15,7 +15,7 @@ that: - 'copy_result|failed' -- name: Stat the dest +- name: Stat dest path stat: path: '{{ remote_dir }}/new_sub_dir1' register: stat_file_in_dir_result diff --git a/test/integration/targets/copy/tasks/tests.yml b/test/integration/targets/copy/tasks/tests.yml index 0477378bcc..a46b1b81e5 100644 --- a/test/integration/targets/copy/tasks/tests.yml +++ b/test/integration/targets/copy/tasks/tests.yml @@ -927,8 +927,9 @@ - stat_circular_symlink_result.stat.exists - stat_circular_symlink_result.stat.islnk -# src is a file, dest is a non-existent directory: checks that dest is created -- include: dest_in_non_existent_dir.yml +# src is a file, dest is a non-existent directory (2 levels of directories): +# checks that dest is created +- include: dest_in_non_existent_directories.yml with_items: - { src: 'foo.txt', dest: 'sub_dir2/', check: 'foo.txt' } - { src: 'subdir', dest: 'sub_dir2/', check: 'subdir/bar.txt' }