Support volume_driver in compose
* Add support for volume_driver parameter in compose yml * Don't expand volume host paths if a volume_driver is specified (i.e., disable compose feature "relative to absolute path transformation" when volume drivers are in use, since volume drivers can use name where host path is normally specified; this is a heuristic) Signed-off-by: Luke Marsden <luke@clusterhq.com>
This commit is contained in:
parent
ea7276031c
commit
a68ee0d9c2
4 changed files with 33 additions and 2 deletions
|
|
@ -117,6 +117,12 @@ class ServiceTest(DockerClientTestCase):
|
|||
service.start_container(container)
|
||||
self.assertIn('/var/db', container.get('Volumes'))
|
||||
|
||||
def test_create_container_with_volume_driver(self):
|
||||
service = self.create_service('db', volume_driver='foodriver')
|
||||
container = service.create_container()
|
||||
service.start_container(container)
|
||||
self.assertEqual('foodriver', container.get('Config.VolumeDriver'))
|
||||
|
||||
def test_create_container_with_cpu_shares(self):
|
||||
service = self.create_service('db', cpu_shares=73)
|
||||
container = service.create_container()
|
||||
|
|
|
|||
|
|
@ -72,6 +72,22 @@ class VolumePathTest(unittest.TestCase):
|
|||
d = make_service_dict('foo', {'volumes': ['~:/container/path']}, working_dir='.')
|
||||
self.assertEqual(d['volumes'], ['/home/user:/container/path'])
|
||||
|
||||
def test_named_volume_with_driver(self):
|
||||
d = make_service_dict('foo', {
|
||||
'volumes': ['namedvolume:/data'],
|
||||
'volume_driver': 'foodriver',
|
||||
}, working_dir='.')
|
||||
self.assertEqual(d['volumes'], ['namedvolume:/data'])
|
||||
|
||||
@mock.patch.dict(os.environ)
|
||||
def test_named_volume_with_special_chars(self):
|
||||
os.environ['NAME'] = 'surprise!'
|
||||
d = make_service_dict('foo', {
|
||||
'volumes': ['~/${NAME}:/data'],
|
||||
'volume_driver': 'foodriver',
|
||||
}, working_dir='.')
|
||||
self.assertEqual(d['volumes'], ['~/${NAME}:/data'])
|
||||
|
||||
|
||||
class MergePathMappingTest(object):
|
||||
def config_name(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue