From 52a61b3af66409d5cd801e95e9d1151071d55c07 Mon Sep 17 00:00:00 2001 From: "Daniel, Dao Quang Minh" Date: Wed, 12 Nov 2014 09:13:47 -0500 Subject: [PATCH] add a test case for EXPOSE ports order changing order of EXPOSE ports should not invalidate the cache as the content doesnt change Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh (github: dqminh) Upstream-commit: 1e7ba09b60aa0bc527dc7e0159071a6d47796de4 Component: engine --- .../integration-cli/docker_cli_build_test.go | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/components/engine/integration-cli/docker_cli_build_test.go b/components/engine/integration-cli/docker_cli_build_test.go index de60a8017f..1f23c85162 100644 --- a/components/engine/integration-cli/docker_cli_build_test.go +++ b/components/engine/integration-cli/docker_cli_build_test.go @@ -1732,6 +1732,29 @@ func TestBuildExpose(t *testing.T) { logDone("build - expose") } +func TestBuildExposeOrder(t *testing.T) { + buildID := func(name, exposed string) string { + _, err := buildImage(name, fmt.Sprintf(`FROM scratch + EXPOSE %s`, exposed), true) + if err != nil { + t.Fatal(err) + } + id, err := inspectField(name, "Id") + if err != nil { + t.Fatal(err) + } + return id + } + + id1 := buildID("testbuildexpose1", "80 2375") + id2 := buildID("testbuildexpose2", "2375 80") + defer deleteImages("testbuildexpose1", "testbuildexpose2") + if id1 != id2 { + t.Errorf("EXPOSE should invalidate the cache only when ports actually changed") + } + logDone("build - expose order") +} + func TestBuildEmptyEntrypointInheritance(t *testing.T) { name := "testbuildentrypointinheritance" name2 := "testbuildentrypointinheritance2"