builder: add a test for `ENV name` (without `=value`)

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>

rewritten from github.com/moby/moby 09eca591f723f9acd0909b04144c229b6cd59912
docker-18.09
Akihiro Suda 2017-06-07 05:23:26 +00:00 committed by Tonis Tiigi
parent 1b72890ca2
commit a5bcc22c39
1 changed files with 8 additions and 0 deletions

View File

@ -64,3 +64,11 @@ func TestNodeFromLabels(t *testing.T) {
assert.Equal(t, expected, node)
}
func TestParseNameValWithoutVal(t *testing.T) {
directive := Directive{}
// In Config.Env, a variable without `=` is removed from the environment. (#31634)
// However, in Dockerfile, we don't allow "unsetting" an environment variable. (#11922)
_, err := parseNameVal("foo", "ENV", &directive)
assert.Error(t, err, "ENV must have two arguments")
}