Skip to content

Commit

Permalink
make it compatible with AAP2.3 hub4.6 and AAP2.4 hub4.7
Browse files Browse the repository at this point in the history
No-Issue
  • Loading branch information
chr-stian committed Nov 17, 2023
1 parent 73229c6 commit 53ca1a6
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 8 deletions.
12 changes: 9 additions & 3 deletions galaxy_ng/tests/integration/api/test_verify_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pytest

from galaxy_ng.tests.integration.conftest import is_hub_4_7_or_higher
from galaxy_ng.tests.integration.utils.iqe_utils import is_upgrade_from_aap23_hub46
from galaxy_ng.tests.integration.utils.repo_management_utils import search_collection_endpoint
from galaxykit.collections import collection_info
from galaxykit.groups import get_group_id
Expand All @@ -14,6 +15,8 @@

logger = logging.getLogger(__name__)

SKIP_MESSAGE = "Load data stage was run on AAP 2.3, without repository management"


class TestVerifyData:

Expand Down Expand Up @@ -51,8 +54,9 @@ def test_verify_data_collections(self, galaxy_client, data, ansible_config):
"""
gc = galaxy_client("admin")
for expected_col in data["collections"]:
if (expected_col["repository"] != "published"
and not is_hub_4_7_or_higher(ansible_config)):
if (expected_col["repository"]
!= "published" and not is_hub_4_7_or_higher(
ansible_config)) or is_upgrade_from_aap23_hub46():
continue

expected_name = f"collection_dep_a_{expected_col['name']}"
Expand Down Expand Up @@ -85,6 +89,7 @@ def test_verify_data_groups(self, galaxy_client, data):
get_group_id(gc, expected_group["name"])

@pytest.mark.min_hub_version("4.7dev")
@pytest.mark.skipif(is_upgrade_from_aap23_hub46(), reason=SKIP_MESSAGE)
@pytest.mark.verify_data
def test_verify_data_repos(self, galaxy_client, data):
"""
Expand All @@ -105,7 +110,8 @@ def test_verify_data_rbac_roles(self, galaxy_client, data):
role_info_1 = get_role(gc, expected_rbac_role["name"])
assert role_info_1["name"] == expected_rbac_role["name"]
assert role_info_1["description"] == expected_rbac_role["description"]
assert sorted(role_info_1["permissions"]) == sorted(expected_rbac_role["permissions"])
assert sorted(role_info_1["permissions"]) == sorted(
expected_rbac_role["permissions"])

@pytest.mark.min_hub_version("4.7dev")
@pytest.mark.verify_data
Expand Down
37 changes: 32 additions & 5 deletions galaxy_ng/tests/integration/load_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,38 @@ namespaces:
group: group_1
- name: ns_test_2
group: group_1
- name: ns_test_3
group: group_2
- name: ns_test_4
group: group_2

collections:
# name is the suffix, collection_dep_a_{name}
# example: collection_dep_a_collection_3
- name: collection_3
- name: collection_1
version: 1.0.0
namespace: ns_test_1
repository: repo_1
repository: repo-test-1
signed: true
deprecated: false
- name: collection_4
- name: collection_2
version: 1.0.0
namespace: ns_test_1
repository: published
signed: false
deprecated: true
- name: collection_3
version: 1.2.3
namespace: ns_test_1
repository: published
signed: true
deprecated: false
- name: collection_4
version: 1.0.0
namespace: ns_test_1
repository: published
signed: false
deprecated: false

groups:
- name: group_1
Expand All @@ -35,16 +51,27 @@ users:
email: [email protected]
is_superuser: true
group: group_2
- username: user_3
password: P@ssword!
email: [email protected]
is_superuser: false
group: group_2

repositories:
- name: repo_1
- name: repo_2
- name: repo-test-1
- name: repo-test-2
- name: repo-test-3
- name: repo-test-4

remotes:
- name: remote_test_1
url: http://foo.bar/
signed_only: false
tls_validation: false
- name: remote_test_2
url: http://foo.var/
signed_only: true
tls_validation: true

roles:
- name: role_1
Expand Down
5 changes: 5 additions & 0 deletions galaxy_ng/tests/integration/utils/iqe_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ def avoid_docker_limit_rate():
return avoid_limit_rate in ('true', 'True', 1, '1', True)


def is_upgrade_from_aap23_hub46():
upgrade = os.getenv("UPGRADE_FROM_AAP23_HUB46", False)
return upgrade in ('true', 'True', 1, '1', True)


def pull_and_tag_test_image(container_engine, registry, tag=None):
image = "alpine"
tag = "alpine:latest" if tag is None else tag
Expand Down

0 comments on commit 53ca1a6

Please sign in to comment.