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 <dqminh89@gmail.com> (github: dqminh)
| ... | ... |
@@ -1732,6 +1732,29 @@ func TestBuildExpose(t *testing.T) {
|
| 1732 | 1732 |
logDone("build - expose")
|
| 1733 | 1733 |
} |
| 1734 | 1734 |
|
| 1735 |
+func TestBuildExposeOrder(t *testing.T) {
|
|
| 1736 |
+ buildID := func(name, exposed string) string {
|
|
| 1737 |
+ _, err := buildImage(name, fmt.Sprintf(`FROM scratch |
|
| 1738 |
+ EXPOSE %s`, exposed), true) |
|
| 1739 |
+ if err != nil {
|
|
| 1740 |
+ t.Fatal(err) |
|
| 1741 |
+ } |
|
| 1742 |
+ id, err := inspectField(name, "Id") |
|
| 1743 |
+ if err != nil {
|
|
| 1744 |
+ t.Fatal(err) |
|
| 1745 |
+ } |
|
| 1746 |
+ return id |
|
| 1747 |
+ } |
|
| 1748 |
+ |
|
| 1749 |
+ id1 := buildID("testbuildexpose1", "80 2375")
|
|
| 1750 |
+ id2 := buildID("testbuildexpose2", "2375 80")
|
|
| 1751 |
+ defer deleteImages("testbuildexpose1", "testbuildexpose2")
|
|
| 1752 |
+ if id1 != id2 {
|
|
| 1753 |
+ t.Errorf("EXPOSE should invalidate the cache only when ports actually changed")
|
|
| 1754 |
+ } |
|
| 1755 |
+ logDone("build - expose order")
|
|
| 1756 |
+} |
|
| 1757 |
+ |
|
| 1735 | 1758 |
func TestBuildEmptyEntrypointInheritance(t *testing.T) {
|
| 1736 | 1759 |
name := "testbuildentrypointinheritance" |
| 1737 | 1760 |
name2 := "testbuildentrypointinheritance2" |