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.
* ah_ee_repository * ah_ee_repository_sync Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
- Loading branch information
Showing
5 changed files
with
207 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
- name: ah_ee_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: | ||
registry_name: "ee_{{ test_id }}" | ||
ee_repo_name: "ee_repo_{{ test_id }}" | ||
|
||
- name: Create EE remote registry | ||
ansible.hub.ah_ee_registry: | ||
name: "{{ registry_name }}" | ||
url: https://quay.io/my/registry | ||
state: present | ||
register: r | ||
|
||
- name: Check if the remote registry EE is created | ||
assert: | ||
that: | ||
- r.changed | ||
|
||
- name: Add a remote repository from registry | ||
ansible.hub.ah_ee_repository: | ||
name: "{{ ee_repo_name }}" | ||
upstream_name: "upstream_{{ ee_repo_name }}" | ||
registry: "{{ registry_name }}" | ||
include_tags: | ||
- latest | ||
state: present | ||
register: r | ||
|
||
- name: Check if the remote registry EE is created | ||
assert: | ||
that: | ||
- r.changed | ||
|
||
- name: Remove a remote repository | ||
ansible.hub.ah_ee_repository: | ||
name: "{{ ee_repo_name }}" | ||
state: absent | ||
register: r | ||
|
||
- name: Check if the remote registry EE is deleted | ||
assert: | ||
that: | ||
- r.changed | ||
always: | ||
- name: Remove a remote repository | ||
ansible.hub.ah_ee_repository: | ||
name: "{{ ee_repo_name }}" | ||
state: absent | ||
ignore_errors: true | ||
|
||
- name: Remove EE remote registry | ||
ansible.hub.ah_ee_registry: | ||
name: "{{ registry_name }}" | ||
state: absent | ||
ignore_errors: true |
68 changes: 68 additions & 0 deletions
68
tests/integration/targets/ah_ee_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,68 @@ | ||
--- | ||
- name: ah_ee_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: 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: | ||
registry_name: "ee_{{ test_id }}" | ||
ee_repo_name: "ee_repo_{{ test_id }}" | ||
|
||
- name: Create EE remote registry | ||
ansible.hub.ah_ee_registry: | ||
name: "{{ registry_name }}" | ||
url: https://quay.io/my/registry | ||
state: present | ||
register: r | ||
|
||
- name: Check if the remote registry EE is created | ||
assert: | ||
that: | ||
- r.changed | ||
|
||
- name: Add a remote repository from registry | ||
ansible.hub.ah_ee_repository: | ||
name: "{{ ee_repo_name }}" | ||
upstream_name: "upstream_{{ ee_repo_name }}" | ||
registry: "{{ registry_name }}" | ||
include_tags: | ||
- latest | ||
state: present | ||
register: r | ||
|
||
- name: Check if the remote registry EE is created | ||
assert: | ||
that: | ||
- r.changed | ||
|
||
- name: Sync a remote repository | ||
ansible.hub.ah_ee_repository_sync: | ||
name: "{{ ee_repo_name }}" | ||
wait: false | ||
register: r | ||
|
||
- name: Check if the remote registry EE is sync | ||
assert: | ||
that: | ||
- r.changed | ||
always: | ||
- name: Remove a remote repository | ||
ansible.hub.ah_ee_repository: | ||
name: "{{ ee_repo_name }}" | ||
state: absent | ||
ignore_errors: true | ||
|
||
- name: Remove EE remote registry | ||
ansible.hub.ah_ee_registry: | ||
name: "{{ registry_name }}" | ||
state: absent | ||
ignore_errors: true |
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,19 @@ | ||
--- | ||
- name: ah_token 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: Create a token | ||
ansible.hub.ah_token: | ||
state: present | ||
register: r | ||
no_log: true | ||
|
||
- name: Check if the token is created | ||
assert: | ||
that: | ||
- r.changed |
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,36 @@ | ||
--- | ||
- name: ah_user 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: Ensure the user exists | ||
ansible.hub.ah_user: | ||
username: "user_{{ test_id }}" | ||
first_name: "first_{{ test_id }}" | ||
last_name: "last_{{ test_id }}" | ||
email: "user_{{ test_id }}@example.com" | ||
password: vs9mrD55NP | ||
state: present | ||
register: r | ||
|
||
- name: Check if the user is created | ||
assert: | ||
that: | ||
- r.changed | ||
|
||
always: | ||
- name: Remove user | ||
ansible.hub.ah_user: | ||
username: "user_{{ test_id }}" | ||
state: absent | ||
register: r | ||
ignore_errors: true |