| ... | ... |
@@ -328,6 +328,40 @@ func TestBuildEntrypoint(t *testing.T) {
|
| 328 | 328 |
} |
| 329 | 329 |
} |
| 330 | 330 |
|
| 331 |
+// testing #1405 - config.Cmd does not get cleaned up if |
|
| 332 |
+// utilizing cache |
|
| 333 |
+func TestBuildEntrypointRunCleanup(t *testing.T) {
|
|
| 334 |
+ runtime, err := newTestRuntime() |
|
| 335 |
+ if err != nil {
|
|
| 336 |
+ t.Fatal(err) |
|
| 337 |
+ } |
|
| 338 |
+ defer nuke(runtime) |
|
| 339 |
+ |
|
| 340 |
+ srv := &Server{
|
|
| 341 |
+ runtime: runtime, |
|
| 342 |
+ pullingPool: make(map[string]struct{}),
|
|
| 343 |
+ pushingPool: make(map[string]struct{}),
|
|
| 344 |
+ } |
|
| 345 |
+ |
|
| 346 |
+ img := buildImage(testContextTemplate{`
|
|
| 347 |
+ from {IMAGE}
|
|
| 348 |
+ run echo "hello" |
|
| 349 |
+ `, |
|
| 350 |
+ nil, nil}, t, srv, true) |
|
| 351 |
+ |
|
| 352 |
+ img = buildImage(testContextTemplate{`
|
|
| 353 |
+ from {IMAGE}
|
|
| 354 |
+ run echo "hello" |
|
| 355 |
+ add foo /foo |
|
| 356 |
+ entrypoint ["/bin/echo"] |
|
| 357 |
+ `, |
|
| 358 |
+ [][2]string{{"foo", "HEYO"}}, nil}, t, srv, true)
|
|
| 359 |
+ |
|
| 360 |
+ if len(img.Config.Cmd) != 0 {
|
|
| 361 |
+ t.Fail() |
|
| 362 |
+ } |
|
| 363 |
+} |
|
| 364 |
+ |
|
| 331 | 365 |
func TestBuildImageWithCache(t *testing.T) {
|
| 332 | 366 |
runtime, err := newTestRuntime() |
| 333 | 367 |
if err != nil {
|
| ... | ... |
@@ -996,6 +996,28 @@ func TestEntrypoint(t *testing.T) {
|
| 996 | 996 |
} |
| 997 | 997 |
} |
| 998 | 998 |
|
| 999 |
+func TestEntrypointNoCmd(t *testing.T) {
|
|
| 1000 |
+ runtime := mkRuntime(t) |
|
| 1001 |
+ defer nuke(runtime) |
|
| 1002 |
+ container, err := NewBuilder(runtime).Create( |
|
| 1003 |
+ &Config{
|
|
| 1004 |
+ Image: GetTestImage(runtime).ID, |
|
| 1005 |
+ Entrypoint: []string{"/bin/echo", "foobar"},
|
|
| 1006 |
+ }, |
|
| 1007 |
+ ) |
|
| 1008 |
+ if err != nil {
|
|
| 1009 |
+ t.Fatal(err) |
|
| 1010 |
+ } |
|
| 1011 |
+ defer runtime.Destroy(container) |
|
| 1012 |
+ output, err := container.Output() |
|
| 1013 |
+ if err != nil {
|
|
| 1014 |
+ t.Fatal(err) |
|
| 1015 |
+ } |
|
| 1016 |
+ if strings.Trim(string(output), "\r\n") != "foobar" {
|
|
| 1017 |
+ t.Error(string(output)) |
|
| 1018 |
+ } |
|
| 1019 |
+} |
|
| 1020 |
+ |
|
| 999 | 1021 |
func grepFile(t *testing.T, path string, pattern string) {
|
| 1000 | 1022 |
f, err := os.Open(path) |
| 1001 | 1023 |
if err != nil {
|