aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-07-28 21:31:34 +0200
committerGitHub <noreply@github.com>2022-07-28 21:31:34 +0200
commita43cfc1b1adb91ef448bcbb8a4aab65477749567 (patch)
treebb25d141b32e6f5650c7567e87ffce43a8d46395 /test
parent509ad4280fef8773825fcbd6e5f8927f2b421f32 (diff)
parentde13dea86347eb5eaebe88d4a10eb4ef2622e738 (diff)
downloadpodman-a43cfc1b1adb91ef448bcbb8a4aab65477749567.tar.gz
podman-a43cfc1b1adb91ef448bcbb8a4aab65477749567.tar.bz2
podman-a43cfc1b1adb91ef448bcbb8a4aab65477749567.zip
Merge pull request #15060 from rhatdan/rm1
With --rm option remove container if podman run fails
Diffstat (limited to 'test')
-rw-r--r--test/system/030-run.bats16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/system/030-run.bats b/test/system/030-run.bats
index d028a5ac7..908c169ee 100644
--- a/test/system/030-run.bats
+++ b/test/system/030-run.bats
@@ -871,4 +871,20 @@ EOF
run_podman container rm -fa
}
+@test "podman run failed --rm " {
+ port=$(random_free_port)
+
+ # Run two containers with the same port bindings. The second must fail
+ run_podman run -p $port:80 --rm -d --name c_ok $IMAGE top
+ run_podman 126 run -p $port:80 -d --name c_fail_no_rm $IMAGE top
+ run_podman 126 run -p $port:80 --rm -d --name c_fail_with_rm $IMAGE top
+ # Prior to #15060, the third container would still show up in ps -a
+ run_podman ps -a --sort names --format '{{.Image}}--{{.Names}}'
+ is "$output" "$IMAGE--c_fail_no_rm
+$IMAGE--c_ok" \
+ "podman ps -a shows running & failed containers, but not failed-with-rm"
+
+ run_podman container rm -f -t 0 c_ok c_fail_no_rm
+}
+
# vim: filetype=sh