aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2020-07-23 16:43:43 -0400
committerMatthew Heon <matthew.heon@pm.me>2020-07-31 11:41:05 -0400
commitda752a7ed32f90a3f187eeb5f3f372889561a021 (patch)
treeef75dba5166805a947d4c22ba6845e5cb260caab /test
parent828b5474914c4036d3a6135c63604d223ced3610 (diff)
downloadpodman-da752a7ed32f90a3f187eeb5f3f372889561a021.tar.gz
podman-da752a7ed32f90a3f187eeb5f3f372889561a021.tar.bz2
podman-da752a7ed32f90a3f187eeb5f3f372889561a021.zip
Binding the same container port to >1 host port is OK
The initial version of the new port code mistakenly restricted this, so un-restrict it. We still need to maintain the map of container ports, unfortunately (need to verify if the port in question is a duplicate, for example). Fixes #7062 Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/run_networking_test.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index 9357145ab..40cc9e1e6 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -222,6 +222,22 @@ var _ = Describe("Podman run networking", func() {
Expect(inspectOut[0].NetworkSettings.Ports["8080/tcp"][0].HostIP).To(Equal(""))
})
+ It("podman run -p 8080:8080 -p 8081:8080", func() {
+ name := "testctr"
+ session := podmanTest.Podman([]string{"create", "-t", "-p", "4000:8080", "-p", "8000:8080", "--name", name, ALPINE, "/bin/sh"})
+ session.WaitWithDefaultTimeout()
+ inspectOut := podmanTest.InspectContainer(name)
+ Expect(len(inspectOut)).To(Equal(1))
+ Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
+ Expect(len(inspectOut[0].NetworkSettings.Ports["8080/tcp"])).To(Equal(2))
+
+ hp1 := inspectOut[0].NetworkSettings.Ports["8080/tcp"][0].HostPort
+ hp2 := inspectOut[0].NetworkSettings.Ports["8080/tcp"][1].HostPort
+
+ // We can't guarantee order
+ Expect((hp1 == "4000" && hp2 == "8000") || (hp1 == "8000" && hp2 == "4000")).To(BeTrue())
+ })
+
It("podman run network expose host port 80 to container port 8000", func() {
SkipIfRootless()
session := podmanTest.Podman([]string{"run", "-dt", "-p", "80:8000", ALPINE, "/bin/sh"})