aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJosé Guilherme Vanz <jvanz@jvanz.com>2021-06-29 16:39:11 -0300
committerJosé Guilherme Vanz <jvanz@jvanz.com>2021-07-15 21:27:51 -0300
commitaf40dfc2bf614aeb4191916cc2420068696eb776 (patch)
treef7470681896508a28aa16095908a62709b6539b7 /test
parent12b67aaf62b6e99f94db7ea89dad87f16a9fbd86 (diff)
downloadpodman-af40dfc2bf614aeb4191916cc2420068696eb776.tar.gz
podman-af40dfc2bf614aeb4191916cc2420068696eb776.tar.bz2
podman-af40dfc2bf614aeb4191916cc2420068696eb776.zip
--infra-name command line argument
Adds the new --infra-name command line argument allowing users to define the name of the infra container Issue #10794 Signed-off-by: José Guilherme Vanz <jvanz@jvanz.com>
Diffstat (limited to 'test')
-rw-r--r--test/system/200-pod.bats17
1 files changed, 16 insertions, 1 deletions
diff --git a/test/system/200-pod.bats b/test/system/200-pod.bats
index 054eda908..266f91298 100644
--- a/test/system/200-pod.bats
+++ b/test/system/200-pod.bats
@@ -205,6 +205,7 @@ function random_ip() {
# entrypoint to confirm that --infra-command will override.
local infra_image="infra_$(random_string 10 | tr A-Z a-z)"
local infra_command="/pause_$(random_string 10)"
+ local infra_name="infra_container_$(random_string 10 | tr A-Z a-z)"
run_podman build -t $infra_image - << EOF
FROM $IMAGE
RUN ln /home/podman/pause $infra_command
@@ -225,7 +226,8 @@ EOF
--publish "$port_out:$port_in" \
--label "${labelname}=${labelvalue}" \
--infra-image "$infra_image" \
- --infra-command "$infra_command"
+ --infra-command "$infra_command" \
+ --infra-name "$infra_name"
pod_id="$output"
# Check --pod-id-file
@@ -237,6 +239,9 @@ EOF
# confirm that entrypoint is what we set
run_podman container inspect --format '{{.Config.Entrypoint}}' $infra_cid
is "$output" "$infra_command" "infra-command took effect"
+ # confirm that infra container name is set
+ run_podman container inspect --format '{{.Name}}' $infra_cid
+ is "$output" "$infra_name" "infra-name took effect"
# Check each of the options
if [ -n "$mac_option" ]; then
@@ -310,6 +315,16 @@ EOF
run_podman rm $cid
run_podman pod rm -f mypod
run_podman rmi $infra_image
+
+}
+
+@test "podman pod create should fail when infra-name is already in use" {
+ local infra_name="infra_container_$(random_string 10 | tr A-Z a-z)"
+ run_podman pod create --infra-name "$infra_name"
+ run_podman '?' pod create --infra-name "$infra_name"
+ if [ $status -eq 0 ]; then
+ die "Podman should fail when user try to create two pods with the same infra-name value"
+ fi
}
# vim: filetype=sh