diff --git a/test/integration/targets/win_copy/tasks/main.yml b/test/integration/targets/win_copy/tasks/main.yml index e4fc6a2dbb6..3e7e2b2a593 100644 --- a/test/integration/targets/win_copy/tasks/main.yml +++ b/test/integration/targets/win_copy/tasks/main.yml @@ -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