summaryrefslogtreecommitdiff
path: root/test/integration/targets/ansible-galaxy-collection/tasks/publish.yml
blob: 1be16ae90156c1bdb86c51b883590227075bdb63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
---
- name: publish collection - {{ test_name }}
  command: ansible-galaxy collection publish ansible_test-my_collection-1.0.0.tar.gz -s {{ test_name }} {{ galaxy_verbosity }}
  args:
    chdir: '{{ galaxy_dir }}'
  register: publish_collection

- name: ensure we can download the published collection - {{ test_name }}
  command: ansible-galaxy collection install -s {{ test_name }} -p "{{ remote_tmp_dir }}/publish/{{ test_name }}" ansible_test.my_collection==1.0.0 {{ galaxy_verbosity }}

- name: get result of publish collection - {{ test_name }}
  uri:
    url: '{{ test_api_server }}v3/plugin/ansible/content/primary/collections/index/ansible_test/my_collection/versions/1.0.0/'
    return_content: yes
    user: '{{ pulp_user }}'
    password: '{{ pulp_password }}'
    force_basic_auth: true
  register: publish_collection_actual

- name: assert publish collection - {{ test_name }}
  assert:
    that:
    - '"Collection has been successfully published and imported to the Galaxy server" in publish_collection.stdout'
    - publish_collection_actual.json.collection.name == 'my_collection'
    - publish_collection_actual.json.namespace.name == 'ansible_test'
    - publish_collection_actual.json.version == '1.0.0'

- name: fail to publish existing collection version - {{ test_name }}
  command: ansible-galaxy collection publish ansible_test-my_collection-1.0.0.tar.gz -s {{ test_name }} {{ galaxy_verbosity }}
  args:
    chdir: '{{ galaxy_dir }}'
  register: fail_publish_existing
  failed_when: fail_publish_existing is not failed

- name: reset published collections - {{ test_name }}
  include_tasks: pulp.yml