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:
Tianon Gravi 2014-03-17 19:26:08 -06:00
Родитель 054b85a7b2
Коммит c1f492755b
1 изменённых файлов: 7 добавлений и 5 удалений

Просмотреть файл

@ -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)
}
}