api: clarify that Env var without = is removed from the environment

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Upstream-commit: 1921fad6f516a1d45e18054745eb1d2b03aaf665
Component: engine
This commit is contained in:
Akihiro Suda
2017-03-08 04:27:25 +00:00
parent bca52758a3
commit 173cafe0e6
2 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -741,7 +741,7 @@ definitions:
default: false
Env:
description: |
A list of environment variables to set inside the container in the form `["VAR=value", ...]`
A list of environment variables to set inside the container in the form `["VAR=value", ...]`. A variable without `=` is removed from the environment, rather than to have an empty value.
type: "array"
items:
type: "string"
+5 -2
View File
@@ -4,11 +4,14 @@ import "testing"
func TestReplaceAndAppendEnvVars(t *testing.T) {
var (
d = []string{"HOME=/"}
o = []string{"HOME=/root", "TERM=xterm"}
d = []string{"HOME=/", "FOO=foo_default"}
// remove FOO from env
// remove BAR from env (nop)
o = []string{"HOME=/root", "TERM=xterm", "FOO", "BAR"}
)
env := ReplaceOrAppendEnvValues(d, o)
t.Logf("default=%v, override=%v, result=%v", d, o, env)
if len(env) != 2 {
t.Fatalf("expected len of 2 got %d", len(env))
}