diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2021-09-24 14:39:36 +0200 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2021-09-28 10:24:16 +0200 |
commit | a9a54eefab34b25628906a786d6c4ca302f743b1 (patch) | |
tree | de48efeabf92b80e8cc69c456f33908124630769 /test/system | |
parent | 340166876eab09d3e363647213f162864a95d270 (diff) | |
download | podman-a9a54eefab34b25628906a786d6c4ca302f743b1.tar.gz podman-a9a54eefab34b25628906a786d6c4ca302f743b1.tar.bz2 podman-a9a54eefab34b25628906a786d6c4ca302f743b1.zip |
image prune: support removing external containers
Support removing external containers (e.g., build containers) during
image prune.
Fixes: #11472
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'test/system')
-rw-r--r-- | test/system/040-ps.bats | 24 | ||||
-rw-r--r-- | test/system/330-corrupt-images.bats | 2 |
2 files changed, 20 insertions, 6 deletions
diff --git a/test/system/040-ps.bats b/test/system/040-ps.bats index 182d75547..b87d177fa 100644 --- a/test/system/040-ps.bats +++ b/test/system/040-ps.bats @@ -92,24 +92,38 @@ load helpers # Force a buildah timeout; this leaves a buildah container behind PODMAN_TIMEOUT=5 run_podman 124 build -t thiswillneverexist - <<EOF FROM $IMAGE +RUN touch /intermediate.image.to.be.pruned RUN sleep 30 EOF run_podman ps -a - is "${#lines[@]}" "1" "podman ps -a does not see buildah container" + is "${#lines[@]}" "1" "podman ps -a does not see buildah containers" run_podman ps --external -a - is "${#lines[@]}" "2" "podman ps -a --external sees buildah container" + is "${#lines[@]}" "3" "podman ps -a --external sees buildah containers" is "${lines[1]}" \ "[0-9a-f]\{12\} \+$IMAGE *buildah .* seconds ago .* storage .* ${PODMAN_TEST_IMAGE_NAME}-working-container" \ "podman ps --external" - cid="${lines[1]:0:12}" - # 'rm -a' should be a NOP run_podman rm -a run_podman ps --external -a - is "${#lines[@]}" "2" "podman ps -a --external sees buildah container" + is "${#lines[@]}" "3" "podman ps -a --external sees buildah containers" + + # Cannot prune intermediate image as it's being used by a buildah + # container. + run_podman image prune -f + is "$output" "" "No image is pruned" + + # --external for removing buildah containers. + run_podman image prune -f --external + is "${#lines[@]}" "1" "Image used by build container is pruned" + + # One buildah container has been removed. + run_podman ps --external -a + is "${#lines[@]}" "2" "podman ps -a --external sees buildah containers" + + cid="${lines[1]:0:12}" # We can't rm it without -f, but podman should issue a helpful message run_podman 2 rm "$cid" diff --git a/test/system/330-corrupt-images.bats b/test/system/330-corrupt-images.bats index eeffff3ec..86da06cb0 100644 --- a/test/system/330-corrupt-images.bats +++ b/test/system/330-corrupt-images.bats @@ -78,7 +78,7 @@ function _corrupt_image_test() { # Run the requested command. Confirm it succeeds, with suitable warnings run_podman $* - is "$output" ".*error determining parent of image.*ignoring the error" \ + is "$output" ".*Failed to determine parent of image.*ignoring the error" \ "$* with missing $what_to_rm" run_podman images -a --noheading |