Merge branch 'volumes-from-as-list' of github.com:blackrobot/docker-py into blackrobot-volumes-from-as-list

This commit is contained in:
shin- 2014-04-04 16:59:57 +02:00
commit ad75b37a46
2 changed files with 33 additions and 0 deletions

View File

@ -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

View File

@ -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(