aboutsummaryrefslogtreecommitdiff
path: root/test/system
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2022-01-12 15:33:00 +0100
committerValentin Rothberg <rothberg@redhat.com>2022-01-13 17:08:31 +0100
commita4cef543504600db95453aa863b97ed82c833d41 (patch)
treea48d511c9a677f3a2b1f5f84769910baea53f6fe /test/system
parentab7228b3c27719e447de4dffe9b3fd7f67d6f346 (diff)
downloadpodman-a4cef543504600db95453aa863b97ed82c833d41.tar.gz
podman-a4cef543504600db95453aa863b97ed82c833d41.tar.bz2
podman-a4cef543504600db95453aa863b97ed82c833d41.zip
podman container rm: remove pod
Support removing the entire pod when --depend is used on an infra container. --all now implies --depend to properly support removing all containers and not error out when hitting infra containers. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'test/system')
-rw-r--r--test/system/200-pod.bats34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/system/200-pod.bats b/test/system/200-pod.bats
index 4a3337e57..51fcea104 100644
--- a/test/system/200-pod.bats
+++ b/test/system/200-pod.bats
@@ -362,4 +362,38 @@ EOF
run_podman run --rm --pod "new:$pod_name" $IMAGE hostname
is "$output" "$pod_name" "new:POD should have hostname name set to podname"
}
+
+@test "podman rm --force to remove infra container" {
+ local pod_name="$(random_string 10 | tr A-Z a-z)"
+ run_podman create --pod "new:$pod_name" $IMAGE
+ container_ID="$output"
+ run_podman pod inspect --format "{{.InfraContainerID}}" $pod_name
+ infra_ID="$output"
+
+ run_podman 125 container rm $infra_ID
+ is "$output" ".* and cannot be removed without removing the pod"
+ run_podman 125 container rm --force $infra_ID
+ is "$output" ".* and cannot be removed without removing the pod"
+
+ run_podman container rm --depend $infra_ID
+ is "$output" ".*$infra_ID.*"
+ is "$output" ".*$container_ID.*"
+
+ # Now make sure that --force --all works as well
+ run_podman create --pod "new:$pod_name" $IMAGE
+ container_1_ID="$output"
+ run_podman create --pod "$pod_name" $IMAGE
+ container_2_ID="$output"
+ run_podman create $IMAGE
+ container_3_ID="$output"
+ run_podman pod inspect --format "{{.InfraContainerID}}" $pod_name
+ infra_ID="$output"
+
+ run_podman container rm --force --all $infraID
+ is "$output" ".*$infra_ID.*"
+ is "$output" ".*$container_1_ID.*"
+ is "$output" ".*$container_2_ID.*"
+ is "$output" ".*$container_3_ID.*"
+}
+
# vim: filetype=sh