aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-04-30 15:22:50 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-05-01 21:47:34 +0000
commit970eaf003328cab69aa4ccaa78cf908f5a87fff0 (patch)
tree6145d0643bee8140ea4798ff9c46c4216e4f5642 /test
parente98ad5751d12b6ef052803b30fd397101952294e (diff)
downloadpodman-970eaf003328cab69aa4ccaa78cf908f5a87fff0.tar.gz
podman-970eaf003328cab69aa4ccaa78cf908f5a87fff0.tar.bz2
podman-970eaf003328cab69aa4ccaa78cf908f5a87fff0.zip
podman should assign a host port to -p when omitted
If the user does not provide a host port when adding -p to create/run, podman should inject an available random port. podman run -p 80 .... podman should assign a random port to the host and expose the container port 80 to it Signed-off-by: baude <bbaude@redhat.com> Closes: #703 Approved by: rhatdan
Diffstat (limited to 'test')
-rw-r--r--test/e2e/run_networking_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index b56b11634..9a2858ca1 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -77,4 +77,18 @@ var _ = Describe("Podman rmi", func() {
Expect(results.ExitCode()).To(Equal(0))
Expect(results.OutputToString()).To(ContainSubstring(": 80,"))
})
+
+ It("podman run network expose duplicate host port results in error", func() {
+ session := podmanTest.Podman([]string{"run", "-dt", "-p", "80", ALPINE, "/bin/sh"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ inspect := podmanTest.Podman([]string{"inspect", "-l"})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect.ExitCode()).To(Equal(0))
+
+ containerConfig := inspect.InspectContainerToJSON()
+ Expect(containerConfig[0].NetworkSettings.Ports[0].HostPort).ToNot(Equal("80"))
+ })
+
})