Debian Codegraph @

test/integration/targets/unarchive/tasks/test_zip.yml

raw
1 - name: create our zip unarchive destination
2 file:
3 path: '{{remote_tmp_dir}}/test-unarchive-zip'
4 state: directory
5
6 - name: unarchive a zip file
7 unarchive:
8 src: '{{remote_tmp_dir}}/test-unarchive.zip'
9 dest: '{{remote_tmp_dir}}/test-unarchive-zip'
10 list_files: True
11 remote_src: yes
12 register: unarchive03
13
14 - name: verify that the file was marked as changed
15 assert:
16 that:
17 - "unarchive03.changed == true"
18 # Verify that file list is generated
19 - "'files' in unarchive03"
20 - unarchive03['files'] | length == 3
21 - "'foo-unarchive.txt' in unarchive03['files']"
22 - "'foo-unarchive-777.txt' in unarchive03['files']"
23 - "'FOO-UNAR.TXT' in unarchive03['files']"
24
25 - name: verify that the file was unarchived
26 file:
27 path: '{{remote_tmp_dir}}/test-unarchive-zip/{{item}}'
28 state: file
29 with_items:
30 - foo-unarchive.txt
31 - foo-unarchive-777.txt
32 - FOO-UNAR.TXT
33
34 - name: repeat the last request to verify no changes
35 unarchive:
36 src: '{{remote_tmp_dir}}/test-unarchive.zip'
37 dest: '{{remote_tmp_dir}}/test-unarchive-zip'
38 list_files: true
39 remote_src: true
40 register: unarchive03b
41
42 - name: verify that the task was not marked as changed
43 assert:
44 that:
45 - "unarchive03b.changed == false"
46 # This test is broken on FreeBSD when running split, but not when running on the controller (2.19 and earlier).
47 # On the controller, 'foo-unarchive-777.txt' is extracted as 0755, and the test never verifies it should be 0777.
48 # The unarchive module expects the permissions to be 0755 in this case, so does not report it as changed.
49 # When split, it is extracted as 0777, which causes the test to fail because it is reported as changed.
50 # This appears to be due to faulty logic in unarchive around the permissions expected on BSD.
51 when: ansible_distribution != 'FreeBSD'
52
53 - name: nuke zip destination
54 file:
55 path: '{{remote_tmp_dir}}/test-unarchive-zip'
56 state: absent
57
58 - name: test owner/group perms
59 include_tasks: test_owner_group.yml
60 vars:
61 ext: zip
62 archive: test-unarchive.zip
63 testfile: foo-unarchive.txt