summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-01-13 18:40:52 +0100
committerGitHub <noreply@github.com>2022-01-13 18:40:52 +0100
commit48e63975aac7f13048a4b2e426e36d2c81828d6d (patch)
tree580f2d30341d45c087c4d5a47392a325d97f5ce1 /test
parenteeb76db0fd0dc2a1115c2f2ad12c82eadbc62509 (diff)
parenta4cef543504600db95453aa863b97ed82c833d41 (diff)
downloadpodman-48e63975aac7f13048a4b2e426e36d2c81828d6d.tar.gz
podman-48e63975aac7f13048a4b2e426e36d2c81828d6d.tar.bz2
podman-48e63975aac7f13048a4b2e426e36d2c81828d6d.zip
Merge pull request #12826 from vrothberg/force-rm-pod
podman container rm: remove pod
Diffstat (limited to 'test')
-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