Debian Codegraph @

ansible_collections/community/general/tests/unit/plugins/modules/test_cpanm.yaml

raw
1 # Copyright (c) Alexei Znamensky ([email protected])
2 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
3 # SPDX-License-Identifier: GPL-3.0-or-later
4
5 ---
6 anchors:
7 environ_true: &env-def-true {environ_update: {LANGUAGE: C, LC_ALL: C}, check_rc: true}
8 environ_false: &env-def-false {environ_update: {LANGUAGE: C, LC_ALL: C}, check_rc: false}
9 test_cases:
10 - id: install_dancer
11 input:
12 name: Dancer
13 output:
14 changed: true
15 mocks:
16 run_command:
17 - command: [/testbin/cpanm, --version]
18 environ: *env-def-true
19 rc: 0
20 out: |
21 cpanm (App::cpanminus) version 1.7047 (/usr/local/bin/cpanm)
22 perl version 5.041005 (/usr/local/bin/perl)
23 err: ''
24 - command: [/testbin/cpanm, Dancer]
25 environ: *env-def-true
26 rc: 0
27 out: ''
28 err: ''
29 - id: install_distribution_file
30 input:
31 name: MIYAGAWA/Plack-0.99_05.tar.gz
32 output:
33 changed: true
34 mocks:
35 run_command:
36 - command: [/testbin/cpanm, --version]
37 environ: *env-def-true
38 rc: 0
39 out: |
40 cpanm (App::cpanminus) version 1.7047 (/usr/local/bin/cpanm)
41 perl version 5.041005 (/usr/local/bin/perl)
42 err: ''
43 - command: [/testbin/cpanm, MIYAGAWA/Plack-0.99_05.tar.gz]
44 environ: *env-def-true
45 rc: 0
46 out: ''
47 err: ''
48 - id: install_into_locallib
49 input:
50 name: Dancer
51 mode: new
52 locallib: /srv/webapps/my_app/extlib
53 output:
54 changed: true
55 mocks:
56 run_command:
57 - command: [/testbin/cpanm, --version]
58 environ: *env-def-true
59 rc: 0
60 out: |
61 cpanm (App::cpanminus) version 1.7047 (/usr/local/bin/cpanm)
62 perl version 5.041005 (/usr/local/bin/perl)
63 err: ''
64 - command: [/testbin/cpanm, --local-lib, /srv/webapps/my_app/extlib, Dancer]
65 environ: *env-def-true
66 rc: 0
67 out: ''
68 err: ''
69 - id: install_from_local_directory
70 input:
71 from_path: /srv/webapps/my_app/src/
72 mode: new
73 output:
74 changed: true
75 mocks:
76 run_command:
77 - command: [/testbin/cpanm, --version]
78 environ: *env-def-true
79 rc: 0
80 out: |
81 cpanm (App::cpanminus) version 1.7047 (/usr/local/bin/cpanm)
82 perl version 5.041005 (/usr/local/bin/perl)
83 err: ''
84 - command: [/testbin/cpanm, /srv/webapps/my_app/src/]
85 environ: *env-def-true
86 rc: 0
87 out: ''
88 err: ''
89 - id: install_into_locallib_no_unit_testing
90 input:
91 name: Dancer
92 notest: true
93 mode: new
94 locallib: /srv/webapps/my_app/extlib
95 output:
96 changed: true
97 mocks:
98 run_command:
99 - command: [/testbin/cpanm, --version]
100 environ: *env-def-true
101 rc: 0
102 out: |
103 cpanm (App::cpanminus) version 1.7047 (/usr/local/bin/cpanm)
104 perl version 5.041005 (/usr/local/bin/perl)
105 err: ''
106 - command: [/testbin/cpanm, --notest, --local-lib, /srv/webapps/my_app/extlib, Dancer]
107 environ: *env-def-true
108 rc: 0
109 out: ''
110 err: ''
111 - id: install_from_mirror
112 input:
113 name: Dancer
114 mode: new
115 mirror: http://cpan.cpantesters.org/
116 output:
117 changed: true
118 mocks:
119 run_command:
120 - command: [/testbin/cpanm, --version]
121 environ: *env-def-true
122 rc: 0
123 out: |
124 cpanm (App::cpanminus) version 1.7047 (/usr/local/bin/cpanm)
125 perl version 5.041005 (/usr/local/bin/perl)
126 err: ''
127 - command: [/testbin/cpanm, --mirror, http://cpan.cpantesters.org/, Dancer]
128 environ: *env-def-true
129 rc: 0
130 out: ''
131 err: ''
132 - id: install_into_system_lib
133 input:
134 name: Dancer
135 mode: new
136 system_lib: true
137 output:
138 failed: true
139 mocks:
140 run_command: []
141 - id: install_minversion_implicit
142 input:
143 name: Dancer
144 mode: new
145 version: '1.0'
146 output:
147 changed: true
148 mocks:
149 run_command:
150 - command: [/testbin/cpanm, --version]
151 environ: *env-def-true
152 rc: 0
153 out: |
154 cpanm (App::cpanminus) version 1.7047 (/usr/local/bin/cpanm)
155 perl version 5.041005 (/usr/local/bin/perl)
156 err: ''
157 - command: [/testbin/cpanm, Dancer~1.0]
158 environ: *env-def-true
159 rc: 0
160 out: ''
161 err: ''
162 - id: install_minversion_explicit
163 input:
164 name: Dancer
165 mode: new
166 version: ~1.5
167 output:
168 changed: true
169 mocks:
170 run_command:
171 - command: [/testbin/cpanm, --version]
172 environ: *env-def-true
173 rc: 0
174 out: |
175 cpanm (App::cpanminus) version 1.7047 (/usr/local/bin/cpanm)
176 perl version 5.041005 (/usr/local/bin/perl)
177 err: ''
178 - command: [/testbin/cpanm, Dancer~1.5]
179 environ: *env-def-true
180 rc: 0
181 out: ''
182 err: ''
183 - id: install_specific_version
184 input:
185 name: Dancer
186 mode: new
187 version: '@1.7'
188 output:
189 changed: true
190 mocks:
191 run_command:
192 - command: [/testbin/cpanm, --version]
193 environ: *env-def-true
194 rc: 0
195 out: |
196 cpanm (App::cpanminus) version 1.7047 (/usr/local/bin/cpanm)
197 perl version 5.041005 (/usr/local/bin/perl)
198 err: ''
199 - command: [/testbin/cpanm, [email protected]]
200 environ: *env-def-true
201 rc: 0
202 out: ''
203 err: ''
204 - id: install_specific_version_from_file_error
205 input:
206 name: MIYAGAWA/Plack-0.99_05.tar.gz
207 mode: new
208 version: '@1.7'
209 output:
210 failed: true
211 msg: parameter 'version' must not be used when installing from a file
212 mocks:
213 run_command:
214 - command: [/testbin/cpanm, --version]
215 environ: *env-def-true
216 rc: 0
217 out: |
218 cpanm (App::cpanminus) version 1.7047 (/usr/local/bin/cpanm)
219 perl version 5.041005 (/usr/local/bin/perl)
220 err: ''
221 - id: install_specific_version_from_directory_error
222 input:
223 from_path: ~/
224 mode: new
225 version: '@1.7'
226 output:
227 failed: true
228 msg: parameter 'version' must not be used when installing from a directory
229 mocks:
230 run_command:
231 - command: [/testbin/cpanm, --version]
232 environ: *env-def-true
233 rc: 0
234 out: |
235 cpanm (App::cpanminus) version 1.7047 (/usr/local/bin/cpanm)
236 perl version 5.041005 (/usr/local/bin/perl)
237 err: ''
238 - id: install_specific_version_from_git_url_explicit
239 input:
240 name: git://github.com/plack/Plack.git
241 mode: new
242 version: '@1.7'
243 output:
244 changed: true
245 mocks:
246 run_command:
247 - command: [/testbin/cpanm, --version]
248 environ: *env-def-true
249 rc: 0
250 out: |
251 cpanm (App::cpanminus) version 1.7047 (/usr/local/bin/cpanm)
252 perl version 5.041005 (/usr/local/bin/perl)
253 err: ''
254 - command: [/testbin/cpanm, git://github.com/plack/[email protected]]
255 environ: *env-def-true
256 rc: 0
257 out: ''
258 err: ''
259 - id: install_specific_version_from_git_url_implicit
260 input:
261 name: git://github.com/plack/Plack.git
262 mode: new
263 version: '2.5'
264 output:
265 changed: true
266 mocks:
267 run_command:
268 - command: [/testbin/cpanm, --version]
269 environ: *env-def-true
270 rc: 0
271 out: |
272 cpanm (App::cpanminus) version 1.7047 (/usr/local/bin/cpanm)
273 perl version 5.041005 (/usr/local/bin/perl)
274 err: ''
275 - command: [/testbin/cpanm, git://github.com/plack/[email protected]]
276 environ: *env-def-true
277 rc: 0
278 out: ''
279 err: ''
280 - id: install_version_operator_from_git_url_error
281 input:
282 name: git://github.com/plack/Plack.git
283 mode: new
284 version: ~2.5
285 output:
286 failed: true
287 msg: operator '~' not allowed in version parameter when installing from git repository
288 mocks:
289 run_command:
290 - command: [/testbin/cpanm, --version]
291 environ: *env-def-true
292 rc: 0
293 out: |
294 cpanm (App::cpanminus) version 1.7047 (/usr/local/bin/cpanm)
295 perl version 5.041005 (/usr/local/bin/perl)
296 err: ''
297 - id: install_dancer_with_recommends
298 input:
299 name: Dancer2
300 install_recommendations: true
301 output:
302 changed: true
303 mocks:
304 run_command:
305 - command: [/testbin/cpanm, --version]
306 environ: *env-def-true
307 rc: 0
308 out: |
309 cpanm (App::cpanminus) version 1.7047 (/usr/local/bin/cpanm)
310 perl version 5.041005 (/usr/local/bin/perl)
311 err: ''
312 - command: [/testbin/cpanm, --with-recommends, Dancer2]
313 environ: *env-def-true
314 rc: 0
315 out: ''
316 err: ''
317 - id: install_dancer_with_suggests
318 input:
319 name: Dancer2
320 install_suggestions: true
321 output:
322 changed: true
323 mocks:
324 run_command:
325 - command: [/testbin/cpanm, --version]
326 environ: *env-def-true
327 rc: 0
328 out: |
329 cpanm (App::cpanminus) version 1.7047 (/usr/local/bin/cpanm)
330 perl version 5.041005 (/usr/local/bin/perl)
331 err: ''
332 - command: [/testbin/cpanm, --with-suggests, Dancer2]
333 environ: *env-def-true
334 rc: 0
335 out: ''
336 err: ''