Debian Codegraph @

test/integration/targets/ansible-galaxy-collection-scm/tasks/test_manifest_metadata.yml

raw
1 - name: Test installing a collection from a git repo containing a MANIFEST.json
2 block:
3 - name: Create a temp directory for building the collection
4 file:
5 path: '{{ galaxy_dir }}/scratch'
6 state: directory
7
8 - name: Initialize a collection
9 command: 'ansible-galaxy collection init namespace_3.collection_1'
10 args:
11 chdir: '{{ galaxy_dir }}/scratch'
12
13 - name: Build the collection
14 command: 'ansible-galaxy collection build namespace_3/collection_1'
15 args:
16 chdir: '{{ galaxy_dir }}/scratch'
17
18 - name: Initialize git repository
19 command: 'git init {{ scm_path }}/namespace_3'
20
21 - name: Create the destination for the collection
22 file:
23 path: '{{ scm_path }}/namespace_3/collection_1'
24 state: directory
25
26 - name: Unarchive the collection in the git repo
27 unarchive:
28 dest: '{{ scm_path }}/namespace_3/collection_1'
29 src: '{{ galaxy_dir }}/scratch/namespace_3-collection_1-1.0.0.tar.gz'
30 remote_src: yes
31
32 - name: Commit the changes
33 shell: git add ./; git commit -m 'add collection'
34 args:
35 chdir: '{{ scm_path }}/namespace_3'
36
37 - name: Install the collection in the git repository
38 command: 'ansible-galaxy collection install git+file://{{ scm_path }}/namespace_3/.git'
39 register: result
40
41 - name: Assert the collection was installed successfully
42 assert:
43 that:
44 - '"namespace_3.collection_1:1.0.0 was installed successfully" in result.stdout_lines'
45
46 always:
47 - name: Clean up directories from test
48 file:
49 path: '{{ galaxy_dir }}/scratch'
50 state: absent
51 loop:
52 - '{{ galaxy_dir }}/scratch'
53 - '{{ scm_path }}/namespace_3'
54
55 - include_tasks: ./empty_installed_collections.yml