Skip to content

Commit

Permalink
Add retries to move cv call in test. (#1833)
Browse files Browse the repository at this point in the history
* Add retries to move cv call in test.

No-Issue

Signed-off-by: James Tanner <[email protected]>
  • Loading branch information
jctanner authored Aug 8, 2023
1 parent fcb92c9 commit 3779fd0
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions galaxy_ng/tests/integration/api/test_repositories.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
import logging
import time

from galaxy_ng.tests.integration.utils.iqe_utils import is_ocp_env
from galaxy_ng.tests.integration.utils.rbac_utils import upload_test_artifact
Expand Down Expand Up @@ -109,9 +110,44 @@ def test_move_cv_endpoint(self, galaxy_client):
add_content_units(gc_admin, content_units, repo_pulp_href_1)

test_repo_name_2 = f"repo-test-{generate_random_string()}"
repo_pulp_href_2 = create_repo_and_dist(gc_admin, test_repo_name_2)

move_content_between_repos(gc_admin, content_units, repo_pulp_href_1, [repo_pulp_href_2])
# FIXME - the POST call will often result in an error with the oci+insights profile ...
# root:client.py:216 Cannot parse expected JSON response
# (http://localhost:38080/api/automation-hub/pulp/api/v3/repositories/ansible/ansible/):
# Post "http://pulp:55001/api/automation-hub/pulp/api/v3/repositories/ansible/ansible/":
# read tcp 172.18.0.2:47338->172.18.0.3:55001: read: connection reset by peer
repo_pulp_href_2 = None
retries = 10
for x in range(0, retries):
try:
repo_pulp_href_2 = create_repo_and_dist(gc_admin, test_repo_name_2)
break
except Exception as e:
print(e)
time.sleep(5)

if repo_pulp_href_2 is None:
raise Exception("failed to create repo and dist")

# FIXME - the POST call will often result in an error with the oci+insights profile ...
# root:client.py:216 Cannot parse expected JSON response
# (http://localhost:38080/api/<prefix>/pulp/api/v3/repositories/ansible/ansible/
# <uuid>/move_collection_version/):
# Post "http://pulp:55001/api/<prefix>/pulp/api/v3/repositories/ansible/ansible/
# <uuid>/move_collection_version/":
# readfrom tcp 172.18.0.3:37490->172.18.0.2:55001:
# write tcp 172.18.0.3:37490->172.18.0.2:55001: use of closed network connection
retries = 10
for x in range(0, retries):
try:
move_content_between_repos(
gc_admin, content_units, repo_pulp_href_1, [repo_pulp_href_2]
)
break
except Exception as e:
print(e)
time.sleep(5)

# verify cv is only in destination repo
_, results = search_collection_endpoint(gc_admin, name=artifact.name)
expected = [{"cv_name": artifact.name, "repo_name": test_repo_name_2, "is_signed": False}]
Expand Down

0 comments on commit 3779fd0

Please sign in to comment.