Add options for containers to Service

This commit is contained in:
Ben Firshman 2013-12-10 20:51:55 +00:00
commit bf2505d15d
3 changed files with 13 additions and 9 deletions

View file

@ -17,9 +17,9 @@ class ServiceCollectionTest(DockerClientTestCase):
])
self.assertEqual(len(collection), 2)
self.assertEqual(collection.get('web').name, 'web')
self.assertEqual(collection.get('web').image, 'ubuntu')
self.assertEqual(collection.get('web').options['image'], 'ubuntu')
self.assertEqual(collection.get('db').name, 'db')
self.assertEqual(collection.get('db').image, 'ubuntu')
self.assertEqual(collection.get('db').options['image'], 'ubuntu')
def test_from_dict_sorts_in_dependency_order(self):
collection = ServiceCollection.from_dicts(None, [

View file

@ -59,11 +59,16 @@ class NameTestCase(DockerClientTestCase):
service.stop()
self.assertEqual(len(service.containers), 0)
def test_links_are_created_when_starting(self):
def test_start_container_passes_through_options(self):
db = self.create_service('db', environment={'FOO': 'BAR'})
db.start_container()
self.assertEqual(db.inspect()[0]['Config']['Env'], ['FOO=BAR'])
def test_start_container_creates_links(self):
db = self.create_service('db')
web = self.create_service('web', links=[db])
db.start()
web.start()
db.start_container()
web.start_container()
self.assertIn('/web_1/db_1', db.containers[0]['Names'])
db.stop()
web.stop()