summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-05-10 11:43:40 -0400
committerGitHub <noreply@github.com>2021-05-10 11:43:40 -0400
commitfbc128ee93553d7f9fa9f665d6a3fe5b0b596e63 (patch)
tree74fb3dde23d26d19e676ebbf639d8b26ebf747a4 /test
parent446e5b300611ce576d5d3980fbf57fe3653b04a1 (diff)
parent77e6ae24369e6c7bed85141ae6f7d0c7b0e26c0b (diff)
downloadpodman-fbc128ee93553d7f9fa9f665d6a3fe5b0b596e63.tar.gz
podman-fbc128ee93553d7f9fa9f665d6a3fe5b0b596e63.tar.bz2
podman-fbc128ee93553d7f9fa9f665d6a3fe5b0b596e63.zip
Merge pull request #10236 from Luap99/generate-systemd-env
Add envars to the generated systemd unit
Diffstat (limited to 'test')
-rw-r--r--test/system/250-systemd.bats23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/system/250-systemd.bats b/test/system/250-systemd.bats
index b42769409..4ea192009 100644
--- a/test/system/250-systemd.bats
+++ b/test/system/250-systemd.bats
@@ -125,4 +125,27 @@ function service_cleanup() {
service_cleanup
}
+# These tests can fail in dev. environment because of SELinux.
+# quick fix: chcon -t container_runtime_exec_t ./bin/podman
+@test "podman generate systemd - envar" {
+ xdg_rootless
+
+ cname=$(random_string)
+ FOO=value BAR=%s run_podman create --name $cname --env FOO -e BAR --env MYVAR=myval \
+ $IMAGE sh -c 'printenv && sleep 100'
+
+ # Start systemd service to run this container
+ service_setup
+
+ # Give container time to start; make sure output looks top-like
+ sleep 2
+ run_podman logs $cname
+ is "$output" ".*FOO=value.*" "FOO environment variable set"
+ is "$output" ".*BAR=%s.*" "BAR environment variable set"
+ is "$output" ".*MYVAR=myval.*" "MYVAL environment variable set"
+
+ # All good. Stop service, clean up.
+ service_cleanup
+}
+
# vim: filetype=sh