Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
| ... | ... |
@@ -1273,3 +1273,17 @@ func TestBuildFails(t *testing.T) {
|
| 1273 | 1273 |
} |
| 1274 | 1274 |
logDone("build - fails")
|
| 1275 | 1275 |
} |
| 1276 |
+ |
|
| 1277 |
+func TestBuildFailsDockerfileEmpty(t *testing.T) {
|
|
| 1278 |
+ name := "testbuildfails" |
|
| 1279 |
+ defer deleteImages(name) |
|
| 1280 |
+ _, err := buildImage(name, ``, true) |
|
| 1281 |
+ if err != nil {
|
|
| 1282 |
+ if !strings.Contains(err.Error(), "Dockerfile cannot be empty") {
|
|
| 1283 |
+ t.Fatalf("Wrong error %v, must be about empty Dockerfile", err)
|
|
| 1284 |
+ } |
|
| 1285 |
+ } else {
|
|
| 1286 |
+ t.Fatal("Error must not be nil")
|
|
| 1287 |
+ } |
|
| 1288 |
+ logDone("build - fails with empty dockerfile")
|
|
| 1289 |
+} |
| ... | ... |
@@ -413,14 +413,6 @@ func buildImage(context testContextTemplate, t *testing.T, eng *engine.Engine, u |
| 413 | 413 |
return image, err |
| 414 | 414 |
} |
| 415 | 415 |
|
| 416 |
-func TestBuildFailsDockerfileEmpty(t *testing.T) {
|
|
| 417 |
- _, err := buildImage(testContextTemplate{``, nil, nil}, t, nil, true)
|
|
| 418 |
- |
|
| 419 |
- if err != server.ErrDockerfileEmpty {
|
|
| 420 |
- t.Fatal("Expected: %v, got: %v", server.ErrDockerfileEmpty, err)
|
|
| 421 |
- } |
|
| 422 |
-} |
|
| 423 |
- |
|
| 424 | 416 |
func TestBuildOnBuildTrigger(t *testing.T) {
|
| 425 | 417 |
_, err := buildImage(testContextTemplate{`
|
| 426 | 418 |
from {IMAGE}
|