summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/unarchive/tasks/test_zip.yml
blob: cf03946fcdf37c2f09109ff3ef0f30c4ea2cb732 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
- name: create our zip unarchive destination
  file:
    path: '{{remote_tmp_dir}}/test-unarchive-zip'
    state: directory

- name: unarchive a zip file
  unarchive:
    src: '{{remote_tmp_dir}}/test-unarchive.zip'
    dest: '{{remote_tmp_dir}}/test-unarchive-zip'
    list_files: True
    remote_src: yes
  register: unarchive03

- name: verify that the file was marked as changed
  assert:
    that:
      - "unarchive03.changed == true"
      # Verify that file list is generated
      - "'files' in unarchive03"
      - "{{unarchive03['files']| length}} == 3"
      - "'foo-unarchive.txt' in unarchive03['files']"
      - "'foo-unarchive-777.txt' in unarchive03['files']"
      - "'FOO-UNAR.TXT' in unarchive03['files']"

- name: verify that the file was unarchived
  file:
    path: '{{remote_tmp_dir}}/test-unarchive-zip/{{item}}'
    state: file
  with_items:
    - foo-unarchive.txt
    - foo-unarchive-777.txt
    - FOO-UNAR.TXT

- name: repeat the last request to verify no changes
  unarchive:
    src: '{{remote_tmp_dir}}/test-unarchive.zip'
    dest: '{{remote_tmp_dir}}/test-unarchive-zip'
    list_files: true
    remote_src: true
  register: unarchive03b

- name: verify that the task was not marked as changed
  assert:
    that:
      - "unarchive03b.changed == false"

- name: nuke zip destination
  file:
    path: '{{remote_tmp_dir}}/test-unarchive-zip'
    state: absent

- name: test owner/group perms
  include_tasks: test_owner_group.yml
  vars:
    ext: zip
    archive: test-unarchive.zip
    testfile: foo-unarchive.txt