diff --git a/tests/fixtures/dockerfile-with-volume/Dockerfile b/tests/fixtures/dockerfile-with-volume/Dockerfile new file mode 100644 index 000000000..2d6437cf4 --- /dev/null +++ b/tests/fixtures/dockerfile-with-volume/Dockerfile @@ -0,0 +1,3 @@ +FROM busybox +VOLUME /data +CMD sleep 3000 diff --git a/tests/integration/service_test.py b/tests/integration/service_test.py index d01d118ff..b7b11d5f0 100644 --- a/tests/integration/service_test.py +++ b/tests/integration/service_test.py @@ -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'})