Test cgroup_parent option is being sent.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
This commit is contained in:
Mazz Mosley 2015-10-14 14:57:37 +01:00
parent f4efa29377
commit ca36628a0e
1 changed files with 12 additions and 7 deletions

View File

@ -146,6 +146,18 @@ class ServiceTest(unittest.TestCase):
2000000000
)
def test_cgroup_parent(self):
self.mock_client.create_host_config.return_value = {}
service = Service(name='foo', image='foo', hostname='name', client=self.mock_client, cgroup_parent='test')
service._get_container_create_options({'some': 'overrides'}, 1)
self.assertTrue(self.mock_client.create_host_config.called)
self.assertEqual(
self.mock_client.create_host_config.call_args[1]['cgroup_parent'],
'test'
)
def test_log_opt(self):
self.mock_client.create_host_config.return_value = {}
@ -353,13 +365,6 @@ class ServiceTest(unittest.TestCase):
service.create_container(do_build=False)
self.assertFalse(self.mock_client.build.called)
def test_create_container_no_build_cgroup_parent(self):
service = Service('foo', client=self.mock_client, build='.')
service.image = lambda: {'Id': 'abc123'}
service.create_container(do_build=False, cgroup_parent='test')
self.assertFalse(self.mock_client.build.called)
def test_create_container_no_build_but_needs_build(self):
service = Service('foo', client=self.mock_client, build='.')
service.image = lambda *args, **kwargs: mock_get_image([])