summaryrefslogtreecommitdiff
path: root/test/system/250-systemd.bats
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-08-31 14:46:10 -0400
committerGitHub <noreply@github.com>2021-08-31 14:46:10 -0400
commitf947ea2d5fc84ac579d4bb13a66fb699500da7f4 (patch)
tree0b9db1b2da78eaf53ddfee4f973798eb8939bb72 /test/system/250-systemd.bats
parent8ab84b437352bf2b3653fe92fbfa60a59b980a93 (diff)
parent10144b707ece4533e332a18fbb6ae7ca23d771ac (diff)
downloadpodman-f947ea2d5fc84ac579d4bb13a66fb699500da7f4.tar.gz
podman-f947ea2d5fc84ac579d4bb13a66fb699500da7f4.tar.bz2
podman-f947ea2d5fc84ac579d4bb13a66fb699500da7f4.zip
Merge pull request #11316 from vrothberg/fix-10443
pass LISTEN_* environment into container
Diffstat (limited to 'test/system/250-systemd.bats')
-rw-r--r--test/system/250-systemd.bats42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/system/250-systemd.bats b/test/system/250-systemd.bats
index 5d4ae4cb1..08fad5e7c 100644
--- a/test/system/250-systemd.bats
+++ b/test/system/250-systemd.bats
@@ -136,4 +136,46 @@ function service_cleanup() {
service_cleanup
}
+function set_listen_env() {
+ export LISTEN_PID="100" LISTEN_FDS="1" LISTEN_FDNAMES="listen_fdnames"
+}
+
+function unset_listen_env() {
+ unset LISTEN_PID LISTEN_FDS LISTEN_FDNAMES
+}
+
+function check_listen_env() {
+ local stdenv="$1"
+ local context="$2"
+ if is_remote; then
+ is "$output" "$stdenv" "LISTEN Environment did not pass: $context"
+ else
+ is "$output" "$stdenv
+LISTEN_PID=1
+LISTEN_FDS=1
+LISTEN_FDNAMES=listen_fdnames" "LISTEN Environment passed: $context"
+ fi
+}
+
+@test "podman pass LISTEN environment " {
+ # Note that `--hostname=host1` makes sure that all containers have the same
+ # environment.
+ run_podman run --hostname=host1 --rm $IMAGE printenv
+ stdenv=$output
+
+ # podman run
+ set_listen_env
+ run_podman run --hostname=host1 --rm $IMAGE printenv
+ unset_listen_env
+ check_listen_env "$stdenv" "podman run"
+
+ # podman start
+ run_podman create --hostname=host1 --rm $IMAGE printenv
+ cid="$output"
+ set_listen_env
+ run_podman start --attach $cid
+ unset_listen_env
+ check_listen_env "$stdenv" "podman start"
+}
+
# vim: filetype=sh