From 022d45cb52fa2a846620958d14a46485130afede Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Sun, 13 Aug 2017 14:44:40 +0200 Subject: [PATCH] copy: clearer parameter values (tests) --- .../tasks/dest_in_non_existent_directories.yml | 6 +++--- .../src_file_dest_file_in_non_existent_dir.yml | 6 +++--- test/integration/targets/copy/tasks/tests.yml | 14 +++++++------- 3 files changed, 13 insertions(+), 13 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 index 70d3847067a..12fec50795b 100644 --- a/test/integration/targets/copy/tasks/dest_in_non_existent_directories.yml +++ b/test/integration/targets/copy/tasks/dest_in_non_existent_directories.yml @@ -2,13 +2,13 @@ # checks that dest is created - name: Ensure that dest top directory doesn't exist file: - path: '{{ remote_dir }}/new_sub_dir1/' + 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 }}/new_sub_dir1/{{ item.dest }}' + dest: '{{ remote_dir }}/{{ item.dest }}' register: copy_result - name: assert copy worked @@ -19,7 +19,7 @@ - name: stat copied file stat: - path: '{{ remote_dir }}/new_sub_dir1/sub_dir2/{{ item.check }}' + path: '{{ remote_dir }}/{{ item.check }}' register: stat_file_in_dir_result - name: assert that file 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 0061ad82546..9c90ad31998 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,12 +1,12 @@ - name: Ensure that dest top directory doesn't exist file: - path: '{{ remote_dir }}/new_sub_dir1' + path: '{{ remote_dir }}/{{ dest.split("/")[0] }}' state: absent - name: Copy file, dest is a file in non-existing target directory copy: src: foo.txt - dest: '{{ dest }}' + dest: '{{ remote_dir }}/{{ dest }}' register: copy_result ignore_errors: True @@ -17,7 +17,7 @@ - name: Stat dest path stat: - path: '{{ remote_dir }}/new_sub_dir1' + path: '{{ remote_dir }}/{{ dest.split("/")[0] }}' register: stat_file_in_dir_result - name: assert that dest doesn't exist diff --git a/test/integration/targets/copy/tasks/tests.yml b/test/integration/targets/copy/tasks/tests.yml index a46b1b81e51..939eb48c3ee 100644 --- a/test/integration/targets/copy/tasks/tests.yml +++ b/test/integration/targets/copy/tasks/tests.yml @@ -931,16 +931,16 @@ # 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' } - - { src: 'subdir/', dest: 'sub_dir2/', check: 'bar.txt' } - - { src: 'subdir', dest: 'sub_dir2', check: 'subdir/bar.txt' } - - { src: 'subdir/', dest: 'sub_dir2', check: 'bar.txt' } + - { src: 'foo.txt', dest: 'new_sub_dir1/sub_dir2/', check: 'new_sub_dir1/sub_dir2/foo.txt' } + - { src: 'subdir', dest: 'new_sub_dir1/sub_dir2/', check: 'new_sub_dir1/sub_dir2/subdir/bar.txt' } + - { src: 'subdir/', dest: 'new_sub_dir1/sub_dir2/', check: 'new_sub_dir1/sub_dir2/bar.txt' } + - { src: 'subdir', dest: 'new_sub_dir1/sub_dir2', check: 'new_sub_dir1/sub_dir2/subdir/bar.txt' } + - { src: 'subdir/', dest: 'new_sub_dir1/sub_dir2', check: 'new_sub_dir1/sub_dir2/bar.txt' } # src is a file, dest is file in a non-existent directory: checks that a failure occurs - include: src_file_dest_file_in_non_existent_dir.yml with_items: - - '{{ remote_dir }}/new_sub_dir1/sub_dir2/foo.txt' - - '{{ remote_dir }}/new_sub_dir1/foo.txt' + - 'new_sub_dir1/sub_dir2/foo.txt' + - 'new_sub_dir1/foo.txt' loop_control: loop_var: 'dest'