Merge pull request #2191 from dnephin/networking

Networking
This commit is contained in:
Daniel Nephin 2015-10-14 12:31:26 -04:00
commit 0409b287ad
18 changed files with 258 additions and 31 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',