Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
Alexandr Morozov authored on 2014/06/17 16:14:45... | ... |
@@ -1287,3 +1287,23 @@ func TestBuildFailsDockerfileEmpty(t *testing.T) { |
1287 | 1287 |
} |
1288 | 1288 |
logDone("build - fails with empty dockerfile") |
1289 | 1289 |
} |
1290 |
+ |
|
1291 |
+func TestBuildOnBuild(t *testing.T) { |
|
1292 |
+ name := "testbuildonbuild" |
|
1293 |
+ defer deleteImages(name) |
|
1294 |
+ _, err := buildImage(name, |
|
1295 |
+ `FROM busybox |
|
1296 |
+ ONBUILD RUN touch foobar`, |
|
1297 |
+ true) |
|
1298 |
+ if err != nil { |
|
1299 |
+ t.Fatal(err) |
|
1300 |
+ } |
|
1301 |
+ _, err = buildImage(name, |
|
1302 |
+ fmt.Sprintf(`FROM %s |
|
1303 |
+ RUN [ -f foobar ]`, name), |
|
1304 |
+ true) |
|
1305 |
+ if err != nil { |
|
1306 |
+ t.Fatal(err) |
|
1307 |
+ } |
|
1308 |
+ logDone("build - onbuild") |
|
1309 |
+} |
... | ... |
@@ -413,22 +413,6 @@ func buildImage(context testContextTemplate, t *testing.T, eng *engine.Engine, u |
413 | 413 |
return image, err |
414 | 414 |
} |
415 | 415 |
|
416 |
-func TestBuildOnBuildTrigger(t *testing.T) { |
|
417 |
- _, err := buildImage(testContextTemplate{` |
|
418 |
- from {IMAGE} |
|
419 |
- onbuild run echo here is the trigger |
|
420 |
- onbuild run touch foobar |
|
421 |
- `, |
|
422 |
- nil, nil, |
|
423 |
- }, |
|
424 |
- t, nil, true, |
|
425 |
- ) |
|
426 |
- if err != nil { |
|
427 |
- t.Fatal(err) |
|
428 |
- } |
|
429 |
- // FIXME: test that the 'foobar' file was created in the final build. |
|
430 |
-} |
|
431 |
- |
|
432 | 416 |
func TestBuildOnBuildForbiddenChainedTrigger(t *testing.T) { |
433 | 417 |
_, err := buildImage(testContextTemplate{` |
434 | 418 |
from {IMAGE} |