From 5c853c4a2cec86f68c2157ace9b4f4853c3511bf Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Thu, 30 Jul 2015 07:18:57 -0700 Subject: [PATCH] Merge pull request #1794 from aanand/add-test-for-trailing-slash-volume-copy Add test for trailing slash volume copying bug (cherry picked from commit ea7276031c237c8c1f8bc6131102b5a73c29826e) Signed-off-by: Aanand Prasad --- tests/integration/service_test.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/integration/service_test.py b/tests/integration/service_test.py index b975fc00..abab7c57 100644 --- a/tests/integration/service_test.py +++ b/tests/integration/service_test.py @@ -221,6 +221,18 @@ class ServiceTest(DockerClientTestCase): self.assertTrue(path.basename(actual_host_path) == path.basename(host_path), msg=("Last component differs: %s, %s" % (actual_host_path, host_path))) + def test_recreate_preserves_volume_with_trailing_slash(self): + """ + When the Compose file specifies a trailing slash in the container path, make + sure we copy the volume over when recreating. + """ + service = self.create_service('data', volumes=['/data/']) + old_container = create_and_start_container(service) + volume_path = old_container.get('Volumes')['/data'] + + new_container = service.recreate_container(old_container) + self.assertEqual(new_container.get('Volumes')['/data'], volume_path) + def test_duplicate_volume_trailing_slash(self): """ When an image specifies a volume, and the Compose file specifies a host path