mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
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:
parent
360fb3d4ea
commit
40630ce4b6
2 changed files with 20 additions and 19 deletions
|
@ -476,6 +476,26 @@ func TestBuildUser(t *testing.T) {
|
||||||
logDone("build - user")
|
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: TestCaching
|
||||||
|
|
||||||
// TODO: TestADDCacheInvalidation
|
// TODO: TestADDCacheInvalidation
|
||||||
|
|
|
@ -414,25 +414,6 @@ func buildImage(context testContextTemplate, t *testing.T, eng *engine.Engine, u
|
||||||
return image, err
|
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) {
|
func TestBuildEnv(t *testing.T) {
|
||||||
img, err := buildImage(testContextTemplate{`
|
img, err := buildImage(testContextTemplate{`
|
||||||
from {IMAGE}
|
from {IMAGE}
|
||||||
|
|
Loading…
Reference in a new issue