mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Improve WORKDIR test to cover more edge cases
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
This commit is contained in:
parent
054b85a7b2
commit
c1f492755b
1 changed files with 7 additions and 5 deletions
|
@ -445,16 +445,18 @@ func TestBuildRelativeWorkdir(t *testing.T) {
|
|||
img, err := buildImage(testContextTemplate{`
|
||||
FROM {IMAGE}
|
||||
RUN [ "$PWD" = '/' ]
|
||||
WORKDIR /test1
|
||||
WORKDIR test1
|
||||
RUN [ "$PWD" = '/test1' ]
|
||||
WORKDIR test2
|
||||
RUN [ "$PWD" = '/test1/test2' ]
|
||||
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 != "/test1/test2" {
|
||||
t.Fail()
|
||||
if img.Config.WorkingDir != "/test2/test3" {
|
||||
t.Fatalf("Expected workdir to be '/test2/test3', received '%s'", img.Config.WorkingDir)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue