summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2020-03-12 07:57:11 -0600
committerEd Santiago <santiago@redhat.com>2020-03-12 07:57:11 -0600
commit35857808760b41368d41a3a3e16807a1a0d282de (patch)
tree987c119e3e5ffe9c0e446f55a3443205459e378a /test
parent19f5d557bc5d9c538d7a3992abeaa9f7fbb44166 (diff)
downloadpodman-35857808760b41368d41a3a3e16807a1a0d282de.tar.gz
podman-35857808760b41368d41a3a3e16807a1a0d282de.tar.bz2
podman-35857808760b41368d41a3a3e16807a1a0d282de.zip
run --rmi test: make it work
The recently-added 'run --rmi' test was not actually doing what it thinks it was doing: for one, 'run_podman | grep' is never going to work; also, the test was leaving behind stray images. Rework to do what I believe the intention was; and, combine into one test (down from two) for readability. Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/system/030-run.bats35
1 files changed, 20 insertions, 15 deletions
diff --git a/test/system/030-run.bats b/test/system/030-run.bats
index b89c76981..98c65f788 100644
--- a/test/system/030-run.bats
+++ b/test/system/030-run.bats
@@ -136,21 +136,26 @@ echo $rand | 0 | $rand
run_podman rmi busybox
}
-# 'run --rmi' deletes the image in the end unless it's used by another container.
-@test "podman run --rmi - remove image" {
- skip_if_remote "podman-remote does not emit 'Trying to pull' msgs"
- run_podman 0 run --rmi --rm redis /bin/true
- run_podman 1 image exists redis
-}
-
-
-@test "podman run --rmi - not remove image" {
- skip_if_remote "podman-remote does not emit 'Trying to pull' msgs"
- run_podman run redis /bin/true
- run_podman images | grep redis
- run_podman run --rmi --rm redis /bin/true
- run_podman images | grep redis
- run_podman 0 rm -a
+# 'run --rmi' deletes the image in the end unless it's used by another container
+@test "podman run --rmi" {
+ skip_if_remote
+
+ # Name of a nonlocal image. It should be pulled in by the first 'run'
+ NONLOCAL_IMAGE=busybox
+ run_podman 1 image exists $NONLOCAL_IMAGE
+
+ # Run a container, without --rm; this should block subsequent --rmi
+ run_podman run --name keepme $NONLOCAL_IMAGE /bin/true
+ run_podman image exists $NONLOCAL_IMAGE
+
+ # Now try running with --rmi : it should succeed, but not remove the image
+ run_podman run --rmi --rm $NONLOCAL_IMAGE /bin/true
+ run_podman image exists $NONLOCAL_IMAGE
+
+ # Remove the stray container, and run one more time with --rmi.
+ run_podman rm keepme
+ run_podman run --rmi --rm $NONLOCAL_IMAGE /bin/true
+ run_podman 1 image exists $NONLOCAL_IMAGE
}
# vim: filetype=sh