Don't join the bridge network by default in v2

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
Aanand Prasad 2016-01-14 13:01:17 +00:00
parent 9c91cf2967
commit e75629392d
2 changed files with 16 additions and 11 deletions

View File

@ -69,13 +69,18 @@ class Project(object):
)
for service_dict in config_data.services:
networks = project.get_networks(
service_dict,
custom_networks + [project.default_network])
if use_networking:
networks = project.get_networks(
service_dict,
custom_networks + [project.default_network])
net = Net(networks[0]) if networks else Net("none")
links = []
else:
networks = []
net = project.get_net(service_dict)
links = project.get_links(service_dict)
links = project.get_links(service_dict)
volumes_from = get_volumes_from(project, service_dict)
net = project.get_net(service_dict)
project.services.append(
Service(
@ -194,9 +199,6 @@ class Project(object):
return links
def get_net(self, service_dict):
if self.use_networking:
return Net(None)
net = service_dict.pop('net', None)
if not net:
return Net(None)

View File

@ -382,13 +382,16 @@ class CLITestCase(DockerClientTestCase):
self.assertEqual(networks[0]['Driver'], 'bridge')
network = self.client.inspect_network(networks[0]['Id'])
# print self.project.services[0].containers()[0].get('NetworkSettings')
self.assertEqual(len(network['Containers']), len(services))
for service in services:
containers = service.containers()
self.assertEqual(len(containers), 1)
self.assertIn(containers[0].id, network['Containers'])
container = containers[0]
self.assertIn(container.id, network['Containers'])
networks = container.get('NetworkSettings.Networks').keys()
self.assertEqual(networks, [network['Name']])
def test_up_with_networks(self):
self.base_dir = 'tests/fixtures/networks'