Added win_copy recursive integration test with trailing path separator. (#24523)

This is a reproducer for https://github.com/ansible/ansible/issues/23559

Tests will fail until https://github.com/ansible/ansible/pull/23581 is merged

Note that I believe another commit is also needed for this to work,
specifically the change from: https://github.com/ansible/ansible/pull/23326
This commit is contained in:
jhawkesworth 2017-05-23 18:57:24 +01:00 committed by Matt Davis
parent 5240e5a230
commit b46c098581

View file

@ -162,6 +162,50 @@
that:
- not recursive_copy_result_again|changed
# Recursive folder copy with trailing slash (see issue 23559)
- name: make an output subdirectory
win_file:
path: "{{win_output_dir}}\\subtrailing\\"
state: directory
- name: test recursive copy to directory
win_copy:
src: subdir/
dest: "{{win_output_dir}}\\subtrailing\\"
register: recursive_copy_result2
- name: get stats on files within sub directory
win_find:
paths: "{{win_output_dir}}\\subtrailing\\"
recurse: True
register: recurse_find_results2
- name: assert recursive copy worked
assert:
that:
- recursive_copy_result2|changed
- recurse_find_results2.examined == 6 # checks that it found 3 folders and 3 files.
# Note this is different from the test above because, by including the trailing
# slash on the source, we only get the *contents* of the source folder
# without the trailing slash, we would get the source folder *and* its
# contents.
# See 'src' parameter documentation
# here: http://docs.ansible.com/ansible/win_copy_module.html
- name: test recursive copy to directory again with source slash
win_copy:
src: subdir/
dest: "{{win_output_dir}}\\subtrailing\\"
register: recursive_copy_result_again2
- name: assert recursive copy worked
assert:
that:
- not recursive_copy_result_again2|changed
# test 'content' parameter
- name: create file with content
win_copy:
content: abc