| 1 |
--- |
| 2 |
- name: set some facts for tests |
| 3 |
set_fact: |
| 4 |
galaxy_dir: "{{ remote_tmp_dir }}/galaxy" |
| 5 |
|
| 6 |
- name: create scratch dir used for testing |
| 7 |
file: |
| 8 |
path: '{{ galaxy_dir }}/scratch' |
| 9 |
state: directory |
| 10 |
|
| 11 |
- name: run ansible-galaxy collection init tests |
| 12 |
import_tasks: init.yml |
| 13 |
|
| 14 |
- name: run ansible-galaxy collection build tests |
| 15 |
import_tasks: build.yml |
| 16 |
|
| 17 |
- name: get pulp repository list |
| 18 |
uri: |
| 19 |
url: '{{ galaxy_ng_server }}/pulp/api/v3/repositories/ansible/ansible/' |
| 20 |
user: '{{ galaxy_user }}' |
| 21 |
password: '{{ galaxy_password }}' |
| 22 |
force_basic_auth: true |
| 23 |
register: pulp_repo_list |
| 24 |
|
| 25 |
- set_fact: |
| 26 |
pulp_published_repo: '{{ pulp_repo_list.json.results|selectattr("name", "eq", "published")|first }}' |
| 27 |
pulp_rejected_repo: '{{ pulp_repo_list.json.results|selectattr("name", "eq", "rejected")|first }}' |
| 28 |
|
| 29 |
- name: Get galaxy_ng token |
| 30 |
uri: |
| 31 |
url: '{{ galaxy_ng_server }}/v3/auth/token/' |
| 32 |
method: POST |
| 33 |
body_format: json |
| 34 |
body: {} |
| 35 |
status_code: |
| 36 |
- 200 |
| 37 |
user: '{{ galaxy_user }}' |
| 38 |
password: '{{ galaxy_password }}' |
| 39 |
force_basic_auth: true |
| 40 |
register: galaxy_ng_token |
| 41 |
|
| 42 |
- name: create test ansible.cfg that contains the Galaxy server list |
| 43 |
template: |
| 44 |
src: ansible.cfg.j2 |
| 45 |
dest: '{{ galaxy_dir }}/ansible.cfg' |
| 46 |
|
| 47 |
- name: test install command using an unsupported version of resolvelib |
| 48 |
include_tasks: unsupported_resolvelib.yml |
| 49 |
loop: "{{ unsupported_resolvelib_versions }}" |
| 50 |
loop_control: |
| 51 |
loop_var: resolvelib_version |
| 52 |
|
| 53 |
- name: run ansible-galaxy collection offline installation tests |
| 54 |
include_tasks: install_offline.yml |
| 55 |
args: |
| 56 |
apply: |
| 57 |
environment: |
| 58 |
ANSIBLE_CONFIG: '{{ galaxy_dir }}/ansible.cfg' |
| 59 |
|
| 60 |
- name: run ansible-galaxy collection publish tests for {{ test_name }} |
| 61 |
include_tasks: publish.yml |
| 62 |
args: |
| 63 |
apply: |
| 64 |
environment: |
| 65 |
ANSIBLE_CONFIG: '{{ galaxy_dir }}/ansible.cfg' |
| 66 |
vars: |
| 67 |
test_name: '{{ item.name }}' |
| 68 |
test_server: '{{ item.server }}' |
| 69 |
test_api_server: '{{ item.api_server|default(item.server) }}' |
| 70 |
loop: |
| 71 |
- name: galaxy_ng |
| 72 |
server: '{{ galaxy_ng_server }}' |
| 73 |
|
| 74 |
- include_tasks: setup_gpg.yml |
| 75 |
|
| 76 |
# Stores the cached test version number index as we run install many times |
| 77 |
- set_fact: |
| 78 |
cache_version_build: 0 |
| 79 |
|
| 80 |
- name: run ansible-galaxy collection install tests for {{ test_name }} |
| 81 |
include_tasks: install.yml |
| 82 |
vars: |
| 83 |
test_id: '{{ item.name }}' |
| 84 |
test_name: '{{ item.name }}' |
| 85 |
test_server: '{{ item.server }}' |
| 86 |
test_api_server: '{{ item.api_server|default(item.server) }}' |
| 87 |
requires_auth: '{{ item.requires_auth|default(false) }}' |
| 88 |
args: |
| 89 |
apply: |
| 90 |
environment: |
| 91 |
ANSIBLE_CONFIG: '{{ galaxy_dir }}/ansible.cfg' |
| 92 |
loop: |
| 93 |
- name: galaxy_ng |
| 94 |
server: '{{ galaxy_ng_server }}' |
| 95 |
requires_auth: true |
| 96 |
|
| 97 |
- name: test installing and downloading collections with the range of supported resolvelib versions |
| 98 |
include_tasks: supported_resolvelib.yml |
| 99 |
args: |
| 100 |
apply: |
| 101 |
environment: |
| 102 |
ANSIBLE_CONFIG: '{{ galaxy_dir }}/ansible.cfg' |
| 103 |
loop: '{{ supported_resolvelib_versions }}' |
| 104 |
loop_control: |
| 105 |
loop_var: resolvelib_version |
| 106 |
|
| 107 |
- name: test choosing pinned pre-releases anywhere in the dependency tree |
| 108 |
# This is a regression test for the case when the end-user does not |
| 109 |
# explicitly allow installing pre-release collection versions, but their |
| 110 |
# precise pins are still selected if met among the dependencies, either |
| 111 |
# direct or transitive. |
| 112 |
include_tasks: pinned_pre_releases_in_deptree.yml |
| 113 |
|
| 114 |
- name: test installing prereleases via scm direct requests |
| 115 |
# In this test suite because the bug relies on the dep having versions on a Galaxy server |
| 116 |
include_tasks: virtual_direct_requests.yml |
| 117 |
|
| 118 |
- name: install collection with dep on another server |
| 119 |
command: ansible-galaxy collection install secondary.name -vvv # 3 -v's will show the source in the stdout |
| 120 |
register: install_cross_dep |
| 121 |
environment: |
| 122 |
ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections' |
| 123 |
ANSIBLE_CONFIG: '{{ galaxy_dir }}/ansible.cfg' |
| 124 |
|
| 125 |
- name: get result of install collection with dep on another server |
| 126 |
slurp: |
| 127 |
path: '{{ galaxy_dir }}/ansible_collections/{{ item.namespace }}/{{ item.name }}/MANIFEST.json' |
| 128 |
register: install_cross_dep_actual |
| 129 |
loop: |
| 130 |
- namespace: secondary |
| 131 |
name: name |
| 132 |
- namespace: parent_dep |
| 133 |
name: parent_collection |
| 134 |
- namespace: child_dep |
| 135 |
name: child_collection |
| 136 |
- namespace: child_dep |
| 137 |
name: child_dep2 |
| 138 |
|
| 139 |
- name: assert result of install collection with dep on another server |
| 140 |
assert: |
| 141 |
that: |
| 142 |
- >- |
| 143 |
"'secondary.name:1.0.0' obtained from server secondary" |
| 144 |
in install_cross_dep.stdout |
| 145 |
# galaxy_ng is highest in the list so it will find it there first |
| 146 |
- >- |
| 147 |
"'parent_dep.parent_collection:1.0.0' obtained from server galaxy_ng" |
| 148 |
in install_cross_dep.stdout |
| 149 |
- >- |
| 150 |
"'child_dep.child_collection:0.9.9' obtained from server galaxy_ng" |
| 151 |
in install_cross_dep.stdout |
| 152 |
- >- |
| 153 |
"'child_dep.child_dep2:1.2.2' obtained from server galaxy_ng" |
| 154 |
in install_cross_dep.stdout |
| 155 |
- (install_cross_dep_actual.results[0].content | b64decode | from_json).collection_info.version == '1.0.0' |
| 156 |
- (install_cross_dep_actual.results[1].content | b64decode | from_json).collection_info.version == '1.0.0' |
| 157 |
- (install_cross_dep_actual.results[2].content | b64decode | from_json).collection_info.version == '0.9.9' |
| 158 |
- (install_cross_dep_actual.results[3].content | b64decode | from_json).collection_info.version == '1.2.2' |
| 159 |
|
| 160 |
- name: run ansible-galaxy collection download tests |
| 161 |
include_tasks: download.yml |
| 162 |
args: |
| 163 |
apply: |
| 164 |
environment: |
| 165 |
ANSIBLE_CONFIG: '{{ galaxy_dir }}/ansible.cfg' |
| 166 |
|
| 167 |
- name: run ansible-galaxy collection verify tests for {{ test_name }} |
| 168 |
include_tasks: verify.yml |
| 169 |
args: |
| 170 |
apply: |
| 171 |
environment: |
| 172 |
ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}' |
| 173 |
ANSIBLE_CONFIG: '{{ galaxy_dir }}/ansible.cfg' |
| 174 |
vars: |
| 175 |
test_api_fallback: 'secondary' |
| 176 |
test_api_fallback_versions: 'v3' |
| 177 |
test_name: 'galaxy_ng' |
| 178 |
|
| 179 |
- name: run ansible-galaxy collection list tests |
| 180 |
include_tasks: list.yml |
| 181 |
|
| 182 |
- environment: |
| 183 |
ANSIBLE_CONFIG: '{{ galaxy_dir }}/ansible.cfg' |
| 184 |
ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}' |
| 185 |
block: |
| 186 |
- include_tasks: upgrade.yml |
| 187 |
|
| 188 |
- include_tasks: check_requires_ansible.yml |
| 189 |
loop: |
| 190 |
- install |
| 191 |
- download |
| 192 |
loop_control: |
| 193 |
loop_var: subcommand |