mirror of
https://github.com/moby/moby.git
synced 2025-08-01 05:47:11 +03:00
Move env build test to integration-cli
Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
This commit is contained in:
@ -496,6 +496,21 @@ func TestBuildRelativeWorkdir(t *testing.T) {
|
|||||||
logDone("build - relative workdir")
|
logDone("build - relative workdir")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestBuildEnv(t *testing.T) {
|
||||||
|
checkSimpleBuild(t,
|
||||||
|
`
|
||||||
|
FROM busybox
|
||||||
|
ENV PORT 4243
|
||||||
|
RUN [ $(env | grep PORT) = 'PORT=4243' ]
|
||||||
|
`,
|
||||||
|
"testbuildimg",
|
||||||
|
"{{json .config.Env}}",
|
||||||
|
`["HOME=/","PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","PORT=4243"]`)
|
||||||
|
|
||||||
|
deleteImages("testbuildimg")
|
||||||
|
logDone("build - env")
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: TestCaching
|
// TODO: TestCaching
|
||||||
|
|
||||||
// TODO: TestADDCacheInvalidation
|
// TODO: TestADDCacheInvalidation
|
||||||
|
@ -414,28 +414,6 @@ func buildImage(context testContextTemplate, t *testing.T, eng *engine.Engine, u
|
|||||||
return image, err
|
return image, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBuildEnv(t *testing.T) {
|
|
||||||
img, err := buildImage(testContextTemplate{`
|
|
||||||
from {IMAGE}
|
|
||||||
env port 4243
|
|
||||||
`,
|
|
||||||
nil, nil}, t, nil, true)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
hasEnv := false
|
|
||||||
for _, envVar := range img.Config.Env {
|
|
||||||
if envVar == "port=4243" {
|
|
||||||
hasEnv = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !hasEnv {
|
|
||||||
t.Fail()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestBuildCmd(t *testing.T) {
|
func TestBuildCmd(t *testing.T) {
|
||||||
img, err := buildImage(testContextTemplate{`
|
img, err := buildImage(testContextTemplate{`
|
||||||
from {IMAGE}
|
from {IMAGE}
|
||||||
|
Reference in New Issue
Block a user