From 75f4a98b5c01955308b06fe557d9b73405c06923 Mon Sep 17 00:00:00 2001 From: jctanner Date: Tue, 21 Jun 2022 19:23:28 -0400 Subject: [PATCH] Poll the move task(s) during integration (#1325) * Poll the move task(s) during integration * Poll tasks in explicit order. No-Issue Signed-off-by: James Tanner --- galaxy_ng/tests/integration/utils.py | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/galaxy_ng/tests/integration/utils.py b/galaxy_ng/tests/integration/utils.py index 23faac6834..69441c08ca 100644 --- a/galaxy_ng/tests/integration/utils.py +++ b/galaxy_ng/tests/integration/utils.py @@ -375,10 +375,28 @@ def set_certification(client, collection): f"{collection.version}/move/staging/published/" ) - client(url, method="POST", args=b"{}") - - # no task url in response from above request, so can't intelligently wait. - # so we'll just sleep for 1 second and hope the certification is done by then. + job_tasks = client(url, method="POST", args=b"{}") + assert 'copy_task_id' in job_tasks + assert 'curate_all_synclist_repository_task_id' in job_tasks + assert 'remove_task_id' in job_tasks + + # wait for each unique task to finish ... + for key in ['copy_task_id', 'curate_all_synclist_repository_task_id', 'remove_task_id']: + task_id = job_tasks.get(key) + + # curate is null sometimes? ... + if task_id is None: + continue + + # The task_id is not a url, so it has to be assembled from known data ... + # http://.../api/automation-hub/pulp/api/v3/tasks/8be0b9b6-71d6-4214-8427-2ecf81818ed4/ + ds = { + 'task': f"{client.config['url']}/pulp/api/v3/tasks/{task_id}" + } + task_result = wait_for_task(client, ds) + assert task_result['state'] == 'completed', task_result + + # give extra time for the backend to settle and "hidden" tasks to finish dest_url = ( f"v3/collections/{collection.namespace}/" f"{collection.name}/versions/{collection.version}/"