2020-02-28 23:59:09 +01:00
|
|
|
---
|
|
|
|
- name: set some facts for tests
|
|
|
|
set_fact:
|
|
|
|
galaxy_dir: "{{ remote_tmp_dir }}/galaxy"
|
|
|
|
|
|
|
|
- name: create scratch dir used for testing
|
|
|
|
file:
|
|
|
|
path: '{{ galaxy_dir }}/scratch'
|
|
|
|
state: directory
|
|
|
|
|
|
|
|
- name: run ansible-galaxy collection init tests
|
|
|
|
import_tasks: init.yml
|
|
|
|
|
|
|
|
- name: run ansible-galaxy collection build tests
|
|
|
|
import_tasks: build.yml
|
|
|
|
|
2020-10-28 00:17:40 +01:00
|
|
|
# The pulp container has a long start up time
|
|
|
|
# The first task to interact with pulp needs to wait until it responds appropriately
|
|
|
|
- name: list pulp distributions
|
|
|
|
uri:
|
|
|
|
url: '{{ pulp_api }}/pulp/api/v3/distributions/ansible/ansible/'
|
|
|
|
status_code:
|
|
|
|
- 200
|
|
|
|
user: '{{ pulp_user }}'
|
|
|
|
password: '{{ pulp_password }}'
|
|
|
|
force_basic_auth: true
|
|
|
|
register: pulp_distributions
|
|
|
|
until: pulp_distributions is successful
|
|
|
|
delay: 1
|
|
|
|
retries: 60
|
|
|
|
|
2020-07-01 22:20:03 +02:00
|
|
|
- name: configure pulp
|
|
|
|
include_tasks: pulp.yml
|
|
|
|
|
2020-10-28 00:17:40 +01:00
|
|
|
- name: Get galaxy_ng token
|
|
|
|
uri:
|
|
|
|
url: '{{ galaxy_ng_server }}v3/auth/token/'
|
|
|
|
method: POST
|
|
|
|
body_format: json
|
|
|
|
body: {}
|
|
|
|
status_code:
|
|
|
|
- 200
|
|
|
|
user: '{{ pulp_user }}'
|
|
|
|
password: '{{ pulp_password }}'
|
|
|
|
force_basic_auth: true
|
|
|
|
register: galaxy_ng_token
|
2020-07-01 22:20:03 +02:00
|
|
|
|
2020-02-28 23:59:09 +01:00
|
|
|
- name: create test ansible.cfg that contains the Galaxy server list
|
|
|
|
template:
|
|
|
|
src: ansible.cfg.j2
|
|
|
|
dest: '{{ galaxy_dir }}/ansible.cfg'
|
|
|
|
|
|
|
|
- name: run ansible-galaxy collection publish tests for {{ test_name }}
|
|
|
|
include_tasks: publish.yml
|
2020-06-17 23:06:07 +02:00
|
|
|
args:
|
|
|
|
apply:
|
|
|
|
environment:
|
|
|
|
ANSIBLE_CONFIG: '{{ galaxy_dir }}/ansible.cfg'
|
2020-02-28 23:59:09 +01:00
|
|
|
vars:
|
|
|
|
test_name: '{{ item.name }}'
|
|
|
|
test_server: '{{ item.server }}'
|
2020-07-01 22:20:03 +02:00
|
|
|
vX: '{{ "v3/" if item.v3|default(false) else "v2/" }}'
|
|
|
|
loop:
|
2020-06-17 23:06:07 +02:00
|
|
|
- name: pulp_v2
|
|
|
|
server: '{{ pulp_v2_server }}'
|
|
|
|
- name: pulp_v3
|
|
|
|
server: '{{ pulp_v3_server }}'
|
2020-07-01 22:20:03 +02:00
|
|
|
v3: true
|
|
|
|
- name: galaxy_ng
|
|
|
|
server: '{{ galaxy_ng_server }}'
|
|
|
|
v3: true
|
2020-02-28 23:59:09 +01:00
|
|
|
|
|
|
|
# We use a module for this so we can speed up the test time.
|
2020-03-24 23:32:43 +01:00
|
|
|
- name: setup test collections for install and download test
|
2020-06-17 23:06:07 +02:00
|
|
|
loop:
|
2020-07-01 22:20:03 +02:00
|
|
|
# For pulp interactions, we only upload to galaxy_ng which shares
|
|
|
|
# the same repo and distribution with pulp_ansible
|
|
|
|
# However, we use galaxy_ng only, since collections are unique across
|
|
|
|
# pulp repositories, and galaxy_ng maintains a 2nd list of published collections
|
|
|
|
- galaxy_ng
|
2020-06-17 23:06:07 +02:00
|
|
|
environment:
|
|
|
|
ANSIBLE_CONFIG: '{{ galaxy_dir }}/ansible.cfg'
|
|
|
|
async: 300
|
|
|
|
poll: 0
|
|
|
|
register: setup_collections
|
2020-02-28 23:59:09 +01:00
|
|
|
setup_collections:
|
2020-06-17 23:06:07 +02:00
|
|
|
server: '{{ item }}'
|
2020-07-01 22:20:03 +02:00
|
|
|
collections: '{{ collection_list }}'
|
2020-06-10 22:46:42 +02:00
|
|
|
|
2020-06-17 23:06:07 +02:00
|
|
|
- name: Wait for setup_collections
|
|
|
|
async_status:
|
|
|
|
jid: '{{ item.ansible_job_id }}'
|
|
|
|
mode: status
|
|
|
|
retries: 300
|
|
|
|
delay: 1
|
|
|
|
loop: '{{ setup_collections.results }}'
|
|
|
|
register: setup_collections_wait
|
|
|
|
until: setup_collections_wait is finished
|
|
|
|
|
|
|
|
# The above setup_collections uses --no-wait
|
|
|
|
# pause for good measure.
|
|
|
|
- name: precautionary wait
|
|
|
|
pause:
|
|
|
|
seconds: 5
|
|
|
|
|
2020-02-28 23:59:09 +01:00
|
|
|
- name: run ansible-galaxy collection install tests for {{ test_name }}
|
|
|
|
include_tasks: install.yml
|
|
|
|
vars:
|
|
|
|
test_name: '{{ item.name }}'
|
|
|
|
test_server: '{{ item.server }}'
|
2020-06-17 23:06:07 +02:00
|
|
|
vX: '{{ "v3/" if item.v3|default(false) else "v2/" }}'
|
2020-07-01 22:20:03 +02:00
|
|
|
requires_auth: '{{ item.requires_auth|default(false) }}'
|
|
|
|
args:
|
|
|
|
apply:
|
|
|
|
environment:
|
|
|
|
ANSIBLE_CONFIG: '{{ galaxy_dir }}/ansible.cfg'
|
|
|
|
loop:
|
|
|
|
- name: galaxy_ng
|
|
|
|
server: '{{ galaxy_ng_server }}'
|
2020-06-17 23:06:07 +02:00
|
|
|
v3: true
|
2020-07-01 22:20:03 +02:00
|
|
|
requires_auth: true
|
2020-06-17 23:06:07 +02:00
|
|
|
- name: pulp_v2
|
|
|
|
server: '{{ pulp_v2_server }}'
|
|
|
|
- name: pulp_v3
|
|
|
|
server: '{{ pulp_v3_server }}'
|
|
|
|
v3: true
|
2020-03-24 23:32:43 +01:00
|
|
|
|
2020-07-29 23:28:43 +02:00
|
|
|
# fake.fake does not exist but we check the output to ensure it checked all 3
|
|
|
|
# servers defined in the config. We hardcode to -vvv as that's what level the
|
|
|
|
# message is shown
|
|
|
|
- name: test install fallback on server list
|
|
|
|
command: ansible-galaxy collection install fake.fake -vvv
|
|
|
|
ignore_errors: yes
|
|
|
|
environment:
|
|
|
|
ANSIBLE_CONFIG: '{{ galaxy_dir }}/ansible.cfg'
|
|
|
|
register: missing_fallback
|
|
|
|
|
|
|
|
- name: assert test install fallback on server list
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- missing_fallback.rc == 1
|
|
|
|
- '"Collection ''fake.fake'' is not available from server pulp_v2" in missing_fallback.stdout'
|
|
|
|
- '"Collection ''fake.fake'' is not available from server pulp_v3" in missing_fallback.stdout'
|
|
|
|
- '"Collection ''fake.fake'' is not available from server galaxy_ng" in missing_fallback.stdout'
|
|
|
|
|
2020-03-24 23:32:43 +01:00
|
|
|
- name: run ansible-galaxy collection download tests
|
|
|
|
include_tasks: download.yml
|
2020-06-17 23:06:07 +02:00
|
|
|
args:
|
|
|
|
apply:
|
|
|
|
environment:
|
|
|
|
ANSIBLE_CONFIG: '{{ galaxy_dir }}/ansible.cfg'
|