mirror of https://github.com/docker/docker-py.git
Merge branch 'volumes-from-as-list' of github.com:blackrobot/docker-py into blackrobot-volumes-from-as-list
This commit is contained in:
commit
ad75b37a46
|
@ -155,6 +155,9 @@ class Client(requests.Session):
|
|||
volumes_dict[vol] = {}
|
||||
volumes = volumes_dict
|
||||
|
||||
if volumes_from and not isinstance(volumes_from, six.string_types):
|
||||
volumes_from = ','.join(volumes_from)
|
||||
|
||||
attach_stdin = False
|
||||
attach_stdout = False
|
||||
attach_stderr = False
|
||||
|
|
|
@ -514,6 +514,36 @@ class TestRemoveContainerWithDictInsteadOfId(BaseTestCase):
|
|||
self.assertEqual(len(res), 0)
|
||||
|
||||
|
||||
class TestStartContainerWithVolumesFrom(BaseTestCase):
|
||||
def runTest(self):
|
||||
vol_names = ['foobar_vol0', 'foobar_vol1']
|
||||
|
||||
res0 = self.client.create_container(
|
||||
'busybox', 'true',
|
||||
name=vol_names[0])
|
||||
container1_id = res0['Id']
|
||||
self.tmp_containers.append(container1_id)
|
||||
self.client.start(container1_id)
|
||||
|
||||
res1 = self.client.create_container(
|
||||
'busybox', 'true',
|
||||
name=vol_names[1])
|
||||
container2_id = res1['Id']
|
||||
self.tmp_containers.append(container2_id)
|
||||
self.client.start(container2_id)
|
||||
|
||||
res2 = self.client.create_container(
|
||||
'busybox', 'cat',
|
||||
detach=True, stdin_open=True,
|
||||
volumes_from=vol_names)
|
||||
container3_id = res2['Id']
|
||||
self.tmp_containers.append(container3_id)
|
||||
self.client.start(container3_id)
|
||||
|
||||
info = self.client.inspect_container(res2['Id'])
|
||||
self.assertEqual(info['Config']['VolumesFrom'], ','.join(vol_names))
|
||||
|
||||
|
||||
class TestStartContainerWithLinks(BaseTestCase):
|
||||
def runTest(self):
|
||||
res0 = self.client.create_container(
|
||||
|
|
Loading…
Reference in New Issue