Skip to content

Commit

Permalink
test: Fix race condition with deleting busy intermediate image
Browse files Browse the repository at this point in the history
Wait until creating a container with the intermediate image actually
finished and succeeded before removing the image. Otherwise pulling the
image away under the creation dialog's feet may fail the creation.
  • Loading branch information
martinpitt committed Jan 8, 2024
1 parent f0d0c67 commit ae64697
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/check-application
Original file line number Diff line number Diff line change
Expand Up @@ -887,14 +887,19 @@ class TestApplication(testlib.MachineCase):
b.click(intermediate_image_sel + " button.btn-delete")
self.confirm_modal("Delete")
b.wait_not_present(intermediate_image_sel)
# Delete intermediate image which is in use

# Create intermediate image and use it in a container
tmpdir = self.execute(auth, "mktemp -d").strip()
self.execute(auth, f"echo 'FROM {IMG_REGISTRY}\nRUN ls' > {tmpdir}/Dockerfile")
IMG_INTERMEDIATE = 'localhost/test-intermediate'
self.execute(auth, f"podman build -t {IMG_INTERMEDIATE} {tmpdir}")
b.click(f'#containers-images tbody tr:contains("{IMG_INTERMEDIATE}") .ct-container-create')
b.wait_visible('div.pf-v5-c-modal-box header:contains("Create container")')
b.click("#create-image-create-btn")
b.wait_not_present("div.pf-v5-c-modal-box")
self.waitContainerRow(IMG_INTERMEDIATE)

# Delete intermediate image which is in use
self.execute(auth, f"podman untag {IMG_INTERMEDIATE}")
b.click(intermediate_image_sel + " .pf-v5-c-dropdown__toggle")
b.click(intermediate_image_sel + " button.btn-delete")
Expand Down

0 comments on commit ae64697

Please sign in to comment.