зеркало из https://github.com/microsoft/docker.git
Move TestBuildFails to integration-cli
Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
This commit is contained in:
Родитель
f1d7ed35bd
Коммит
d3023f25f5
|
@ -1256,3 +1256,20 @@ func TestBuildInheritance(t *testing.T) {
|
|||
}
|
||||
logDone("build - inheritance")
|
||||
}
|
||||
|
||||
func TestBuildFails(t *testing.T) {
|
||||
name := "testbuildfails"
|
||||
defer deleteImages(name)
|
||||
_, err := buildImage(name,
|
||||
`FROM busybox
|
||||
RUN sh -c "exit 23"`,
|
||||
true)
|
||||
if err != nil {
|
||||
if !strings.Contains(err.Error(), "returned a non-zero code: 23") {
|
||||
t.Fatalf("Wrong error %v, must be about non-zero code 23", err)
|
||||
}
|
||||
} else {
|
||||
t.Fatal("Error must not be nil")
|
||||
}
|
||||
logDone("build - fails")
|
||||
}
|
||||
|
|
|
@ -413,26 +413,6 @@ func buildImage(context testContextTemplate, t *testing.T, eng *engine.Engine, u
|
|||
return image, err
|
||||
}
|
||||
|
||||
func TestBuildFails(t *testing.T) {
|
||||
_, err := buildImage(testContextTemplate{`
|
||||
from {IMAGE}
|
||||
run sh -c "exit 23"
|
||||
`,
|
||||
nil, nil}, t, nil, true)
|
||||
|
||||
if err == nil {
|
||||
t.Fatal("Error should not be nil")
|
||||
}
|
||||
|
||||
sterr, ok := err.(*utils.JSONError)
|
||||
if !ok {
|
||||
t.Fatalf("Error should be utils.JSONError")
|
||||
}
|
||||
if sterr.Code != 23 {
|
||||
t.Fatalf("StatusCode %d unexpected, should be 23", sterr.Code)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildFailsDockerfileEmpty(t *testing.T) {
|
||||
_, err := buildImage(testContextTemplate{``, nil, nil}, t, nil, true)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче