Skip to content

Commit

Permalink
fix more tests
Browse files Browse the repository at this point in the history
No-Issue
  • Loading branch information
chr-stian committed Feb 12, 2024
1 parent 1ceaad4 commit 10c7c30
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 24 deletions.
26 changes: 11 additions & 15 deletions galaxy_ng/tests/integration/api/test_container_delete.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import subprocess
from urllib.parse import urlparse

import pytest

Expand All @@ -19,22 +18,20 @@ def test_delete_ee_and_content(ansible_config, galaxy_client):
config = ansible_config("admin")

container_engine = config["container_engine"]
url = config['url']
parsed_url = urlparse(url)
cont_reg = parsed_url.netloc
container_registry = config["container_registry"]

# Pull alpine image
pull_and_tag_test_image(container_engine, cont_reg)
pull_and_tag_test_image(container_engine, container_registry)

# Login to local registry with tls verify disabled
cmd = [container_engine, "login", "-u", f"{config['username']}", "-p",
f"{config['password']}", f"{config['url'].split(parsed_url.path)[0]}"]
f"{config['password']}", container_registry]
if container_engine == 'podman':
cmd.append("--tls-verify=false")
subprocess.check_call(cmd)

# Push image to local registry
cmd = [container_engine, "push", f"{cont_reg}/alpine:latest"]
cmd = [container_engine, "push", f"{container_registry}/alpine:latest"]
if container_engine == 'podman':
cmd.append("--tls-verify=false")
subprocess.check_call(cmd)
Expand Down Expand Up @@ -86,28 +83,27 @@ def test_shared_content_is_not_deleted(ansible_config, galaxy_client):
gc = galaxy_client("admin")
config = ansible_config("admin")
container_engine = config["container_engine"]
url = config['url']
parsed_url = urlparse(url)
cont_reg = parsed_url.netloc
container_registry = config["container_registry"]
# Pull alpine image
image = pull_and_tag_test_image(container_engine, cont_reg, "alpine1:latest")
image = pull_and_tag_test_image(container_engine, container_registry, "alpine1:latest")
# Login to local registry with tls verify disabled
cmd = [container_engine, "login", "-u", f"{config['username']}", "-p",
f"{config['password']}", f"{config['url'].split(parsed_url.path)[0]}"]
f"{config['password']}", container_registry]
if container_engine == 'podman':
cmd.append("--tls-verify=false")
subprocess.check_call(cmd)

# Push image to local registry
cmd = [container_engine, "push", f"{cont_reg}/alpine1:latest"]
cmd = [container_engine, "push", f"{container_registry}/alpine1:latest"]

if container_engine == 'podman':
cmd.append("--tls-verify=false")
subprocess.check_call(cmd)

# Copy 'alpine1' and rename to 'alpine2'
subprocess.check_call([container_engine, "tag", image, f"{cont_reg}/alpine2:latest"])
cmd = [container_engine, "push", f"{cont_reg}/alpine2:latest"]
subprocess.check_call([container_engine, "tag", image,
f"{container_registry}/alpine2:latest"])
cmd = [container_engine, "push", f"{container_registry}/alpine2:latest"]
if container_engine == 'podman':
cmd.append("--tls-verify=false")
subprocess.check_call(cmd)
Expand Down
11 changes: 4 additions & 7 deletions galaxy_ng/tests/integration/api/test_container_push_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
See: https://issues.redhat.com/browse/AAH-2327
"""
import subprocess
from urllib.parse import urlparse

import pytest

Expand All @@ -25,21 +24,19 @@
def test_can_update_container_push(ansible_config, require_auth, galaxy_client):
config = ansible_config("admin")
container_engine = config["container_engine"]
url = config['url']
parsed_url = urlparse(url)
cont_reg = parsed_url.netloc
container_registry = config["container_registry"]
# Pull alpine image
pull_and_tag_test_image(container_engine, cont_reg)
pull_and_tag_test_image(container_engine, container_registry)

# Login to local registry with tls verify disabled
cmd = [container_engine, "login", "-u", f"{config['username']}", "-p",
f"{config['password']}", f"{config['url'].split(parsed_url.path)[0]}"]
f"{config['password']}", container_registry]
if container_engine == "podman":
cmd.append("--tls-verify=false")
subprocess.check_call(cmd)

# Push image to local registry
cmd = [container_engine, "push", f"{cont_reg}/alpine:latest"]
cmd = [container_engine, "push", f"{container_registry}/alpine:latest"]
if container_engine == "podman":
cmd.append("--tls-verify=false")
subprocess.check_call(cmd)
Expand Down
5 changes: 4 additions & 1 deletion galaxy_ng/tests/integration/api/test_namespace_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from galaxykit.repositories import search_collection
from galaxykit.users import get_me

from ..utils.iqe_utils import is_stage_environment
from ..utils.iqe_utils import is_stage_environment, fix_prefix_workaround
from ..utils.repo_management_utils import upload_new_artifact
from ..utils.tasks import wait_for_all_tasks_gk, wait_for_namespace_tasks_gk
from ..utils.tools import generate_random_string
Expand Down Expand Up @@ -186,6 +186,9 @@ def test_namespace_edit_logo(galaxy_client):
# fields that should NOT change
for field in ["pulp_href", "name", "company", "email", "description", "resources", "links"]:
# FIXME
if field == "pulp_href":
updated_again_namespace[field] = (
fix_prefix_workaround(updated_again_namespace[field]))
assert my_namespace[field] == updated_again_namespace[field]

# fields that changed
Expand Down
5 changes: 4 additions & 1 deletion galaxy_ng/tests/integration/utils/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ def wait_for_task_ui_client(gc, task):
if counter >= 60:
raise Exception('Task is taking too long')
ds = gc.get(f"pulp/api/v3/tasks/{task_id}/")
state = ds.json()['state']
try:
state = ds.json()['state']
except AttributeError:
state = ds['state']
if state == 'completed':
break
time.sleep(SLEEP_SECONDS_POLLING)
Expand Down

0 comments on commit 10c7c30

Please sign in to comment.