diff --git a/integration-cli/docker_cli_build_test.go b/integration-cli/docker_cli_build_test.go index 98eee5807c..8b46357a80 100644 --- a/integration-cli/docker_cli_build_test.go +++ b/integration-cli/docker_cli_build_test.go @@ -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") +} diff --git a/integration/buildfile_test.go b/integration/buildfile_test.go index 4a14076942..833d2b6789 100644 --- a/integration/buildfile_test.go +++ b/integration/buildfile_test.go @@ -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)