summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/ansible-galaxy-collection/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/targets/ansible-galaxy-collection/tasks')
-rw-r--r--test/integration/targets/ansible-galaxy-collection/tasks/download.yml4
-rw-r--r--test/integration/targets/ansible-galaxy-collection/tasks/galaxy_ng.yml30
-rw-r--r--test/integration/targets/ansible-galaxy-collection/tasks/install.yml64
-rw-r--r--test/integration/targets/ansible-galaxy-collection/tasks/main.yml151
-rw-r--r--test/integration/targets/ansible-galaxy-collection/tasks/publish.yml9
-rw-r--r--test/integration/targets/ansible-galaxy-collection/tasks/pulp.yml25
6 files changed, 120 insertions, 163 deletions
diff --git a/test/integration/targets/ansible-galaxy-collection/tasks/download.yml b/test/integration/targets/ansible-galaxy-collection/tasks/download.yml
index 1b6d975994..008bb7d597 100644
--- a/test/integration/targets/ansible-galaxy-collection/tasks/download.yml
+++ b/test/integration/targets/ansible-galaxy-collection/tasks/download.yml
@@ -5,7 +5,7 @@
state: directory
- name: download collection with multiple dependencies
- command: ansible-galaxy collection download parent_dep.parent_collection -s {{ fallaxy_galaxy_server }} {{ galaxy_verbosity }}
+ command: ansible-galaxy collection download parent_dep.parent_collection -s pulp_v2 {{ galaxy_verbosity }}
register: download_collection
args:
chdir: '{{ galaxy_dir }}/download'
@@ -69,7 +69,7 @@
dest: '{{ galaxy_dir }}/download/download.yml'
- name: download collection with req to custom dir
- command: ansible-galaxy collection download -r '{{ galaxy_dir }}/download/download.yml' -s {{ fallaxy_ah_server }} -p '{{ galaxy_dir }}/download/collections-custom' {{ galaxy_verbosity }}
+ command: ansible-galaxy collection download -r '{{ galaxy_dir }}/download/download.yml' -s galaxy_ng -p '{{ galaxy_dir }}/download/collections-custom' {{ galaxy_verbosity }}
register: download_req_custom_path
- name: get result of download collection with req to custom dir
diff --git a/test/integration/targets/ansible-galaxy-collection/tasks/galaxy_ng.yml b/test/integration/targets/ansible-galaxy-collection/tasks/galaxy_ng.yml
new file mode 100644
index 0000000000..463ec6ce98
--- /dev/null
+++ b/test/integration/targets/ansible-galaxy-collection/tasks/galaxy_ng.yml
@@ -0,0 +1,30 @@
+- name: Create galaxy_ng namespaces
+ uri:
+ url: '{{ pulp_api }}/api/galaxy/v3/_ui/namespaces/'
+ method: POST
+ body_format: json
+ body:
+ name: '{{ namespace }}'
+ groups:
+ - system:partner-engineers
+ status_code:
+ - 201
+ user: '{{ pulp_user }}'
+ password: '{{ pulp_password }}'
+ force_basic_auth: true
+ loop: '{{ collection_list|map(attribute="namespace")|unique + publish_namespaces }}'
+ loop_control:
+ loop_var: namespace
+
+- name: Get galaxy_ng token
+ uri:
+ url: '{{ pulp_api }}/api/galaxy/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
diff --git a/test/integration/targets/ansible-galaxy-collection/tasks/install.yml b/test/integration/targets/ansible-galaxy-collection/tasks/install.yml
index 9c14e8a820..71d6c859d7 100644
--- a/test/integration/targets/ansible-galaxy-collection/tasks/install.yml
+++ b/test/integration/targets/ansible-galaxy-collection/tasks/install.yml
@@ -5,7 +5,7 @@
state: directory
- name: install simple collection with implicit path - {{ test_name }}
- command: ansible-galaxy collection install namespace1.name1 -s '{{ test_server }}' {{ galaxy_verbosity }}
+ command: ansible-galaxy collection install namespace1.name1 -s '{{ test_name }}' {{ galaxy_verbosity }}
environment:
ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
register: install_normal
@@ -32,7 +32,7 @@
- (install_normal_manifest.content | b64decode | from_json).collection_info.version == '1.0.9'
- name: install existing without --force - {{ test_name }}
- command: ansible-galaxy collection install namespace1.name1 -s '{{ test_server }}' {{ galaxy_verbosity }}
+ command: ansible-galaxy collection install namespace1.name1 -s '{{ test_name }}' {{ galaxy_verbosity }}
environment:
ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
register: install_existing_no_force
@@ -43,7 +43,7 @@
- '"Skipping ''namespace1.name1'' as it is already installed" in install_existing_no_force.stdout'
- name: install existing with --force - {{ test_name }}
- command: ansible-galaxy collection install namespace1.name1 -s '{{ test_server }}' --force {{ galaxy_verbosity }}
+ command: ansible-galaxy collection install namespace1.name1 -s '{{ test_name }}' --force {{ galaxy_verbosity }}
environment:
ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
register: install_existing_force
@@ -59,7 +59,7 @@
state: absent
- name: install pre-release as explicit version to custom dir - {{ test_name }}
- command: ansible-galaxy collection install 'namespace1.name1:1.1.0-beta.1' -s '{{ test_server }}' -p '{{ galaxy_dir }}/ansible_collections' {{ galaxy_verbosity }}
+ command: ansible-galaxy collection install 'namespace1.name1:1.1.0-beta.1' -s '{{ test_name }}' -p '{{ galaxy_dir }}/ansible_collections' {{ galaxy_verbosity }}
register: install_prerelease
- name: get result of install pre-release as explicit version to custom dir - {{ test_name }}
@@ -79,7 +79,7 @@
state: absent
- name: install pre-release version with --pre to custom dir - {{ test_name }}
- command: ansible-galaxy collection install --pre 'namespace1.name1' -s '{{ test_server }}' -p '{{ galaxy_dir }}/ansible_collections' {{ galaxy_verbosity }}
+ command: ansible-galaxy collection install --pre 'namespace1.name1' -s '{{ test_name }}' -p '{{ galaxy_dir }}/ansible_collections' {{ galaxy_verbosity }}
register: install_prerelease
- name: get result of install pre-release version with --pre to custom dir - {{ test_name }}
@@ -127,13 +127,16 @@
- (install_multiple_with_dep_actual.results[3].content | b64decode | from_json).collection_info.version == '1.2.2'
- name: expect failure with dep resolution failure
- command: ansible-galaxy collection install fail_namespace.fail_collection -s {{ test_server }} {{ galaxy_verbosity }}
+ command: ansible-galaxy collection install fail_namespace.fail_collection -s {{ test_name }} {{ galaxy_verbosity }}
register: fail_dep_mismatch
failed_when: '"Cannot meet dependency requirement ''fail_dep2.name:<0.0.5'' for collection fail_namespace.fail_collection" not in fail_dep_mismatch.stderr'
-- name: Find artifact url
+- name: Find artifact url for namespace3.name
uri:
url: '{{ test_server }}{{ vX }}collections/namespace3/name/versions/1.0.0/'
+ user: '{{ pulp_user }}'
+ password: '{{ pulp_password }}'
+ force_basic_auth: true
register: artifact_url_response
- name: download a collection for an offline install - {{ test_name }}
@@ -178,9 +181,12 @@
that:
- not fail_bad_tar_actual.stat.exists
-- name: Find artifact url
+- name: Find artifact url for namespace4.name
uri:
url: '{{ test_server }}{{ vX }}collections/namespace4/name/versions/1.0.0/'
+ user: '{{ pulp_user }}'
+ password: '{{ pulp_password }}'
+ force_basic_auth: true
register: artifact_url_response
- name: install a collection from a URI - {{ test_name }}
@@ -207,23 +213,25 @@
environment:
ANSIBLE_GALAXY_SERVER_LIST: undefined
-- name: install a collection with an empty server list - {{ test_name }}
- command: ansible-galaxy collection install namespace5.name -s '{{ test_server }}' {{ galaxy_verbosity }}
- register: install_empty_server_list
- environment:
- ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
- ANSIBLE_GALAXY_SERVER_LIST: ''
-
-- name: get result of a collection with an empty server list - {{ test_name }}
- slurp:
- path: '{{ galaxy_dir }}/ansible_collections/namespace5/name/MANIFEST.json'
- register: install_empty_server_list_actual
-
-- name: assert install a collection with an empty server list - {{ test_name }}
- assert:
- that:
- - '"Installing ''namespace5.name:1.0.0'' to" in install_empty_server_list.stdout'
- - (install_empty_server_list_actual.content | b64decode | from_json).collection_info.version == '1.0.0'
+- when: not requires_auth
+ block:
+ - name: install a collection with an empty server list - {{ test_name }}
+ command: ansible-galaxy collection install namespace5.name -s '{{ test_server }}' {{ galaxy_verbosity }}
+ register: install_empty_server_list
+ environment:
+ ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
+ ANSIBLE_GALAXY_SERVER_LIST: ''
+
+ - name: get result of a collection with an empty server list - {{ test_name }}
+ slurp:
+ path: '{{ galaxy_dir }}/ansible_collections/namespace5/name/MANIFEST.json'
+ register: install_empty_server_list_actual
+
+ - name: assert install a collection with an empty server list - {{ test_name }}
+ assert:
+ that:
+ - '"Installing ''namespace5.name:1.0.0'' to" in install_empty_server_list.stdout'
+ - (install_empty_server_list_actual.content | b64decode | from_json).collection_info.version == '1.0.0'
- name: create test requirements file with both roles and collections - {{ test_name }}
copy:
@@ -237,7 +245,7 @@
# Need to run with -vvv to validate the roles will be skipped msg
- name: install collections only with requirements-with-role.yml - {{ test_name }}
- command: ansible-galaxy collection install -r '{{ galaxy_dir }}/ansible_collections/requirements-with-role.yml' -s '{{ test_server }}' -vvv
+ command: ansible-galaxy collection install -r '{{ galaxy_dir }}/ansible_collections/requirements-with-role.yml' -s '{{ test_name }}' -vvv
register: install_req_collection
environment:
ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
@@ -270,7 +278,7 @@
dest: '{{ galaxy_dir }}/ansible_collections/requirements.yaml'
- name: install collections with ansible-galaxy install - {{ test_name }}
- command: ansible-galaxy install -r '{{ galaxy_dir }}/ansible_collections/requirements.yaml' -s '{{ test_server }}'
+ command: ansible-galaxy install -r '{{ galaxy_dir }}/ansible_collections/requirements.yaml' -s '{{ test_name }}'
register: install_req
environment:
ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
@@ -299,7 +307,7 @@
state: absent
- name: install collection with symlink - {{ test_name }}
- command: ansible-galaxy collection install symlink.symlink -s '{{ test_server }}' {{ galaxy_verbosity }}
+ command: ansible-galaxy collection install symlink.symlink -s '{{ test_name }}' {{ galaxy_verbosity }}
environment:
ANSIBLE_COLLECTIONS_PATHS: '{{ galaxy_dir }}/ansible_collections'
register: install_symlink
diff --git a/test/integration/targets/ansible-galaxy-collection/tasks/main.yml b/test/integration/targets/ansible-galaxy-collection/tasks/main.yml
index 18f1a06410..76b4783b93 100644
--- a/test/integration/targets/ansible-galaxy-collection/tasks/main.yml
+++ b/test/integration/targets/ansible-galaxy-collection/tasks/main.yml
@@ -14,14 +14,17 @@
- name: run ansible-galaxy collection build tests
import_tasks: build.yml
+- name: configure pulp
+ include_tasks: pulp.yml
+
+- name: configure galaxy_ng
+ include_tasks: galaxy_ng.yml
+
- name: create test ansible.cfg that contains the Galaxy server list
template:
src: ansible.cfg.j2
dest: '{{ galaxy_dir }}/ansible.cfg'
-- name: configure pulp
- include_tasks: pulp.yml
-
- name: run ansible-galaxy collection publish tests for {{ test_name }}
include_tasks: publish.yml
args:
@@ -32,23 +35,28 @@
test_name: '{{ item.name }}'
test_server: '{{ item.server }}'
is_pulp: '{{ item.pulp|default(false) }}'
- with_items:
- - name: galaxy
- server: '{{ fallaxy_galaxy_server }}'
- - name: automation_hub
- server: '{{ fallaxy_ah_server }}'
+ vX: '{{ "v3/" if item.v3|default(false) else "v2/" }}'
+ loop:
- name: pulp_v2
server: '{{ pulp_v2_server }}'
pulp: true
- name: pulp_v3
server: '{{ pulp_v3_server }}'
pulp: true
+ v3: true
+ - name: galaxy_ng
+ server: '{{ galaxy_ng_server }}'
+ pulp: true
+ v3: true
# We use a module for this so we can speed up the test time.
- name: setup test collections for install and download test
loop:
- - '{{ fallaxy_galaxy_server }}'
- - pulp_v2
+ # 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
environment:
ANSIBLE_CONFIG: '{{ galaxy_dir }}/ansible.cfg'
async: 300
@@ -56,114 +64,7 @@
register: setup_collections
setup_collections:
server: '{{ item }}'
- token: '{{ omit if item == "pulp_v2" else fallaxy_token }}'
- collections:
- # Scenario to test out pre-release being ignored unless explicitly set and version pagination.
- - namespace: namespace1
- name: name1
- version: 0.0.1
- - namespace: namespace1
- name: name1
- version: 0.0.2
- - namespace: namespace1
- name: name1
- version: 0.0.3
- - namespace: namespace1
- name: name1
- version: 0.0.4
- - namespace: namespace1
- name: name1
- version: 0.0.5
- - namespace: namespace1
- name: name1
- version: 0.0.6
- - namespace: namespace1
- name: name1
- version: 0.0.7
- - namespace: namespace1
- name: name1
- version: 0.0.8
- - namespace: namespace1
- name: name1
- version: 0.0.9
- - namespace: namespace1
- name: name1
- version: 0.0.10
- - namespace: namespace1
- name: name1
- version: 0.1.0
- - namespace: namespace1
- name: name1
- version: 1.0.0
- - namespace: namespace1
- name: name1
- version: 1.0.9
- - namespace: namespace1
- name: name1
- version: 1.1.0-beta.1
-
- # Pad out number of namespaces for pagination testing
- - namespace: namespace2
- name: name
- - namespace: namespace3
- name: name
- - namespace: namespace4
- name: name
- - namespace: namespace5
- name: name
- - namespace: namespace6
- name: name
- - namespace: namespace7
- name: name
- - namespace: namespace8
- name: name
- - namespace: namespace9
- name: name
-
- # Complex dependency resolution
- - namespace: parent_dep
- name: parent_collection
- dependencies:
- child_dep.child_collection: '>=0.5.0,<1.0.0'
- - namespace: child_dep
- name: child_collection
- version: 0.4.0
- - namespace: child_dep
- name: child_collection
- version: 0.5.0
- - namespace: child_dep
- name: child_collection
- version: 0.9.9
- dependencies:
- child_dep.child_dep2: '!=1.2.3'
- - namespace: child_dep
- name: child_collection
- - namespace: child_dep
- name: child_dep2
- version: 1.2.2
- - namespace: child_dep
- name: child_dep2
- version: 1.2.3
-
- # Dep resolution failure
- - namespace: fail_namespace
- name: fail_collection
- version: 2.1.2
- dependencies:
- fail_dep.name: '0.0.5'
- fail_dep2.name: '<0.0.5'
- - namespace: fail_dep
- name: name
- version: '0.0.5'
- dependencies:
- fail_dep2.name: '>0.0.5'
- - namespace: fail_dep2
- name: name
-
- # Symlink tests
- - namespace: symlink
- name: symlink
- use_symlink: yes
+ collections: '{{ collection_list }}'
- name: Wait for setup_collections
async_status:
@@ -187,12 +88,16 @@
test_name: '{{ item.name }}'
test_server: '{{ item.server }}'
vX: '{{ "v3/" if item.v3|default(false) else "v2/" }}'
- with_items:
- - name: galaxy
- server: '{{ fallaxy_galaxy_server }}'
- - name: automation_hub
- server: '{{ fallaxy_ah_server }}'
+ requires_auth: '{{ item.requires_auth|default(false) }}'
+ args:
+ apply:
+ environment:
+ ANSIBLE_CONFIG: '{{ galaxy_dir }}/ansible.cfg'
+ loop:
+ - name: galaxy_ng
+ server: '{{ galaxy_ng_server }}'
v3: true
+ requires_auth: true
- name: pulp_v2
server: '{{ pulp_v2_server }}'
- name: pulp_v3
diff --git a/test/integration/targets/ansible-galaxy-collection/tasks/publish.yml b/test/integration/targets/ansible-galaxy-collection/tasks/publish.yml
index 542b06ce9b..2406bbce36 100644
--- a/test/integration/targets/ansible-galaxy-collection/tasks/publish.yml
+++ b/test/integration/targets/ansible-galaxy-collection/tasks/publish.yml
@@ -16,7 +16,7 @@
when: not is_pulp
- name: publish collection - {{ test_name }}
- command: ansible-galaxy collection publish ansible_test-my_collection-1.0.0.tar.gz -s {{ test_server }} --token {{ fallaxy_token }} {{ galaxy_verbosity }}
+ command: ansible-galaxy collection publish ansible_test-my_collection-1.0.0.tar.gz -s {{ test_name }} {{ galaxy_verbosity }}
args:
chdir: '{{ galaxy_dir }}'
register: fallaxy_publish_collection
@@ -34,8 +34,11 @@
- name: get result of publish collection - {{ test_name }}
uri:
- url: '{{ test_server }}v2/collections/ansible_test/my_collection/versions/1.0.0/'
+ url: '{{ test_server }}{{ vX }}collections/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 }}
@@ -47,7 +50,7 @@
- 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_server }} --token {{ fallaxy_token }} {{ galaxy_verbosity }}
+ 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
diff --git a/test/integration/targets/ansible-galaxy-collection/tasks/pulp.yml b/test/integration/targets/ansible-galaxy-collection/tasks/pulp.yml
index 8f64746acc..f8638c0814 100644
--- a/test/integration/targets/ansible-galaxy-collection/tasks/pulp.yml
+++ b/test/integration/targets/ansible-galaxy-collection/tasks/pulp.yml
@@ -109,39 +109,46 @@
delay: 1
retries: 25
-- name: create pulp repo
+- name: create pulp repos
uri:
url: '{{ pulp_api }}/pulp/api/v3/repositories/ansible/ansible/'
method: POST
body_format: json
body:
- name: ansible_ci
+ name: '{{ repo_name }}'
status_code:
- 201
user: '{{ pulp_user }}'
password: '{{ pulp_password }}'
force_basic_auth: true
register: pulp_repo
+ loop:
+ - automation-hub
+ loop_control:
+ loop_var: repo_name
-- name: create pulp distribution
+- name: create pulp distributions
uri:
url: '{{ pulp_api }}/pulp/api/v3/distributions/ansible/ansible/'
method: POST
body_format: json
body:
- name: ansible_ci
- base_path: ansible_ci
- repository: '{{ pulp_api }}{{ pulp_repo.json.pulp_href }}'
+ name: '{{ repo.repo_name }}'
+ base_path: '{{ repo.repo_name }}'
+ repository: '{{ pulp_api }}{{ repo.json.pulp_href }}'
status_code:
- 202
user: '{{ pulp_user }}'
password: '{{ pulp_password }}'
force_basic_auth: true
register: pulp_distribution_task
+ loop: '{{ pulp_repo.results }}'
+ loop_control:
+ loop_var: repo
- name: wait for distribution creation
uri:
- url: '{{ pulp_api }}{{ pulp_distribution_task.json.task }}'
+ url: '{{ pulp_api }}{{ task.json.task }}'
method: GET
status_code:
- 200
@@ -152,3 +159,7 @@
delay: 1
retries: 25
register: pulp_distribution
+ loop: '{{ pulp_distribution_task.results }}'
+ loop_control:
+ loop_var: task
+ label: '{{ task.json.task }}'