mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-09 14:50:02 -07:00
Fix for recursive copy slowness
Copy module was walking over files in subdirectories repeatedly (a directory tree a few levels deep could bring the time spent into the tens of minutes) This was traced to the fix for this bug report: https://github.com/ansible/ansible/issues/13013 Fixed #13013 a different way and added an integration test to check for regressions of #13013 as we optimize this code. Fixes #21513
This commit is contained in:
parent
ac61f09203
commit
78ced5318f
2 changed files with 46 additions and 21 deletions
|
@ -258,3 +258,48 @@
|
|||
assert:
|
||||
that:
|
||||
- replace_follow_result.checksum == target_file_result.stdout
|
||||
|
||||
- name: create a test dir to copy
|
||||
file:
|
||||
path: '{{ output_dir }}/top_dir'
|
||||
state: directory
|
||||
|
||||
- name: create a test dir to symlink to
|
||||
file:
|
||||
path: '{{ output_dir }}/linked_dir'
|
||||
state: directory
|
||||
|
||||
- name: create a file in the test dir
|
||||
copy:
|
||||
dest: '{{ output_dir }}/linked_dir/file1'
|
||||
content: 'hello world'
|
||||
|
||||
- name: create a link to the test dir
|
||||
file:
|
||||
path: '{{ output_dir }}/top_dir/follow_link_dir'
|
||||
src: '{{ output_dir }}/linked_dir'
|
||||
state: link
|
||||
|
||||
- name: copy the directory's link
|
||||
copy:
|
||||
src: '{{ output_dir }}/top_dir'
|
||||
dest: '{{ output_dir }}/new_dir'
|
||||
follow: True
|
||||
|
||||
- name: stat the copied path
|
||||
stat:
|
||||
path: '{{ output_dir }}/new_dir/top_dir/follow_link_dir'
|
||||
register: stat_dir_result
|
||||
|
||||
- name: stat the copied path
|
||||
stat:
|
||||
path: '{{ output_dir }}/new_dir/top_dir/follow_link_dir/file1'
|
||||
register: stat_file_in_dir_result
|
||||
|
||||
- name: assert that the directory exists
|
||||
assert:
|
||||
that:
|
||||
- stat_dir_result.stat.exists
|
||||
- stat_dir_result.stat.isdir
|
||||
- stat_file_in_dir_result.stat.exists
|
||||
- stat_file_in_dir_result.stat.isreg
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue