зеркало из https://github.com/microsoft/docker.git
Move relative workdir build test to integration-cli
Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
This commit is contained in:
Родитель
360fb3d4ea
Коммит
40630ce4b6
|
@ -476,6 +476,26 @@ func TestBuildUser(t *testing.T) {
|
|||
logDone("build - user")
|
||||
}
|
||||
|
||||
func TestBuildRelativeWorkdir(t *testing.T) {
|
||||
checkSimpleBuild(t,
|
||||
`
|
||||
FROM busybox
|
||||
RUN [ "$PWD" = '/' ]
|
||||
WORKDIR test1
|
||||
RUN [ "$PWD" = '/test1' ]
|
||||
WORKDIR /test2
|
||||
RUN [ "$PWD" = '/test2' ]
|
||||
WORKDIR test3
|
||||
RUN [ "$PWD" = '/test2/test3' ]
|
||||
`,
|
||||
"testbuildimg",
|
||||
"{{json .config.WorkingDir}}",
|
||||
`"/test2/test3"`)
|
||||
|
||||
deleteImages("testbuildimg")
|
||||
logDone("build - relative workdir")
|
||||
}
|
||||
|
||||
// TODO: TestCaching
|
||||
|
||||
// TODO: TestADDCacheInvalidation
|
||||
|
|
|
@ -414,25 +414,6 @@ func buildImage(context testContextTemplate, t *testing.T, eng *engine.Engine, u
|
|||
return image, err
|
||||
}
|
||||
|
||||
func TestBuildRelativeWorkdir(t *testing.T) {
|
||||
img, err := buildImage(testContextTemplate{`
|
||||
FROM {IMAGE}
|
||||
RUN [ "$PWD" = '/' ]
|
||||
WORKDIR test1
|
||||
RUN [ "$PWD" = '/test1' ]
|
||||
WORKDIR /test2
|
||||
RUN [ "$PWD" = '/test2' ]
|
||||
WORKDIR test3
|
||||
RUN [ "$PWD" = '/test2/test3' ]
|
||||
`, nil, nil}, t, nil, true)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if img.Config.WorkingDir != "/test2/test3" {
|
||||
t.Fatalf("Expected workdir to be '/test2/test3', received '%s'", img.Config.WorkingDir)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildEnv(t *testing.T) {
|
||||
img, err := buildImage(testContextTemplate{`
|
||||
from {IMAGE}
|
||||
|
|
Загрузка…
Ссылка в новой задаче