(Failing) test for preservation of volumes declared in images

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
Aanand Prasad 2015-01-20 13:10:01 +00:00
parent f57db078ba
commit 17a8a7be4b
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,3 @@
FROM busybox
VOLUME /data
CMD sleep 3000

View File

@ -186,6 +186,25 @@ class ServiceTest(DockerClientTestCase):
service.recreate_containers()
self.assertEqual(len(service.containers(stopped=True)), 1)
def test_recreate_containers_with_image_declared_volume(self):
service = Service(
project='figtest',
name='db',
client=self.client,
build='tests/fixtures/dockerfile-with-volume',
)
old_container = create_and_start_container(service)
self.assertEqual(old_container.get('Volumes').keys(), ['/data'])
volume_path = old_container.get('Volumes')['/data']
service.recreate_containers()
new_container = service.containers()[0]
service.start_container(new_container)
self.assertEqual(new_container.get('Volumes').keys(), ['/data'])
self.assertEqual(new_container.get('Volumes')['/data'], volume_path)
def test_start_container_passes_through_options(self):
db = self.create_service('db')
create_and_start_container(db, environment={'FOO': 'BAR'})