From af40dfc2bf614aeb4191916cc2420068696eb776 Mon Sep 17 00:00:00 2001 From: José Guilherme Vanz Date: Tue, 29 Jun 2021 16:39:11 -0300 Subject: --infra-name command line argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- test/system/200-pod.bats | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'test/system') 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 -- cgit v1.2.3-54-g00ecf