diff options
author | Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr> | 2017-08-13 14:44:40 +0200 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2017-08-13 08:22:22 -0700 |
commit | 022d45cb52fa2a846620958d14a46485130afede (patch) | |
tree | 3538e258c85b5cee1f0f077d38eed2f5ef729612 /test/integration/targets/copy | |
parent | efd17915f1584aad58aa429726286637c9c4ba8c (diff) | |
download | ansible-022d45cb52fa2a846620958d14a46485130afede.tar.gz |
copy: clearer parameter values (tests)
Diffstat (limited to 'test/integration/targets/copy')
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 70d3847067..12fec50795 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 0061ad8254..9c90ad3199 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 a46b1b81e5..939eb48c3e 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' |