Skip to content

Commit

Permalink
Poll the move task(s) during integration (#1325)
Browse files Browse the repository at this point in the history
* Poll the move task(s) during integration
* Poll tasks in explicit order.

No-Issue

Signed-off-by: James Tanner <[email protected]>
  • Loading branch information
jctanner authored Jun 21, 2022
1 parent 9ae1a17 commit 75f4a98
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions galaxy_ng/tests/integration/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}/"
Expand Down

0 comments on commit 75f4a98

Please sign in to comment.