summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-10-08 14:17:26 -0400
committerGitHub <noreply@github.com>2020-10-08 14:17:26 -0400
commit0afbe2d15203447370b495c2ba2c960059cf7df4 (patch)
tree3401d4fe1cdb54bf9e7e88599f63b330e379678f
parent59b5f0ac32ddf615fada021bc62c823bb73233da (diff)
parentb754ba975327904e040824e9ca64e7e39c3dde9d (diff)
downloadpodman-0afbe2d15203447370b495c2ba2c960059cf7df4.tar.gz
podman-0afbe2d15203447370b495c2ba2c960059cf7df4.tar.bz2
podman-0afbe2d15203447370b495c2ba2c960059cf7df4.zip
Merge pull request #7951 from mheon/fix_7947
Ports given only by number should have random host port
-rw-r--r--cmd/podman/common/util.go2
-rw-r--r--test/e2e/run_networking_test.go6
2 files changed, 3 insertions, 5 deletions
diff --git a/cmd/podman/common/util.go b/cmd/podman/common/util.go
index 17e779c86..a971aa957 100644
--- a/cmd/podman/common/util.go
+++ b/cmd/podman/common/util.go
@@ -200,8 +200,6 @@ func parseSplitPort(hostIP, hostPort *string, ctrPort string, protocol *string)
}
newPort.HostPort = hostStart
}
- } else {
- newPort.HostPort = newPort.ContainerPort
}
hport := newPort.HostPort
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index 0f8b3e939..e14482db7 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -73,7 +73,7 @@ var _ = Describe("Podman run networking", func() {
Expect(len(inspectOut)).To(Equal(1))
Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("80"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Not(Equal("80")))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
})
@@ -111,7 +111,7 @@ var _ = Describe("Podman run networking", func() {
Expect(len(inspectOut)).To(Equal(1))
Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
Expect(len(inspectOut[0].NetworkSettings.Ports["80/udp"])).To(Equal(1))
- Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostPort).To(Equal("80"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostPort).To(Not(Equal("80")))
Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostIP).To(Equal(""))
})
@@ -195,7 +195,7 @@ var _ = Describe("Podman run networking", func() {
Expect(len(inspectOut)).To(Equal(1))
Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("80"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Not(Equal("80")))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
})