Skip to content

Commit

Permalink
Integration test updates for CRC (#1774)
Browse files Browse the repository at this point in the history
* Clean up repos and distros for repo tests running in crc
* Fix settings check to skip correctly

No-Issue
  • Loading branch information
awcrosby authored Jun 15, 2023
1 parent 186f9d5 commit a314e11
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 9 deletions.
4 changes: 2 additions & 2 deletions galaxy_ng/tests/integration/api/test_collection_signing.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,8 +695,8 @@ def test_move_with_signing_service(ansible_config, artifact, upload_artifact, se
if not settings.get("GALAXY_REQUIRE_CONTENT_APPROVAL"):
pytest.skip("GALAXY_REQUIRE_CONTENT_APPROVAL is required to be enabled")

if settings.get("GALAXY_COLLECTION_SIGNING_SERVICE") is None:
pytest.skip("GALAXY_COLLECTION_SIGNING_SERVICE is NoneType")
if not settings.get("GALAXY_COLLECTION_SIGNING_SERVICE"):
pytest.skip("GALAXY_COLLECTION_SIGNING_SERVICE is required to be set")

config = ansible_config("admin")
api_client = get_client(config, request_token=True, require_auth=True)
Expand Down
61 changes: 54 additions & 7 deletions galaxy_ng/tests/integration/api/test_repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
)
from galaxy_ng.tests.integration.utils.tools import generate_random_string
from galaxykit.collections import sign_collection
from galaxykit.repositories import copy_content_between_repos, move_content_between_repos
from galaxykit.repositories import (
copy_content_between_repos,
delete_distribution,
delete_repository,
move_content_between_repos,
)
from galaxykit.utils import GalaxyClientError

logger = logging.getLogger(__name__)
Expand All @@ -37,6 +42,10 @@ def test_cant_upload_same_collection_same_repo(self, galaxy_client):
upload_test_artifact(gc, namespace_name, test_repo_name, artifact)
assert ctx.value.response.status_code == 400

# Cleanup
delete_repository(gc, test_repo_name)
delete_distribution(gc, test_repo_name)

@pytest.mark.repositories
def test_copy_cv_endpoint(self, galaxy_client):
"""
Expand Down Expand Up @@ -69,6 +78,12 @@ def test_copy_cv_endpoint(self, galaxy_client):
]
assert verify_repo_data(expected, results)

# Cleanup
delete_repository(gc_admin, test_repo_name_1)
delete_repository(gc_admin, test_repo_name_2)
delete_distribution(gc_admin, test_repo_name_1)
delete_distribution(gc_admin, test_repo_name_2)

@pytest.mark.repositories
def test_move_cv_endpoint(self, galaxy_client):
"""
Expand Down Expand Up @@ -102,6 +117,12 @@ def test_move_cv_endpoint(self, galaxy_client):
)
assert matches == 0

# Cleanup
delete_repository(gc_admin, test_repo_name_1)
delete_repository(gc_admin, test_repo_name_2)
delete_distribution(gc_admin, test_repo_name_1)
delete_distribution(gc_admin, test_repo_name_2)

@pytest.mark.repositories
@pytest.mark.standalone_only
def test_copy_signed_cv_endpoint(self, galaxy_client):
Expand Down Expand Up @@ -136,6 +157,12 @@ def test_copy_signed_cv_endpoint(self, galaxy_client):
]
assert verify_repo_data(expected, results)

# Cleanup
delete_repository(gc_admin, test_repo_name_1)
delete_repository(gc_admin, test_repo_name_2)
delete_distribution(gc_admin, test_repo_name_1)
delete_distribution(gc_admin, test_repo_name_2)

@pytest.mark.repositories
@pytest.mark.standalone_only
def test_move_signed_cv_endpoint(self, galaxy_client):
Expand Down Expand Up @@ -171,6 +198,12 @@ def test_move_signed_cv_endpoint(self, galaxy_client):
)
assert matches == 0

# Cleanup
delete_repository(gc_admin, test_repo_name_1)
delete_repository(gc_admin, test_repo_name_2)
delete_distribution(gc_admin, test_repo_name_1)
delete_distribution(gc_admin, test_repo_name_2)

@pytest.mark.repositories
def test_directly_to_repo(self, galaxy_client):
"""
Expand All @@ -181,12 +214,15 @@ def test_directly_to_repo(self, galaxy_client):
create_repo_and_dist(gc, test_repo_name)
namespace_name = create_test_namespace(gc)
artifact = upload_new_artifact(
gc, namespace_name, test_repo_name, "1.0.1", tags=["application"],
direct_upload=True
gc, namespace_name, test_repo_name, "1.0.1", tags=["application"], direct_upload=True
)
matches, _ = search_collection_endpoint(gc, name=artifact.name)
assert matches == 1

# Cleanup
delete_repository(gc, test_repo_name)
delete_distribution(gc, test_repo_name)

@pytest.mark.repositories
def test_cannot_directly_to_repo_if_pipeline_approved(self, galaxy_client):
"""
Expand All @@ -199,11 +235,19 @@ def test_cannot_directly_to_repo_if_pipeline_approved(self, galaxy_client):
namespace_name = create_test_namespace(gc)
with pytest.raises(GalaxyClientError) as ctx:
upload_new_artifact(
gc, namespace_name, test_repo_name, "1.0.1", tags=["application"],
direct_upload=True
gc,
namespace_name,
test_repo_name,
"1.0.1",
tags=["application"],
direct_upload=True,
)
assert ctx.value.response.status_code == 403

# Cleanup
delete_repository(gc, test_repo_name)
delete_distribution(gc, test_repo_name)

@pytest.mark.repositories
def test_can_directly_to_repo_if_pipeline_staging(self, galaxy_client):
"""
Expand All @@ -215,8 +259,11 @@ def test_can_directly_to_repo_if_pipeline_staging(self, galaxy_client):
create_repo_and_dist(gc, test_repo_name, pipeline="staging")
namespace_name = create_test_namespace(gc)
artifact = upload_new_artifact(
gc, namespace_name, test_repo_name, "1.0.1", tags=["application"],
direct_upload=True
gc, namespace_name, test_repo_name, "1.0.1", tags=["application"], direct_upload=True
)
matches, _ = search_collection_endpoint(gc, name=artifact.name)
assert matches == 1

# Cleanup
delete_repository(gc, test_repo_name)
delete_distribution(gc, test_repo_name)

0 comments on commit a314e11

Please sign in to comment.