Skip to content

Commit 647d06e

Browse files
committed
Make pull-through-cache tests more resilient
1 parent 560abe7 commit 647d06e

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

pulp_container/tests/functional/api/test_pull_through_cache.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import time
21
import subprocess
32
import pytest
43

@@ -53,6 +52,8 @@ def pull_and_verify(
5352
registry_client,
5453
local_registry,
5554
full_path,
55+
pulpcore_bindings,
56+
monitor_task,
5657
):
5758
def _pull_and_verify(images, pull_through_distribution):
5859
tags_to_verify = []
@@ -98,15 +99,14 @@ def _pull_and_verify(images, pull_through_distribution):
9899
check_manifest_arch_os_size(manifest)
99100

100101
# 3. check if the repository version has changed
101-
for _ in range(5):
102-
repository = container_repository_api.list(name=path).results[0]
103-
if f"{repository.pulp_href}versions/{version}/" == repository.latest_version_href:
104-
break
105-
106-
# there might be still the saving process running in the background
107-
time.sleep(1)
108-
else:
109-
assert False, "The repository was not updated with the cached content."
102+
repository = container_repository_api.list(name=path).results[0]
103+
task = pulpcore_bindings.TasksApi.list(
104+
reserved_resources=repository.prn,
105+
name="pulp_container.app.tasks.download_image_data.download_image_data",
106+
).results[0]
107+
monitor_task(task.pulp_href)
108+
repository = container_repository_api.read(repository.pulp_href)
109+
assert f"{repository.pulp_href}versions/{version}/" == repository.latest_version_href
110110

111111
# 4. test if pulling the same content twice does not raise any error
112112
local_registry.pull(local_image_pull_path)

0 commit comments

Comments
 (0)