summaryrefslogtreecommitdiff
path: root/test/system/200-pod.bats
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2020-09-16 10:06:33 -0600
committerEd Santiago <santiago@redhat.com>2020-09-19 15:55:00 -0600
commitbd3c66fc8151350ad6562959054eddb5508cf028 (patch)
tree487c34a3af99796784538929d8cc61a536a07622 /test/system/200-pod.bats
parent852943516606f32ccc2406f41bcf3df42d7c622c (diff)
downloadpodman-bd3c66fc8151350ad6562959054eddb5508cf028.tar.gz
podman-bd3c66fc8151350ad6562959054eddb5508cf028.tar.bz2
podman-bd3c66fc8151350ad6562959054eddb5508cf028.zip
system tests: new tests
- podman network create: new test - podman pull by-sha + podman images -a (#7651) - podman image mount: new test - podman pod: --infra-image and --infra-command (#7167) For convenience and robustness, build a new testimage containing a custom file /home/podman/testimage-id with contents YYYYMMDD (same as image tag). The image-mount test checks that this file exists and has the desired content. New testimage also includes a dummy 'pause' executable, for testing pod infra. Updates from testimage:20200902 to :20200917 Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/system/200-pod.bats')
-rw-r--r--test/system/200-pod.bats31
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