Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
| ... | ... |
@@ -511,6 +511,20 @@ func TestBuildEnv(t *testing.T) {
|
| 511 | 511 |
logDone("build - env")
|
| 512 | 512 |
} |
| 513 | 513 |
|
| 514 |
+func TestBuildCmd(t *testing.T) {
|
|
| 515 |
+ checkSimpleBuild(t, |
|
| 516 |
+ ` |
|
| 517 |
+ FROM scratch |
|
| 518 |
+ CMD ["/bin/echo", "Hello World"] |
|
| 519 |
+ `, |
|
| 520 |
+ "testbuildimg", |
|
| 521 |
+ "{{json .config.Cmd}}",
|
|
| 522 |
+ `["/bin/echo","Hello World"]`) |
|
| 523 |
+ |
|
| 524 |
+ deleteImages("testbuildimg")
|
|
| 525 |
+ logDone("build - cmd")
|
|
| 526 |
+} |
|
| 527 |
+ |
|
| 514 | 528 |
// TODO: TestCaching |
| 515 | 529 |
|
| 516 | 530 |
// TODO: TestADDCacheInvalidation |
| ... | ... |
@@ -414,26 +414,6 @@ func buildImage(context testContextTemplate, t *testing.T, eng *engine.Engine, u |
| 414 | 414 |
return image, err |
| 415 | 415 |
} |
| 416 | 416 |
|
| 417 |
-func TestBuildCmd(t *testing.T) {
|
|
| 418 |
- img, err := buildImage(testContextTemplate{`
|
|
| 419 |
- from {IMAGE}
|
|
| 420 |
- cmd ["/bin/echo", "Hello World"] |
|
| 421 |
- `, |
|
| 422 |
- nil, nil}, t, nil, true) |
|
| 423 |
- if err != nil {
|
|
| 424 |
- t.Fatal(err) |
|
| 425 |
- } |
|
| 426 |
- |
|
| 427 |
- if img.Config.Cmd[0] != "/bin/echo" {
|
|
| 428 |
- t.Log(img.Config.Cmd[0]) |
|
| 429 |
- t.Fail() |
|
| 430 |
- } |
|
| 431 |
- if img.Config.Cmd[1] != "Hello World" {
|
|
| 432 |
- t.Log(img.Config.Cmd[1]) |
|
| 433 |
- t.Fail() |
|
| 434 |
- } |
|
| 435 |
-} |
|
| 436 |
- |
|
| 437 | 417 |
func TestBuildExpose(t *testing.T) {
|
| 438 | 418 |
img, err := buildImage(testContextTemplate{`
|
| 439 | 419 |
from {IMAGE}
|