diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-09-25 16:06:07 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-25 16:06:07 +0000 |
commit | b9d77796c0e011e6337f5c173bb633ebcae863f9 (patch) | |
tree | 4080d9269f8ca07b3e079e64dfc1f1fdb3b1e22b /test/system/200-pod.bats | |
parent | 2583246a17e40af3a3227f24daeb7b081f1c3d55 (diff) | |
parent | bd3c66fc8151350ad6562959054eddb5508cf028 (diff) | |
download | podman-b9d77796c0e011e6337f5c173bb633ebcae863f9.tar.gz podman-b9d77796c0e011e6337f5c173bb633ebcae863f9.tar.bz2 podman-b9d77796c0e011e6337f5c173bb633ebcae863f9.zip |
Merge pull request #7687 from edsantiago/bats
system tests: new tests
Diffstat (limited to 'test/system/200-pod.bats')
-rw-r--r-- | test/system/200-pod.bats | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/test/system/200-pod.bats b/test/system/200-pod.bats index 7189d7e4b..2ae038dfe 100644 --- a/test/system/200-pod.bats +++ b/test/system/200-pod.bats @@ -173,6 +173,19 @@ function random_ip() { # FIXME: --ip=$ip fails: # Error adding network: failed to allocate all requested IPs local mac_option="--mac-address=$mac" + + # Create a custom image so we can test --infra-image and -command. + # It will have a randomly generated infra command, using the + # existing 'pause' script in our testimage. We assign a bogus + # 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)" + run_podman build -t $infra_image - << EOF +FROM $IMAGE +RUN ln /home/podman/pause $infra_command +ENTRYPOINT ["/original-entrypoint-should-be-overridden"] +EOF + if is_rootless; then mac_option= fi @@ -185,12 +198,21 @@ function random_ip() { --dns-search "$dns_search" \ --dns-opt "$dns_opt" \ --publish "$port_out:$port_in" \ - --label "${labelname}=${labelvalue}" + --label "${labelname}=${labelvalue}" \ + --infra-image "$infra_image" \ + --infra-command "$infra_command" pod_id="$output" # Check --pod-id-file is "$(<$pod_id_file)" "$pod_id" "contents of pod-id-file" + # Get ID of infra container + run_podman pod inspect --format '{{(index .Containers 0).ID}}' mypod + local infra_cid="$output" + # confirm that entrypoint is what we set + run_podman container inspect --format '{{.Config.Entrypoint}}' $infra_cid + is "$output" "$infra_command" "infra-command took effect" + # Check each of the options if [ -n "$mac_option" ]; then run_podman run --rm --pod mypod $IMAGE ip link show @@ -249,9 +271,16 @@ function random_ip() { run_podman logs $cid is "$output" "$teststring" "test string received on container" + # Finally, confirm the infra-container and -command. We run this late, + # not at pod creation, to give the infra container time to start & log. + run_podman logs $infra_cid + is "$output" "Confirmed: testimage pause invoked as $infra_command" \ + "pod ran with our desired infra container + command" + # Clean up run_podman rm $cid run_podman pod rm -f mypod + run_podman rmi $infra_image } # vim: filetype=sh |