mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-27 07:01:22 -07:00
copy: clearer parameter values (tests)
This commit is contained in:
parent
efd17915f1
commit
022d45cb52
3 changed files with 13 additions and 13 deletions
|
@ -2,13 +2,13 @@
|
||||||
# checks that dest is created
|
# checks that dest is created
|
||||||
- name: Ensure that dest top directory doesn't exist
|
- name: Ensure that dest top directory doesn't exist
|
||||||
file:
|
file:
|
||||||
path: '{{ remote_dir }}/new_sub_dir1/'
|
path: '{{ remote_dir }}/{{ item.dest.split("/")[0] }}'
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Copy file, dest is a nonexistent target directory
|
- name: Copy file, dest is a nonexistent target directory
|
||||||
copy:
|
copy:
|
||||||
src: '{{ item.src }}'
|
src: '{{ item.src }}'
|
||||||
dest: '{{ remote_dir }}/new_sub_dir1/{{ item.dest }}'
|
dest: '{{ remote_dir }}/{{ item.dest }}'
|
||||||
register: copy_result
|
register: copy_result
|
||||||
|
|
||||||
- name: assert copy worked
|
- name: assert copy worked
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
- name: stat copied file
|
- name: stat copied file
|
||||||
stat:
|
stat:
|
||||||
path: '{{ remote_dir }}/new_sub_dir1/sub_dir2/{{ item.check }}'
|
path: '{{ remote_dir }}/{{ item.check }}'
|
||||||
register: stat_file_in_dir_result
|
register: stat_file_in_dir_result
|
||||||
|
|
||||||
- name: assert that file exists
|
- name: assert that file exists
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
- name: Ensure that dest top directory doesn't exist
|
- name: Ensure that dest top directory doesn't exist
|
||||||
file:
|
file:
|
||||||
path: '{{ remote_dir }}/new_sub_dir1'
|
path: '{{ remote_dir }}/{{ dest.split("/")[0] }}'
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Copy file, dest is a file in non-existing target directory
|
- name: Copy file, dest is a file in non-existing target directory
|
||||||
copy:
|
copy:
|
||||||
src: foo.txt
|
src: foo.txt
|
||||||
dest: '{{ dest }}'
|
dest: '{{ remote_dir }}/{{ dest }}'
|
||||||
register: copy_result
|
register: copy_result
|
||||||
ignore_errors: True
|
ignore_errors: True
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
- name: Stat dest path
|
- name: Stat dest path
|
||||||
stat:
|
stat:
|
||||||
path: '{{ remote_dir }}/new_sub_dir1'
|
path: '{{ remote_dir }}/{{ dest.split("/")[0] }}'
|
||||||
register: stat_file_in_dir_result
|
register: stat_file_in_dir_result
|
||||||
|
|
||||||
- name: assert that dest doesn't exist
|
- name: assert that dest doesn't exist
|
||||||
|
|
|
@ -931,16 +931,16 @@
|
||||||
# checks that dest is created
|
# checks that dest is created
|
||||||
- include: dest_in_non_existent_directories.yml
|
- include: dest_in_non_existent_directories.yml
|
||||||
with_items:
|
with_items:
|
||||||
- { src: 'foo.txt', dest: 'sub_dir2/', check: 'foo.txt' }
|
- { src: 'foo.txt', dest: 'new_sub_dir1/sub_dir2/', check: 'new_sub_dir1/sub_dir2/foo.txt' }
|
||||||
- { src: 'subdir', dest: 'sub_dir2/', check: 'subdir/bar.txt' }
|
- { src: 'subdir', dest: 'new_sub_dir1/sub_dir2/', check: 'new_sub_dir1/sub_dir2/subdir/bar.txt' }
|
||||||
- { src: 'subdir/', dest: 'sub_dir2/', check: 'bar.txt' }
|
- { src: 'subdir/', dest: 'new_sub_dir1/sub_dir2/', check: 'new_sub_dir1/sub_dir2/bar.txt' }
|
||||||
- { src: 'subdir', dest: 'sub_dir2', check: 'subdir/bar.txt' }
|
- { src: 'subdir', dest: 'new_sub_dir1/sub_dir2', check: 'new_sub_dir1/sub_dir2/subdir/bar.txt' }
|
||||||
- { src: 'subdir/', dest: 'sub_dir2', check: '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
|
# 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
|
- include: src_file_dest_file_in_non_existent_dir.yml
|
||||||
with_items:
|
with_items:
|
||||||
- '{{ remote_dir }}/new_sub_dir1/sub_dir2/foo.txt'
|
- 'new_sub_dir1/sub_dir2/foo.txt'
|
||||||
- '{{ remote_dir }}/new_sub_dir1/foo.txt'
|
- 'new_sub_dir1/foo.txt'
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: 'dest'
|
loop_var: 'dest'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue