From ae67d55bf2ff59946d4d41e2fe9069851055689f Mon Sep 17 00:00:00 2001 From: Aanand Prasad Date: Wed, 22 Jan 2014 16:52:42 +0000 Subject: [PATCH] Fix bug where too many '/tcp' suffixes were added to port config --- fig/service.py | 2 -- tests/service_test.py | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/fig/service.py b/fig/service.py index a60bf23f..adaf940e 100644 --- a/fig/service.py +++ b/fig/service.py @@ -225,8 +225,6 @@ class Service(object): port = str(port) if ':' in port: port = port.split(':')[-1] - if '/' not in port: - port = "%s/tcp" % port ports.append(port) container_options['ports'] = ports diff --git a/tests/service_test.py b/tests/service_test.py index e4183a02..dcbc4627 100644 --- a/tests/service_test.py +++ b/tests/service_test.py @@ -184,7 +184,7 @@ class ServiceTest(DockerClientTestCase): def test_start_container_creates_ports(self): service = self.create_service('web', ports=[8000]) container = service.start_container().inspect() - self.assertIn('8000/tcp', container['HostConfig']['PortBindings']) + self.assertEqual(container['HostConfig']['PortBindings'].keys(), ['8000/tcp']) self.assertNotEqual(container['HostConfig']['PortBindings']['8000/tcp'][0]['HostPort'], '8000') def test_start_container_creates_fixed_external_ports(self):