mirror of
https://github.com/containers/podman.git
synced 2025-06-21 17:38:12 +08:00
add test for podman exec --env-file
There was no test for this option, resuse existing podman run --env-file test for exec as well. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -100,7 +100,7 @@ function _check_env {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@test "podman run --env-file" {
|
@test "podman run/exec --env-file" {
|
||||||
declare -A expect=(
|
declare -A expect=(
|
||||||
[simple]="abc"
|
[simple]="abc"
|
||||||
[special]="bcd#e!f|g hij=lmnop"
|
[special]="bcd#e!f|g hij=lmnop"
|
||||||
@ -116,7 +116,7 @@ function _check_env {
|
|||||||
|
|
||||||
# Write two files, so we confirm that podman can accept multiple values
|
# Write two files, so we confirm that podman can accept multiple values
|
||||||
# and that the second will override the first
|
# and that the second will override the first
|
||||||
local envfile1="$PODMAN_TMPDIR/envfile-in-1"
|
local envfile1="$PODMAN_TMPDIR/envfile-in-1,withcomma"
|
||||||
local envfile2="$PODMAN_TMPDIR/envfile-in-2"
|
local envfile2="$PODMAN_TMPDIR/envfile-in-2"
|
||||||
cat >$envfile1 <<EOF
|
cat >$envfile1 <<EOF
|
||||||
infile2=this is set in env-file-1 and should be overridden in env-file-2
|
infile2=this is set in env-file-1 and should be overridden in env-file-2
|
||||||
@ -158,6 +158,19 @@ EOF
|
|||||||
expect[weird*na#me!]=$weirdname
|
expect[weird*na#me!]=$weirdname
|
||||||
|
|
||||||
_check_env $resultsfile
|
_check_env $resultsfile
|
||||||
|
|
||||||
|
# Now check the same with podman exec
|
||||||
|
run_podman run -d --name testctr \
|
||||||
|
-v "$resultsfile:/envresults:Z" \
|
||||||
|
$IMAGE top
|
||||||
|
|
||||||
|
run_podman exec --env-file $envfile1 \
|
||||||
|
--env-file $envfile2 testctr \
|
||||||
|
sh -c 'env -0 >/envresults'
|
||||||
|
|
||||||
|
_check_env $resultsfile
|
||||||
|
|
||||||
|
run_podman rm -f -t0 testctr
|
||||||
}
|
}
|
||||||
|
|
||||||
# Obscure feature: '--env FOO*' will pass all env starting with FOO
|
# Obscure feature: '--env FOO*' will pass all env starting with FOO
|
||||||
|
Reference in New Issue
Block a user