Make sure we support explicit protocols in port bindings

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
Aanand Prasad 2014-07-24 11:48:29 -07:00
parent 262efce43e
commit 94887a28c7
2 changed files with 6 additions and 2 deletions

View File

@ -260,7 +260,7 @@ class ServiceTest(DockerClientTestCase):
def test_port_with_explicit_interface(self):
service = self.create_service('web', ports=[
'127.0.0.1:8001:8000',
'0.0.0.0:9001:9000',
'0.0.0.0:9001:9000/udp',
])
container = service.start_container().inspect()
self.assertEqual(container['NetworkSettings']['Ports'], {
@ -270,7 +270,7 @@ class ServiceTest(DockerClientTestCase):
'HostPort': '8001',
},
],
'9000/tcp': [
'9000/udp': [
{
'HostIp': '0.0.0.0',
'HostPort': '9001',

View File

@ -33,6 +33,10 @@ class ServiceTest(unittest.TestCase):
self.assertEqual(internal_port, "2000")
self.assertEqual(external_port, ("127.0.0.1", "1000"))
internal_port, external_port = split_port("127.0.0.1:1000:2000/udp")
self.assertEqual(internal_port, "2000/udp")
self.assertEqual(external_port, ("127.0.0.1", "1000"))
internal_port, external_port = split_port("127.0.0.1::2000")
self.assertEqual(internal_port, "2000")
self.assertEqual(external_port, ("127.0.0.1",))