Enable use of Docker networking with the --x-networking flag

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
Aanand Prasad 2015-10-07 16:10:08 +01:00 committed by Daniel Nephin
commit d5f5eb1924
14 changed files with 240 additions and 24 deletions

View file

@ -203,6 +203,26 @@ class ServiceTest(unittest.TestCase):
self.assertEqual(opts['hostname'], 'name.sub', 'hostname')
self.assertEqual(opts['domainname'], 'domain.tld', 'domainname')
def test_no_default_hostname_when_not_using_networking(self):
service = Service(
'foo',
image='foo',
use_networking=False,
client=self.mock_client,
)
opts = service._get_container_create_options({'image': 'foo'}, 1)
self.assertIsNone(opts.get('hostname'))
def test_hostname_defaults_to_service_name_when_using_networking(self):
service = Service(
'foo',
image='foo',
use_networking=True,
client=self.mock_client,
)
opts = service._get_container_create_options({'image': 'foo'}, 1)
self.assertEqual(opts['hostname'], 'foo')
def test_get_container_create_options_with_name_option(self):
service = Service(
'foo',