Debian Codegraph @

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

raw
1 ####################################################################
2 # WARNING: These are designed specifically for Ansible tests #
3 # and should not be used as examples of how to write Ansible roles #
4 ####################################################################
5
6 # Test code for iso_create module
7 # Copyright (c) 2020, Diane Wang (Tomorrow9) <[email protected]>
8 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
9 # SPDX-License-Identifier: GPL-3.0-or-later
10 - name: install pycdlib
11 pip:
12 name: pycdlib
13 extra_args: "-c {{ remote_constraints }}"
14 register: install_pycdlib
15 - debug: var=install_pycdlib
16
17 - set_fact:
18 output_test_dir: '{{ remote_tmp_dir }}/test_iso_create'
19
20 # - include_tasks: prepare_dest_dir.yml
21
22 - name: Copy files and directories
23 copy:
24 src: '{{ item }}'
25 dest: '{{ remote_tmp_dir }}/{{ item }}'
26 loop:
27 - test1.cfg
28 - test_dir
29
30 - name: Test check mode
31 iso_create:
32 src_files:
33 - "{{ remote_tmp_dir }}/test1.cfg"
34 dest_iso: "{{ output_test_dir }}/test.iso"
35 interchange_level: 3
36 register: iso_result
37 check_mode: true
38 - debug: var=iso_result
39
40 - name: Check if iso file created
41 stat:
42 path: "{{ output_test_dir }}/test.iso"
43 register: iso_file
44 - debug: var=iso_file
45 - assert:
46 that:
47 - iso_result is changed
48 - iso_file.stat.exists == False
49
50 - name: Create iso file with a specified file
51 iso_create:
52 src_files:
53 - "{{ remote_tmp_dir }}/test1.cfg"
54 dest_iso: "{{ output_test_dir }}/test.iso"
55 interchange_level: 3
56 register: iso_result
57 - debug: var=iso_result
58
59 - name: Check if iso file created
60 stat:
61 path: "{{ output_test_dir }}/test.iso"
62 register: iso_file
63
64 - assert:
65 that:
66 - iso_result is changed
67 - iso_file.stat.exists == True
68
69 - name: Create iso file with a specified file and folder
70 iso_create:
71 src_files:
72 - "{{ remote_tmp_dir }}/test1.cfg"
73 - "{{ remote_tmp_dir }}/test_dir"
74 dest_iso: "{{ output_test_dir }}/test1.iso"
75 interchange_level: 3
76 register: iso_result
77 - debug: var=iso_result
78
79 - name: Check if iso file created
80 stat:
81 path: "{{ output_test_dir }}/test1.iso"
82 register: iso_file
83
84 - assert:
85 that:
86 - iso_result is changed
87 - iso_file.stat.exists == True
88
89 - name: Create iso file with volume identification string
90 iso_create:
91 src_files:
92 - "{{ remote_tmp_dir }}/test1.cfg"
93 dest_iso: "{{ output_test_dir }}/test2.iso"
94 vol_ident: "OEMDRV"
95 register: iso_result
96 - debug: var=iso_result
97
98 - name: Check if iso file created
99 stat:
100 path: "{{ output_test_dir }}/test2.iso"
101 register: iso_file
102
103 - assert:
104 that:
105 - iso_result is changed
106 - iso_file.stat.exists == True
107
108 - name: Create iso file with Rock Ridge extension
109 iso_create:
110 src_files:
111 - "{{ remote_tmp_dir }}/test1.cfg"
112 dest_iso: "{{ output_test_dir }}/test3.iso"
113 rock_ridge: "1.09"
114 register: iso_result
115 - debug: var=iso_result
116
117 - name: Check if iso file created
118 stat:
119 path: "{{ output_test_dir }}/test3.iso"
120 register: iso_file
121
122 - assert:
123 that:
124 - iso_result is changed
125 - iso_file.stat.exists == True
126
127 - name: Create iso file with Joliet extension
128 iso_create:
129 src_files:
130 - "{{ remote_tmp_dir }}/test1.cfg"
131 dest_iso: "{{ output_test_dir }}/test4.iso"
132 joliet: 3
133 register: iso_result
134 - debug: var=iso_result
135
136 - name: Check if iso file created
137 stat:
138 path: "{{ output_test_dir }}/test4.iso"
139 register: iso_file
140
141 - assert:
142 that:
143 - iso_result is changed
144 - iso_file.stat.exists == True
145
146 - name: Create iso file with UDF enabled
147 iso_create:
148 src_files:
149 - "{{ remote_tmp_dir }}/test1.cfg"
150 dest_iso: "{{ output_test_dir }}/test5.iso"
151 udf: true
152 register: iso_result
153 - debug: var=iso_result
154
155 - name: Check if iso file created
156 stat:
157 path: "{{ output_test_dir }}/test5.iso"
158 register: iso_file
159
160 - assert:
161 that:
162 - iso_result is changed
163 - iso_file.stat.exists == True