Containers join each network aliased to their service's name

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
Aanand Prasad 2016-01-14 18:33:35 +00:00
commit abd031cb3d
3 changed files with 17 additions and 10 deletions

View file

@ -133,12 +133,8 @@ class CLITestCase(DockerClientTestCase):
self.client.exec_start(exc)
return self.client.exec_inspect(exc)['ExitCode']
def lookup(self, container, service_name):
exit_code = self.execute(container, [
"nslookup",
"{}_{}_1".format(self.project.name, service_name)
])
return exit_code == 0
def lookup(self, container, hostname):
return self.execute(container, ["nslookup", hostname]) == 0
def test_help(self):
self.base_dir = 'tests/fixtures/no-composefile'
@ -414,6 +410,9 @@ class CLITestCase(DockerClientTestCase):
networks = list(container.get('NetworkSettings.Networks'))
self.assertEqual(networks, [network['Name']])
for service in services:
assert self.lookup(container, service.name)
def test_up_with_networks(self):
self.base_dir = 'tests/fixtures/networks'
self.dispatch(['up', '-d'], None)