diff --git a/test/integration/targets/unarchive/tasks/main.yml b/test/integration/targets/unarchive/tasks/main.yml index 278642a1066..29189ed2424 100644 --- a/test/integration/targets/unarchive/tasks/main.yml +++ b/test/integration/targets/unarchive/tasks/main.yml @@ -9,6 +9,7 @@ - import_tasks: test_tar_gz_content_differs.yml - import_tasks: test_tar_zst.yml - import_tasks: test_zip.yml +- import_tasks: test_zip_timezone_dst.yml - import_tasks: test_exclude.yml - import_tasks: test_include.yml - import_tasks: test_parent_not_writeable.yml diff --git a/test/integration/targets/unarchive/tasks/prepare_tests.yml b/test/integration/targets/unarchive/tasks/prepare_tests.yml index fa8de52d7d5..d932b145e4f 100644 --- a/test/integration/targets/unarchive/tasks/prepare_tests.yml +++ b/test/integration/targets/unarchive/tasks/prepare_tests.yml @@ -72,6 +72,7 @@ - created/include - created/exclude - created/other + - datetime-dst - name: Prepare - Create test files file: @@ -91,9 +92,19 @@ - other/other-1.ext - other/other-2.ext +- name: Setup custom DST (date saving time) for zip test + # datetime must match a DST period for Europe/Paris + file: + path: "{{ remote_tmp_dir }}/datetime-dst/datetime-dst.txt" + state: touch + modification_time: 202507241203.34 + - name: Prepare - zip file shell: zip -r {{remote_tmp_dir}}/unarchive-00.zip * chdir={{remote_tmp_dir}}/created/ +- name: Prepare - zip file (timezone DST) + shell: zip -r {{remote_tmp_dir}}/test-datetime-dst.zip * chdir={{remote_tmp_dir}}/datetime-dst/ + - name: Prepare - tar file shell: tar czvf {{remote_tmp_dir}}/unarchive-00.tar * chdir={{remote_tmp_dir}}/created/ diff --git a/test/integration/targets/unarchive/tasks/test_zip_timezone_dst.yml b/test/integration/targets/unarchive/tasks/test_zip_timezone_dst.yml new file mode 100644 index 00000000000..3db318d669e --- /dev/null +++ b/test/integration/targets/unarchive/tasks/test_zip_timezone_dst.yml @@ -0,0 +1,47 @@ +--- +# Ensure timestamp verification for zip unarchive is correctly done +- block: + - name: Create zip unarchive destination + file: + path: '{{ remote_tmp_dir }}/test-unarchive-zip-timezone-dst' + state: directory + environment: + TZ: Europe/Paris + + - name: Unarchive a zip file + unarchive: + src: '{{ remote_tmp_dir }}/test-datetime-dst.zip' + dest: '{{ remote_tmp_dir }}/test-unarchive-zip-timezone-dst' + list_files: True + remote_src: yes + environment: + TZ: Europe/Paris + + - name: Verify that the file was marked as changed + assert: + that: + - unarchive_timezone.changed + + - name: Unarchive a zip file again + unarchive: + src: '{{ remote_tmp_dir }}/test-datetime-dst.zip' + dest: '{{ remote_tmp_dir }}/test-unarchive-zip-timezone-dst' + list_files: True + remote_src: yes + register: unarchive_timezone + environment: + TZ: Europe/Paris + + - name: Verify that the task was not marked as changed + assert: + that: + - not unarchive_timezone.changed + # FreeBSD fails because of permissions issues + # MacOSX fails because of group owner issues + when: not ansible_facts['distribution'] in ['FreeBSD', 'MacOSX'] + + always: + - name: Remove zip destination + file: + path: '{{remote_tmp_dir}}/test-unarchive-zip-timezone-dst' + state: absent