From 3779fd07051de5850f48fb1b315786c81236e7ad Mon Sep 17 00:00:00 2001 From: jctanner Date: Tue, 8 Aug 2023 08:42:42 -0400 Subject: [PATCH] Add retries to move cv call in test. (#1833) * Add retries to move cv call in test. No-Issue Signed-off-by: James Tanner --- .../integration/api/test_repositories.py | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/galaxy_ng/tests/integration/api/test_repositories.py b/galaxy_ng/tests/integration/api/test_repositories.py index e3c97e124a..518abd9efa 100644 --- a/galaxy_ng/tests/integration/api/test_repositories.py +++ b/galaxy_ng/tests/integration/api/test_repositories.py @@ -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 @@ -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//pulp/api/v3/repositories/ansible/ansible/ + # /move_collection_version/): + # Post "http://pulp:55001/api//pulp/api/v3/repositories/ansible/ansible/ + # /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}]