Debian Codegraph @

ansible_collections/community/general/tests/integration/targets/archive/tasks/main.yml

raw
1 ---
2 ####################################################################
3 # WARNING: These are designed specifically for Ansible tests #
4 # and should not be used as examples of how to write Ansible roles #
5 ####################################################################
6
7 # Test code for the archive module.
8 # Copyright (c) 2017, Abhijeet Kasurde <[email protected]>
9 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
10 # SPDX-License-Identifier: GPL-3.0-or-later
11
12 # Make sure we start fresh
13
14 # Test setup
15 - name: prep our files
16 copy: src={{ item }} dest={{remote_tmp_dir}}/{{ item }}
17 with_items:
18 - foo.txt
19 - bar.txt
20 - empty.txt
21 - sub
22 - sub/subfile.txt
23
24 # Run twice without lzma backport installed, to make sure it does not crash
25 - name: Archive - pre-test - first run
26 archive:
27 path: "{{ remote_tmp_dir }}/*.txt"
28 dest: "{{ remote_tmp_dir }}/archive_pretest_1.tar"
29 format: "tar"
30 register: pretest_1
31
32 - name: Archive - pre-test - second run
33 archive:
34 path: "{{ remote_tmp_dir }}/*.txt"
35 dest: "{{ remote_tmp_dir }}/archive_pretest_1.tar"
36 format: "tar"
37 register: pretest_2
38
39 - name: Archive - validate pre-test
40 assert:
41 that:
42 - pretest_1 is changed
43 - pretest_2 is not changed
44
45 # Install dependencies
46 - name: Ensure zip is present to create test archive (yum)
47 yum: name=zip state=latest
48 when: ansible_facts.pkg_mgr == 'yum'
49
50 - name: Ensure zip is present to create test archive (apt)
51 apt: name=zip state=latest
52 when: ansible_facts.pkg_mgr == 'apt'
53
54 - name: Define formats to test
55 set_fact:
56 formats:
57 - tar
58 - zip
59 - gz
60 - bz2
61 - xz
62
63 # Run tests
64 - name: Run core tests
65 include_tasks:
66 file: ../tests/core.yml
67 loop: "{{ formats }}"
68 loop_control:
69 loop_var: format
70
71 - name: Run exclusions tests
72 include_tasks:
73 file: ../tests/exclusions.yml
74 loop: "{{ formats }}"
75 loop_control:
76 loop_var: format
77
78 - name: Run remove tests
79 include_tasks:
80 file: ../tests/remove.yml
81 loop: "{{ formats }}"
82 loop_control:
83 loop_var: format
84
85 - name: Run broken link tests
86 include_tasks:
87 file: ../tests/broken-link.yml
88 loop: "{{ formats }}"
89 loop_control:
90 loop_var: format
91
92 - name: Run Idempotency tests
93 include_tasks:
94 file: ../tests/idempotency.yml
95 loop: "{{ formats }}"
96 loop_control:
97 loop_var: format