Merge pull request #31991 from tonistiigi/add-build-arg-testcase

Add testcase for build arg without value
This commit is contained in:
Vincent Demeester 2017-03-22 09:55:45 +01:00 committed by GitHub
commit 2b478686be

View file

@ -4641,6 +4641,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgEnv(c *check.C) {
ARG FOO4=fromfile
ARG FOO5
ARG FOO6
ARG FO10
RUN env
RUN [ "$FOO1" == "fromcmd" ]
RUN [ "$FOO2" == "" ]
@ -4652,6 +4653,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgEnv(c *check.C) {
RUN [ "$(env | grep FOO7)" == "" ]
RUN [ "$(env | grep FOO8)" == "" ]
RUN [ "$(env | grep FOO9)" == "" ]
RUN [ "$FO10" == "" ]
`
result := buildImage("testbuildtimeargenv",
withBuildFlags(
@ -4664,6 +4666,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgEnv(c *check.C) {
"--build-arg", fmt.Sprintf("FOO7=fromcmd"), // should produce a warning
"--build-arg", fmt.Sprintf("FOO8="), // should produce a warning
"--build-arg", fmt.Sprintf("FOO9"), // should produce a warning
"--build-arg", fmt.Sprintf("FO10"), // not set in env, empty value
),
withEnvironmentVariales(append(os.Environ(),
"FOO1=fromenv",