1---
2- name: create test collection install directory - {{ test_name }}
3  file:
4    path: '{{ galaxy_dir }}/ansible_collections'
5    state: directory
6
7- name: install simple collection from first accessible server
8  command: ansible-galaxy collection install namespace1.name1 {{ galaxy_verbosity }}
9  environment:
10    ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
11  register: from_first_good_server
12
13- name: get installed files of install simple collection from first good server
14  find:
15    path: '{{ galaxy_dir }}/ansible_collections/namespace1/name1'
16    file_type: file
17  register: install_normal_files
18
19- name: get the manifest of install simple collection from first good server
20  slurp:
21    path: '{{ galaxy_dir }}/ansible_collections/namespace1/name1/MANIFEST.json'
22  register: install_normal_manifest
23
24- name: assert install simple collection from first good server
25  assert:
26    that:
27    - '"Installing ''namespace1.name1:1.0.9'' to" in from_first_good_server.stdout'
28    - install_normal_files.files | length == 3
29    - install_normal_files.files[0].path | basename in ['MANIFEST.json', 'FILES.json', 'README.md']
30    - install_normal_files.files[1].path | basename in ['MANIFEST.json', 'FILES.json', 'README.md']
31    - install_normal_files.files[2].path | basename in ['MANIFEST.json', 'FILES.json', 'README.md']
32    - (install_normal_manifest.content | b64decode | from_json).collection_info.version == '1.0.9'
33
34- name: Remove the collection
35  file:
36    path: '{{ galaxy_dir }}/ansible_collections/namespace1'
37    state: absent
38
39- name: install simple collection with implicit path - {{ test_name }}
40  command: ansible-galaxy collection install namespace1.name1 -s '{{ test_name }}' {{ galaxy_verbosity }}
41  environment:
42    ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
43  register: install_normal
44
45- name: get installed files of install simple collection with implicit path - {{ test_name }}
46  find:
47    path: '{{ galaxy_dir }}/ansible_collections/namespace1/name1'
48    file_type: file
49  register: install_normal_files
50
51- name: get the manifest of install simple collection with implicit path - {{ test_name }}
52  slurp:
53    path: '{{ galaxy_dir }}/ansible_collections/namespace1/name1/MANIFEST.json'
54  register: install_normal_manifest
55
56- name: assert install simple collection with implicit path - {{ test_name }}
57  assert:
58    that:
59    - '"Installing ''namespace1.name1:1.0.9'' to" in install_normal.stdout'
60    - install_normal_files.files | length == 3
61    - install_normal_files.files[0].path | basename in ['MANIFEST.json', 'FILES.json', 'README.md']
62    - install_normal_files.files[1].path | basename in ['MANIFEST.json', 'FILES.json', 'README.md']
63    - install_normal_files.files[2].path | basename in ['MANIFEST.json', 'FILES.json', 'README.md']
64    - (install_normal_manifest.content | b64decode | from_json).collection_info.version == '1.0.9'
65
66- name: install existing without --force - {{ test_name }}
67  command: ansible-galaxy collection install namespace1.name1 -s '{{ test_name }}' {{ galaxy_verbosity }}
68  environment:
69    ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
70  register: install_existing_no_force
71
72- name: assert install existing without --force - {{ test_name }}
73  assert:
74    that:
75    - '"Nothing to do. All requested collections are already installed" in install_existing_no_force.stdout'
76
77- name: install existing with --force - {{ test_name }}
78  command: ansible-galaxy collection install namespace1.name1 -s '{{ test_name }}' --force {{ galaxy_verbosity }}
79  environment:
80    ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
81  register: install_existing_force
82
83- name: assert install existing with --force - {{ test_name }}
84  assert:
85    that:
86    - '"Installing ''namespace1.name1:1.0.9'' to" in install_existing_force.stdout'
87
88- name: remove test installed collection - {{ test_name }}
89  file:
90    path: '{{ galaxy_dir }}/ansible_collections/namespace1'
91    state: absent
92
93- name: install pre-release as explicit version to custom dir - {{ test_name }}
94  command: ansible-galaxy collection install 'namespace1.name1:1.1.0-beta.1' -s '{{ test_name }}' -p '{{ galaxy_dir }}/ansible_collections' {{ galaxy_verbosity }}
95  register: install_prerelease
96
97- name: get result of install pre-release as explicit version to custom dir - {{ test_name }}
98  slurp:
99    path: '{{ galaxy_dir }}/ansible_collections/namespace1/name1/MANIFEST.json'
100  register: install_prerelease_actual
101
102- name: assert install pre-release as explicit version to custom dir - {{ test_name }}
103  assert:
104    that:
105    - '"Installing ''namespace1.name1:1.1.0-beta.1'' to" in install_prerelease.stdout'
106    - (install_prerelease_actual.content | b64decode | from_json).collection_info.version == '1.1.0-beta.1'
107
108- name: Remove beta
109  file:
110    path: '{{ galaxy_dir }}/ansible_collections/namespace1/name1'
111    state: absent
112
113- name: install pre-release version with --pre to custom dir - {{ test_name }}
114  command: ansible-galaxy collection install --pre 'namespace1.name1' -s '{{ test_name }}' -p '{{ galaxy_dir }}/ansible_collections' {{ galaxy_verbosity }}
115  register: install_prerelease
116
117- name: get result of install pre-release version with --pre to custom dir - {{ test_name }}
118  slurp:
119    path: '{{ galaxy_dir }}/ansible_collections/namespace1/name1/MANIFEST.json'
120  register: install_prerelease_actual
121
122- name: assert install pre-release version with --pre to custom dir - {{ test_name }}
123  assert:
124    that:
125    - '"Installing ''namespace1.name1:1.1.0-beta.1'' to" in install_prerelease.stdout'
126    - (install_prerelease_actual.content | b64decode | from_json).collection_info.version == '1.1.0-beta.1'
127
128- name: install multiple collections with dependencies - {{ test_name }}
129  command: ansible-galaxy collection install parent_dep.parent_collection:1.0.0 namespace2.name -s {{ test_name }} {{ galaxy_verbosity }}
130  args:
131    chdir: '{{ galaxy_dir }}/ansible_collections'
132  environment:
133    ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
134    ANSIBLE_CONFIG: '{{ galaxy_dir }}/ansible.cfg'
135  register: install_multiple_with_dep
136
137- name: get result of install multiple collections with dependencies - {{ test_name }}
138  slurp:
139    path: '{{ galaxy_dir }}/ansible_collections/{{ collection.namespace }}/{{ collection.name }}/MANIFEST.json'
140  register: install_multiple_with_dep_actual
141  loop_control:
142    loop_var: collection
143  loop:
144  - namespace: namespace2
145    name: name
146  - namespace: parent_dep
147    name: parent_collection
148  - namespace: child_dep
149    name: child_collection
150  - namespace: child_dep
151    name: child_dep2
152
153- name: assert install multiple collections with dependencies - {{ test_name }}
154  assert:
155    that:
156    - (install_multiple_with_dep_actual.results[0].content | b64decode | from_json).collection_info.version == '1.0.0'
157    - (install_multiple_with_dep_actual.results[1].content | b64decode | from_json).collection_info.version == '1.0.0'
158    - (install_multiple_with_dep_actual.results[2].content | b64decode | from_json).collection_info.version == '0.9.9'
159    - (install_multiple_with_dep_actual.results[3].content | b64decode | from_json).collection_info.version == '1.2.2'
160
161- name: expect failure with dep resolution failure
162  command:  ansible-galaxy collection install fail_namespace.fail_collection -s {{ test_name }} {{ galaxy_verbosity }}
163  register: fail_dep_mismatch
164  failed_when:
165  - '"Could not satisfy the following requirements" not in fail_dep_mismatch.stderr'
166  - '" fail_dep2.name:<0.0.5 (dependency of fail_namespace.fail_collection:2.1.2)" not in fail_dep_mismatch.stderr'
167
168- name: Find artifact url for namespace3.name
169  uri:
170    url: '{{ test_server }}{{ vX }}collections/namespace3/name/versions/1.0.0/'
171    user: '{{ pulp_user }}'
172    password: '{{ pulp_password }}'
173    force_basic_auth: true
174  register: artifact_url_response
175
176- name: download a collection for an offline install - {{ test_name }}
177  get_url:
178    url: '{{ artifact_url_response.json.download_url }}'
179    dest: '{{ galaxy_dir }}/namespace3.tar.gz'
180
181- name: install a collection from a tarball - {{ test_name }}
182  command: ansible-galaxy collection install '{{ galaxy_dir }}/namespace3.tar.gz' {{ galaxy_verbosity }}
183  register: install_tarball
184  environment:
185    ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
186
187- name: get result of install collection from a tarball - {{ test_name }}
188  slurp:
189    path: '{{ galaxy_dir }}/ansible_collections/namespace3/name/MANIFEST.json'
190  register: install_tarball_actual
191
192- name: assert install a collection from a tarball - {{ test_name }}
193  assert:
194    that:
195    - '"Installing ''namespace3.name:1.0.0'' to" in install_tarball.stdout'
196    - (install_tarball_actual.content | b64decode | from_json).collection_info.version == '1.0.0'
197
198- name: write a requirements file using the artifact and a conflicting version
199  copy:
200    content: |
201            collections:
202              - name: {{ galaxy_dir }}/namespace3.tar.gz
203                version: 1.2.0
204    dest: '{{ galaxy_dir }}/test_req.yml'
205
206- name: install the requirements file with mismatched versions
207  command: ansible-galaxy collection install -r '{{ galaxy_dir }}/test_req.yml' {{ galaxy_verbosity }}
208  ignore_errors: True
209  register: result
210
211- name: remove the requirements file
212  file:
213    path: '{{ galaxy_dir }}/test_req.yml'
214    state: absent
215
216- assert:
217    that: expected_error in error
218  vars:
219    reset_color: '\x1b\[0m'
220    color: '\x1b\[[0-9];[0-9]{2}m'
221    error: "{{ result.stderr | regex_replace(reset_color) | regex_replace(color) | regex_replace('\\n', ' ') }}"
222    expected_error: >-
223            ERROR! Failed to resolve the requested dependencies map.
224            Got the candidate namespace3.name:1.0.0 (direct request)
225            which didn't satisfy all of the following requirements:
226            * namespace3.name:1.2.0
227
228- name: test error for mismatched dependency versions
229  vars:
230    reset_color: '\x1b\[0m'
231    color: '\x1b\[[0-9];[0-9]{2}m'
232    error: "{{ result.stderr | regex_replace(reset_color) | regex_replace(color) | regex_replace('\\n', ' ') }}"
233    expected_error: >-
234            ERROR! Failed to resolve the requested dependencies map.
235            Got the candidate namespace3.name:1.0.0 (dependency of tmp_parent.name:1.0.0)
236            which didn't satisfy all of the following requirements:
237            * namespace3.name:1.2.0
238  block:
239    - name: init a new parent collection
240      command: ansible-galaxy collection init tmp_parent.name --init-path '{{ galaxy_dir }}/scratch'
241
242    - name: replace the dependencies
243      lineinfile:
244        path: "{{ galaxy_dir }}/scratch/tmp_parent/name/galaxy.yml"
245        regexp: "^dependencies:*"
246        line: "dependencies: { '{{ galaxy_dir }}/namespace3.tar.gz': '1.2.0' }"
247
248    - name: build the new artifact
249      command: ansible-galaxy collection build {{ galaxy_dir }}/scratch/tmp_parent/name
250      args:
251        chdir: "{{ galaxy_dir }}"
252
253    - name: install the artifact to verify the error is handled
254      command: ansible-galaxy collection install '{{ galaxy_dir }}/tmp_parent-name-1.0.0.tar.gz'
255      ignore_errors: yes
256      register: result
257
258    - debug: msg="Actual - {{ error }}"
259
260    - debug: msg="Expected - {{ expected_error }}"
261
262    - assert:
263        that: expected_error in error
264  always:
265    - name: clean up collection skeleton and artifact
266      file:
267        state: absent
268        path: "{{ item }}"
269      loop:
270        - "{{ galaxy_dir }}/scratch/tmp_parent/"
271        - "{{ galaxy_dir }}/tmp_parent-name-1.0.0.tar.gz"
272
273- name: setup bad tarball - {{ test_name }}
274  script: build_bad_tar.py {{ galaxy_dir | quote }}
275
276- name: fail to install a collection from a bad tarball - {{ test_name }}
277  command: ansible-galaxy collection install '{{ galaxy_dir }}/suspicious-test-1.0.0.tar.gz' {{ galaxy_verbosity }}
278  register: fail_bad_tar
279  failed_when: fail_bad_tar.rc != 1 and "Cannot extract tar entry '../../outside.sh' as it will be placed outside the collection directory" not in fail_bad_tar.stderr
280  environment:
281    ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
282
283- name: get result of failed collection install - {{ test_name }}
284  stat:
285    path: '{{ galaxy_dir }}/ansible_collections\suspicious'
286  register: fail_bad_tar_actual
287
288- name: assert result of failed collection install - {{ test_name }}
289  assert:
290    that:
291    - not fail_bad_tar_actual.stat.exists
292
293- name: Find artifact url for namespace4.name
294  uri:
295    url: '{{ test_server }}{{ vX }}collections/namespace4/name/versions/1.0.0/'
296    user: '{{ pulp_user }}'
297    password: '{{ pulp_password }}'
298    force_basic_auth: true
299  register: artifact_url_response
300
301- name: install a collection from a URI - {{ test_name }}
302  command: ansible-galaxy collection install {{ artifact_url_response.json.download_url}} {{ galaxy_verbosity }}
303  register: install_uri
304  environment:
305    ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
306
307- name: get result of install collection from a URI - {{ test_name }}
308  slurp:
309    path: '{{ galaxy_dir }}/ansible_collections/namespace4/name/MANIFEST.json'
310  register: install_uri_actual
311
312- name: assert install a collection from a URI - {{ test_name }}
313  assert:
314    that:
315    - '"Installing ''namespace4.name:1.0.0'' to" in install_uri.stdout'
316    - (install_uri_actual.content | b64decode | from_json).collection_info.version == '1.0.0'
317
318- name: fail to install a collection with an undefined URL - {{ test_name }}
319  command: ansible-galaxy collection install namespace5.name {{ galaxy_verbosity }}
320  register: fail_undefined_server
321  failed_when: '"No setting was provided for required configuration plugin_type: galaxy_server plugin: undefined" not in fail_undefined_server.stderr'
322  environment:
323    ANSIBLE_GALAXY_SERVER_LIST: undefined
324
325- when: not requires_auth
326  block:
327    - name: install a collection with an empty server list - {{ test_name }}
328      command: ansible-galaxy collection install namespace5.name -s '{{ test_server }}' {{ galaxy_verbosity }}
329      register: install_empty_server_list
330      environment:
331        ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
332        ANSIBLE_GALAXY_SERVER_LIST: ''
333
334    - name: get result of a collection with an empty server list - {{ test_name }}
335      slurp:
336        path: '{{ galaxy_dir }}/ansible_collections/namespace5/name/MANIFEST.json'
337      register: install_empty_server_list_actual
338
339    - name: assert install a collection with an empty server list - {{ test_name }}
340      assert:
341        that:
342        - '"Installing ''namespace5.name:1.0.0'' to" in install_empty_server_list.stdout'
343        - (install_empty_server_list_actual.content | b64decode | from_json).collection_info.version == '1.0.0'
344
345- name: create test requirements file with both roles and collections - {{ test_name }}
346  copy:
347    content: |
348      collections:
349      - namespace6.name
350      - name: namespace7.name
351      roles:
352      - skip.me
353    dest: '{{ galaxy_dir }}/ansible_collections/requirements-with-role.yml'
354
355# Need to run with -vvv to validate the roles will be skipped msg
356- name: install collections only with requirements-with-role.yml - {{ test_name }}
357  command: ansible-galaxy collection install -r '{{ galaxy_dir }}/ansible_collections/requirements-with-role.yml' -s '{{ test_name }}' -vvv
358  register: install_req_collection
359  environment:
360    ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
361
362- name: get result of install collections only with requirements-with-roles.yml - {{ test_name }}
363  slurp:
364    path: '{{ galaxy_dir }}/ansible_collections/{{ collection }}/name/MANIFEST.json'
365  register: install_req_collection_actual
366  loop_control:
367    loop_var: collection
368  loop:
369  - namespace6
370  - namespace7
371
372- name: assert install collections only with requirements-with-role.yml - {{ test_name }}
373  assert:
374    that:
375    - '"contains roles which will be ignored" in install_req_collection.stdout'
376    - '"Installing ''namespace6.name:1.0.0'' to" in install_req_collection.stdout'
377    - '"Installing ''namespace7.name:1.0.0'' to" in install_req_collection.stdout'
378    - (install_req_collection_actual.results[0].content | b64decode | from_json).collection_info.version == '1.0.0'
379    - (install_req_collection_actual.results[1].content | b64decode | from_json).collection_info.version == '1.0.0'
380
381- name: create test requirements file with just collections - {{ test_name }}
382  copy:
383    content: |
384      collections:
385      - namespace8.name
386      - name: namespace9.name
387    dest: '{{ galaxy_dir }}/ansible_collections/requirements.yaml'
388
389- name: install collections with ansible-galaxy install - {{ test_name }}
390  command: ansible-galaxy install -r '{{ galaxy_dir }}/ansible_collections/requirements.yaml' -s '{{ test_name }}'
391  register: install_req
392  environment:
393    ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
394
395- name: get result of install collections with ansible-galaxy install - {{ test_name }}
396  slurp:
397    path: '{{ galaxy_dir }}/ansible_collections/{{ collection }}/name/MANIFEST.json'
398  register: install_req_actual
399  loop_control:
400    loop_var: collection
401  loop:
402  - namespace8
403  - namespace9
404
405- name: assert install collections with ansible-galaxy install - {{ test_name }}
406  assert:
407    that:
408    - '"Installing ''namespace8.name:1.0.0'' to" in install_req.stdout'
409    - '"Installing ''namespace9.name:1.0.0'' to" in install_req.stdout'
410    - (install_req_actual.results[0].content | b64decode | from_json).collection_info.version == '1.0.0'
411    - (install_req_actual.results[1].content | b64decode | from_json).collection_info.version == '1.0.0'
412
413# Uncomment once pulp container is at pulp>=0.5.0
414#- name: install cache.cache at the current latest version
415#  command: ansible-galaxy collection install cache.cache -s '{{ test_name }}' -vvv
416#  environment:
417#    ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
418#
419#- set_fact:
420#    cache_version_build: '{{ (cache_version_build | int) + 1 }}'
421#
422#- name: publish update for cache.cache test
423#  setup_collections:
424#    server: galaxy_ng
425#    collections:
426#    - namespace: cache
427#      name: cache
428#      version: 1.0.{{ cache_version_build }}
429#
430#- name: make sure the cache version list is ignored on a collection version change - {{ test_name }}
431#  command: ansible-galaxy collection install cache.cache -s '{{ test_name }}' --force -vvv
432#  register: install_cached_update
433#  environment:
434#    ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
435#
436#- name: get result of cache version list is ignored on a collection version change - {{ test_name }}
437#  slurp:
438#    path: '{{ galaxy_dir }}/ansible_collections/cache/cache/MANIFEST.json'
439#  register: install_cached_update_actual
440#
441#- name: assert cache version list is ignored on a collection version change - {{ test_name }}
442#  assert:
443#    that:
444#    - '"Installing ''cache.cache:1.0.{{ cache_version_build }}'' to" in install_cached_update.stdout'
445#    - (install_cached_update_actual.content | b64decode | from_json).collection_info.version == '1.0.' ~ cache_version_build
446
447- name: install collection with symlink - {{ test_name }}
448  command: ansible-galaxy collection install symlink.symlink -s '{{ test_name }}' {{ galaxy_verbosity }}
449  environment:
450    ANSIBLE_COLLECTIONS_PATHS: '{{ galaxy_dir }}/ansible_collections'
451  register: install_symlink
452
453- find:
454    paths: '{{ galaxy_dir }}/ansible_collections/symlink/symlink'
455    recurse: yes
456    file_type: any
457
458- name: get result of install collection with symlink - {{ test_name }}
459  stat:
460    path: '{{ galaxy_dir }}/ansible_collections/symlink/symlink/{{ path }}'
461  register: install_symlink_actual
462  loop_control:
463    loop_var: path
464  loop:
465  - REÅDMÈ.md-link
466  - docs/REÅDMÈ.md
467  - plugins/REÅDMÈ.md
468  - REÅDMÈ.md-outside-link
469  - docs-link
470  - docs-link/REÅDMÈ.md
471
472- name: assert install collection with symlink - {{ test_name }}
473  assert:
474    that:
475    - '"Installing ''symlink.symlink:1.0.0'' to" in install_symlink.stdout'
476    - install_symlink_actual.results[0].stat.islnk
477    - install_symlink_actual.results[0].stat.lnk_target == 'REÅDMÈ.md'
478    - install_symlink_actual.results[1].stat.islnk
479    - install_symlink_actual.results[1].stat.lnk_target == '../REÅDMÈ.md'
480    - install_symlink_actual.results[2].stat.islnk
481    - install_symlink_actual.results[2].stat.lnk_target == '../REÅDMÈ.md'
482    - install_symlink_actual.results[3].stat.isreg
483    - install_symlink_actual.results[4].stat.islnk
484    - install_symlink_actual.results[4].stat.lnk_target == 'docs'
485    - install_symlink_actual.results[5].stat.islnk
486    - install_symlink_actual.results[5].stat.lnk_target == '../REÅDMÈ.md'
487
488- name: remove install directory for the next test because parent_dep.parent_collection was installed - {{ test_name }}
489  file:
490    path: '{{ galaxy_dir }}/ansible_collections'
491    state: absent
492
493- name: install collection and dep compatible with multiple requirements - {{ test_name }}
494  command: ansible-galaxy collection install parent_dep.parent_collection parent_dep2.parent_collection
495  environment:
496    ANSIBLE_COLLECTIONS_PATHS: '{{ galaxy_dir }}/ansible_collections'
497  register: install_req
498
499- name: assert install collections with ansible-galaxy install - {{ test_name }}
500  assert:
501    that:
502    - '"Installing ''parent_dep.parent_collection:1.0.0'' to" in install_req.stdout'
503    - '"Installing ''parent_dep2.parent_collection:1.0.0'' to" in install_req.stdout'
504    - '"Installing ''child_dep.child_collection:0.5.0'' to" in install_req.stdout'
505
506- name: install a collection to a directory that contains another collection with no metadata
507  block:
508
509    # Collections are usable in ansible without a galaxy.yml or MANIFEST.json
510    - name: create a collection directory
511      file:
512        state: directory
513        path: '{{ galaxy_dir }}/ansible_collections/unrelated_namespace/collection_without_metadata/plugins'
514
515    - name: install a collection to the same installation directory - {{ test_name }}
516      command: ansible-galaxy collection install namespace1.name1
517      environment:
518        ANSIBLE_COLLECTIONS_PATHS: '{{ galaxy_dir }}/ansible_collections'
519      register: install_req
520
521    - name: assert installed collections with ansible-galaxy install - {{ test_name }}
522      assert:
523        that:
524          - '"Installing ''namespace1.name1:1.0.9'' to" in install_req.stdout'
525
526- name: remove test collection install directory - {{ test_name }}
527  file:
528    path: '{{ galaxy_dir }}/ansible_collections'
529    state: absent
530
531
532- name: download collections with pre-release dep - {{ test_name }}
533  command: ansible-galaxy collection download dep_with_beta.parent namespace1.name1:1.1.0-beta.1 -p '{{ galaxy_dir }}/scratch'
534
535- name: install collection with concrete pre-release dep - {{ test_name }}
536  command: ansible-galaxy collection install -r '{{ galaxy_dir }}/scratch/requirements.yml'
537  args:
538    chdir: '{{ galaxy_dir }}/scratch'
539  environment:
540    ANSIBLE_COLLECTIONS_PATHS: '{{ galaxy_dir }}/ansible_collections'
541  register: install_concrete_pre
542
543- name: get result of install collections with concrete pre-release dep - {{ test_name }}
544  slurp:
545    path: '{{ galaxy_dir }}/ansible_collections/{{ collection }}/MANIFEST.json'
546  register: install_concrete_pre_actual
547  loop_control:
548    loop_var: collection
549  loop:
550  - namespace1/name1
551  - dep_with_beta/parent
552
553- name: assert install collections with ansible-galaxy install - {{ test_name }}
554  assert:
555    that:
556    - '"Installing ''namespace1.name1:1.1.0-beta.1'' to" in install_concrete_pre.stdout'
557    - '"Installing ''dep_with_beta.parent:1.0.0'' to" in install_concrete_pre.stdout'
558    - (install_concrete_pre_actual.results[0].content | b64decode | from_json).collection_info.version == '1.1.0-beta.1'
559    - (install_concrete_pre_actual.results[1].content | b64decode | from_json).collection_info.version == '1.0.0'
560
561- name: remove collection dir after round of testing - {{ test_name }}
562  file:
563    path: '{{ galaxy_dir }}/ansible_collections'
564    state: absent
565