summaryrefslogtreecommitdiff
path: root/test/system/200-pod.bats
diff options
context:
space:
mode:
Diffstat (limited to 'test/system/200-pod.bats')
-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