Browse Source

Move TestBuildFails to integration-cli

Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
Alexandr Morozov 11 years ago
parent
commit
d3023f25f5
2 changed files with 17 additions and 20 deletions
  1. 17 0
      integration-cli/docker_cli_build_test.go
  2. 0 20
      integration/buildfile_test.go

+ 17 - 0
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")
+}

+ 0 - 20
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)