Skip to content

Commit

Permalink
Updating integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Hervé Quatremain committed Aug 5, 2024
1 parent 4d135ca commit 2a236ea
Show file tree
Hide file tree
Showing 38 changed files with 199 additions and 701 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repos:
types:
- yaml
- repo: https://github.com/psf/black
rev: 24.4.2
rev: 24.8.0
hooks:
- id: black
name: black
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/targets/quay_api_token/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
dependencies:
- setup_token
- setup_organization
...
48 changes: 14 additions & 34 deletions tests/integration/targets/quay_api_token/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,33 @@
---
# Supporting organization
- name: Ensure organization ansibletestorg exists
infra.quay_configuration.quay_organization:
name: ansibletestorg
email: [email protected]
state: present
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
validate_certs: false

# Supporting user account
- name: Ensure ansibletestuser1 user account exists
- name: Ensure testuser1 user account exists
infra.quay_configuration.quay_user:
username: ansibletestuser1
username: testuser1
password: vs9mrD55NP
email: ansibletestuser1@example.com
email: testuser1@example.com
state: present
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
validate_certs: false

# Supporting team
- name: Ensure ansibletestteam1 team exists
- name: Ensure testteam1 team exists
infra.quay_configuration.quay_team:
name: ansibletestteam1
name: testteam1
organization: ansibletestorg
role: admin
members:
- ansibletestuser1
- testuser1
state: present
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
validate_certs: false

# Supporting application
- name: Ensure the ansibletestapp1 application exists
- name: Ensure the testapp11 application exists
infra.quay_configuration.quay_application:
organization: ansibletestorg
name: ansibletestapp1
name: testapp11
state: present
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
Expand All @@ -46,7 +36,7 @@

- name: Generate an OAuth access token for the user
infra.quay_configuration.quay_api_token:
quay_username: ansibletestuser1
quay_username: testuser1
quay_password: vs9mrD55NP
client_id: "{{ app_details['client_id'] }}"
rights:
Expand All @@ -60,18 +50,18 @@
that: "'access_token' in result"
fail_msg: The result should have the access_token key

- name: Ensure ansibletestteam1 team is removed
- name: Ensure testteam1 team is removed
infra.quay_configuration.quay_team:
name: ansibletestteam1
name: testteam1
organization: ansibletestorg
state: absent
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
validate_certs: false

- name: Ensure ansibletestuser1 user account is removed
- name: Ensure testuser1 user account is removed
infra.quay_configuration.quay_user:
username: ansibletestuser1
username: testuser1
state: absent
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
Expand All @@ -80,19 +70,9 @@
- name: Ensure the application is removed
infra.quay_configuration.quay_application:
organization: ansibletestorg
name: ansibletestapp1
name: testapp11
state: absent
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
validate_certs: false

- name: Ensure the organization is removed
infra.quay_configuration.quay_organization:
name: ansibletestorg
state: absent
quay_host: "{{ quay_url }}"
# For testing, authenticating with username/password instead of the token
quay_username: "{{ admin_username }}"
quay_password: "{{ admin_password }}"
validate_certs: false
...
2 changes: 1 addition & 1 deletion tests/integration/targets/quay_application/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
dependencies:
- setup_token
- setup_organization
...
20 changes: 0 additions & 20 deletions tests/integration/targets/quay_application/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
---
# Supporting organization
- name: Ensure organization ansibletestorg exists
infra.quay_configuration.quay_organization:
name: ansibletestorg
email: [email protected]
state: present
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
validate_certs: false

- name: Ensure the application ansibletestapp1 exists
infra.quay_configuration.quay_application:
organization: ansibletestorg
Expand Down Expand Up @@ -126,14 +116,4 @@
- ansibletestapp1
- ansibletestapp2
- ansibletestapp3

- name: Ensure the organization is removed
infra.quay_configuration.quay_organization:
name: ansibletestorg
state: absent
quay_host: "{{ quay_url }}"
# For testing, authenticating with username/password instead of the token
quay_username: "{{ admin_username }}"
quay_password: "{{ admin_password }}"
validate_certs: false
...
2 changes: 1 addition & 1 deletion tests/integration/targets/quay_default_perm/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
dependencies:
- setup_token
- setup_organization
...
87 changes: 0 additions & 87 deletions tests/integration/targets/quay_default_perm/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,4 @@
---
# Supporting organization
- name: Ensure organization ansibletestorg exists
infra.quay_configuration.quay_organization:
name: ansibletestorg
email: [email protected]
state: present
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
validate_certs: false

# Supporting user accounts
- name: Ensure user accounts exist
infra.quay_configuration.quay_user:
username: "{{ item }}"
email: "{{ item }}@example.com"
state: present
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
validate_certs: false
loop:
- ansibletestuser1
- ansibletestuser2

# Supporting robot accounts
- name: Ensure the robot accounts exist
infra.quay_configuration.quay_robot:
name: ansibletestorg+ansibletestrobot1
state: present
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
validate_certs: false

# Supporting team
- name: Ensure teams exist
infra.quay_configuration.quay_team:
name: "{{ item }}"
organization: ansibletestorg
role: admin
state: present
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
validate_certs: false
loop:
- ansibletestteam1
- ansibletestteam2

- name: Ensure default perm anon-read-ansibletestuser1 exists
infra.quay_configuration.quay_default_perm:
organization: ansibletestorg
Expand Down Expand Up @@ -226,45 +180,4 @@
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
validate_certs: false

- name: Ensure the teams are removed
infra.quay_configuration.quay_team:
name: "{{ item }}"
organization: ansibletestorg
state: absent
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
validate_certs: false
loop:
- ansibletestteam1
- ansibletestteam2

- name: Ensure user accounts are removed
infra.quay_configuration.quay_user:
username: "{{ item }}"
state: absent
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
validate_certs: false
loop:
- ansibletestuser1
- ansibletestuser2

- name: Ensure the robot accounts are removed
infra.quay_configuration.quay_robot:
name: ansibletestorg+ansibletestrobot1
state: absent
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
validate_certs: false

- name: Ensure the organization is removed
infra.quay_configuration.quay_organization:
name: ansibletestorg
state: absent
quay_host: "{{ quay_url }}"
# For testing, authenticating with username/password instead of the token
quay_username: "{{ admin_username }}"
quay_password: "{{ admin_password }}"
validate_certs: false
...
1 change: 1 addition & 0 deletions tests/integration/targets/quay_layer_info/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@
ansible.builtin.assert:
that: not result['changed']
fail_msg: The preceding task should not have changed anything
...
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
dependencies:
- setup_token
- setup_organization
...
20 changes: 0 additions & 20 deletions tests/integration/targets/quay_manifest_label/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
---
# Supporting organization
- name: Ensure organization ansibletestorg exists
infra.quay_configuration.quay_organization:
name: ansibletestorg
email: [email protected]
state: present
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
validate_certs: false

- name: Check whether podman is available
ansible.builtin.command:
cmd: podman --version
Expand Down Expand Up @@ -255,14 +245,4 @@
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
validate_certs: false

- name: Ensure the organization is removed
infra.quay_configuration.quay_organization:
name: ansibletestorg
state: absent
quay_host: "{{ quay_url }}"
# For testing, authenticating with username/password instead of the token
quay_username: "{{ admin_username }}"
quay_password: "{{ admin_password }}"
validate_certs: false
...
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@
ansible.builtin.assert:
that: labels['labels']|length == 0
fail_msg: The preceding task should not have returned labels
...
2 changes: 1 addition & 1 deletion tests/integration/targets/quay_notification/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
dependencies:
- setup_token
- setup_organization
...
59 changes: 1 addition & 58 deletions tests/integration/targets/quay_notification/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,4 @@
---
# Supporting organization
- name: Ensure organization ansibletestorg exists
infra.quay_configuration.quay_organization:
name: ansibletestorg
email: [email protected]
state: present
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
validate_certs: false

# Supporting user account
- name: Ensure user accounts exist
infra.quay_configuration.quay_user:
username: ansibletestuser1
email: "[email protected]"
state: present
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
validate_certs: false

# Supporting team
- name: Ensure teams exist
infra.quay_configuration.quay_team:
name: ansibletestteam1
organization: ansibletestorg
role: admin
state: present
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
validate_certs: false

# Supporting repository
- name: Ensure repository ansibletestrepo exists
infra.quay_configuration.quay_repository:
Expand Down Expand Up @@ -261,30 +230,4 @@
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
validate_certs: false

- name: Ensure the team is removed
infra.quay_configuration.quay_team:
name: ansibletestteam1
organization: ansibletestorg
state: absent
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
validate_certs: false

- name: Ensure user account is removed
infra.quay_configuration.quay_user:
username: ansibletestuser1
state: absent
quay_host: "{{ quay_url }}"
quay_token: "{{ quay_token }}"
validate_certs: false

- name: Ensure the organization is removed
infra.quay_configuration.quay_organization:
name: ansibletestorg
state: absent
quay_host: "{{ quay_url }}"
# For testing, authenticating with username/password instead of the token
quay_username: "{{ admin_username }}"
quay_password: "{{ admin_password }}"
validate_certs: false
...
2 changes: 1 addition & 1 deletion tests/integration/targets/quay_proxy_cache/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
dependencies:
- setup_token
- setup_organization
...
Loading

0 comments on commit 2a236ea

Please sign in to comment.