generated from ansible-collections/collection_template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
- Loading branch information
Showing
5 changed files
with
214 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
tests/integration/targets/collection_remote/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
- name: collection_remote integration tests | ||
module_defaults: | ||
group/ansible.hub.hub: | ||
ah_host: "{{ ah_host }}" | ||
ah_username: "{{ ah_username }}" | ||
ah_password: "{{ ah_password }}" | ||
validate_certs: "{{ ah_verify_ssl }}" | ||
block: | ||
- name: Generate a test_id for the test | ||
set_fact: | ||
test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') | lower }}" | ||
when: test_id is not defined | ||
|
||
- name: Define variables | ||
set_fact: | ||
collection_repo_name: "sample_{{ test_id }}" | ||
distribution: "sample_{{ test_id }}" | ||
|
||
- name: Create a collection repository | ||
ansible.hub.collection_repository: | ||
name: "{{ collection_repo_name }}" | ||
description: "description of the repository" | ||
pulp_labels: | ||
pipeline: "approved" | ||
distribution: | ||
name: "{{ distribution }}" | ||
state: present | ||
remote: community | ||
wait: true | ||
register: r | ||
|
||
- name: Check if the collection repository is created | ||
assert: | ||
that: | ||
- r.changed | ||
|
||
- name: Configure collection | ||
collection_remote: | ||
name: "{{ collection_repo_name }}" | ||
url: https://galaxy.ansible.com/api/ | ||
requirements: | ||
- galaxy.galaxy | ||
- infra.controller_configuration | ||
register: r | ||
|
||
- name: Check if the collection_remote works | ||
assert: | ||
that: | ||
- r.changed | ||
|
||
always: | ||
- name: Cleanup - Delete collection repository | ||
ansible.hub.collection_repository: | ||
name: "{{ collection_repo_name }}" | ||
state: absent | ||
ignore_errors: true |
114 changes: 114 additions & 0 deletions
114
tests/integration/targets/collection_repository/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
--- | ||
- name: collection_repository integration tests | ||
module_defaults: | ||
group/ansible.hub.hub: | ||
ah_host: "{{ ah_host }}" | ||
ah_username: "{{ ah_username }}" | ||
ah_password: "{{ ah_password }}" | ||
validate_certs: "{{ ah_verify_ssl }}" | ||
block: | ||
- name: Generate a test_id for the test | ||
set_fact: | ||
test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') | lower }}" | ||
when: test_id is not defined | ||
|
||
- name: Define variables | ||
set_fact: | ||
collection_repo_name: "sample_{{ test_id }}" | ||
distribution: "sample_{{ test_id }}" | ||
|
||
- name: Create a collection repository in check mode | ||
ansible.hub.collection_repository: | ||
name: "{{ collection_repo_name }}" | ||
description: "description of the repository" | ||
pulp_labels: | ||
pipeline: "approved" | ||
distribution: | ||
name: "{{ distribution }}" | ||
state: present | ||
remote: community | ||
wait: true | ||
register: r | ||
check_mode: yes | ||
|
||
- name: Check if the collection repository is created in check mode | ||
assert: | ||
that: | ||
- r.changed | ||
|
||
- name: Create a collection repository | ||
ansible.hub.collection_repository: | ||
name: "{{ collection_repo_name }}" | ||
description: "description of the repository" | ||
pulp_labels: | ||
pipeline: "approved" | ||
distribution: | ||
name: "{{ distribution }}" | ||
state: present | ||
remote: community | ||
wait: true | ||
register: r | ||
|
||
- name: Check if the collection repository is created | ||
assert: | ||
that: | ||
- r.changed | ||
|
||
- name: Create a collection repository again | ||
ansible.hub.collection_repository: | ||
name: "{{ collection_repo_name }}" | ||
description: "description of the repository" | ||
pulp_labels: | ||
pipeline: "approved" | ||
distribution: | ||
name: "{{ distribution }}" | ||
state: present | ||
remote: community | ||
wait: true | ||
register: r | ||
|
||
- name: Check if the collection repository is not created again | ||
assert: | ||
that: | ||
- not r.changed | ||
|
||
- name: Delete collection repository in check mode | ||
ansible.hub.collection_repository: | ||
name: "{{ collection_repo_name }}" | ||
state: absent | ||
check_mode: yes | ||
register: r | ||
|
||
- name: Check if the collection is deleted in check mode | ||
assert: | ||
that: | ||
- r.changed | ||
|
||
- name: Delete collection repository | ||
ansible.hub.collection_repository: | ||
name: "{{ collection_repo_name }}" | ||
state: absent | ||
register: r | ||
|
||
- name: Check if the collection is deleted | ||
assert: | ||
that: | ||
- r.changed | ||
|
||
- name: Delete collection repository again | ||
ansible.hub.collection_repository: | ||
name: "{{ collection_repo_name }}" | ||
state: absent | ||
register: r | ||
|
||
- name: Check if the collection is not deleted again | ||
assert: | ||
that: | ||
- not r.changed | ||
|
||
always: | ||
- name: Cleanup - Delete collection repository | ||
ansible.hub.collection_repository: | ||
name: "{{ collection_repo_name }}" | ||
state: absent | ||
ignore_errors: true |
31 changes: 31 additions & 0 deletions
31
tests/integration/targets/collection_repository_sync/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
- name: collection_repository_sync integration tests | ||
module_defaults: | ||
group/ansible.hub.hub: | ||
ah_host: "{{ ah_host }}" | ||
ah_username: "{{ ah_username }}" | ||
ah_password: "{{ ah_password }}" | ||
validate_certs: "{{ ah_verify_ssl }}" | ||
block: | ||
- name: Sync rh-certified in check mode | ||
ansible.hub.collection_repository_sync: | ||
name: rh-certified | ||
wait: false | ||
check_mode: yes | ||
register: r | ||
|
||
- name: Check if sync is successful | ||
assert: | ||
that: | ||
- r.changed | ||
|
||
- name: Sync rh-certified | ||
ansible.hub.collection_repository_sync: | ||
name: rh-certified | ||
wait: false | ||
register: r | ||
|
||
- name: Check if sync is successful | ||
assert: | ||
that: | ||
- r.changed |