From b9c8e3e057372648c549501fcf23411bb1dd8efa Mon Sep 17 00:00:00 2001 From: Ben Firshman Date: Mon, 17 Feb 2014 21:33:05 +0000 Subject: [PATCH] Fix scale not binding ports --- fig/service.py | 2 +- tests/service_test.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/fig/service.py b/fig/service.py index cfd0f0f48..e98441f84 100644 --- a/fig/service.py +++ b/fig/service.py @@ -111,7 +111,7 @@ class Service(object): while len(running_containers) < desired_num: c = stopped_containers.pop(0) log.info("Starting %s..." % c.name) - c.start() + self.start_container(c) running_containers.append(c) diff --git a/tests/service_test.py b/tests/service_test.py index 9bb16792e..c2f42510d 100644 --- a/tests/service_test.py +++ b/tests/service_test.py @@ -229,5 +229,12 @@ class ServiceTest(DockerClientTestCase): service = self.create_service('web', ports=['8000:8000']) self.assertRaises(CannotBeScaledError, lambda: service.scale(1)) + def test_scale_sets_ports(self): + service = self.create_service('web', ports=['8000']) + service.scale(2) + containers = service.containers() + self.assertEqual(len(containers), 2) + for container in containers: + self.assertEqual(list(container.inspect()['HostConfig']['PortBindings'].keys()), ['8000/tcp'])