volume path compatibility with engine

An expanded windows path of c:\shiny\thing:\shiny:rw
needs to be changed to be linux style path, including the drive,
like /c/shiny/thing /shiny
to be mounted successfully by the engine.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
This commit is contained in:
Mazz Mosley 2015-10-01 11:06:15 +01:00
commit 2276326d7e
3 changed files with 38 additions and 19 deletions

View file

@ -420,7 +420,6 @@ class VolumeConfigTest(unittest.TestCase):
d = make_service_dict('foo', {'build': '.', 'volumes': ['/data']}, working_dir='.')
self.assertEqual(d['volumes'], ['/data'])
@pytest.mark.xfail(IS_WINDOWS_PLATFORM, reason='paths use slash')
@mock.patch.dict(os.environ)
def test_volume_binding_with_environment_variable(self):
os.environ['VOLUME_PATH'] = '/host/path'
@ -433,7 +432,7 @@ class VolumeConfigTest(unittest.TestCase):
)[0]
self.assertEqual(d['volumes'], ['/host/path:/container/path'])
@pytest.mark.xfail(IS_WINDOWS_PLATFORM, reason='paths use slash')
@pytest.mark.skipif(IS_WINDOWS_PLATFORM, reason='posix paths')
@mock.patch.dict(os.environ)
def test_volume_binding_with_home(self):
os.environ['HOME'] = '/home/user'

View file

@ -441,7 +441,6 @@ def mock_get_image(images):
raise NoSuchImageError()
@pytest.mark.xfail(IS_WINDOWS_PLATFORM, reason='paths use slash')
class ServiceVolumesTest(unittest.TestCase):
def setUp(self):
@ -468,15 +467,15 @@ class ServiceVolumesTest(unittest.TestCase):
@pytest.mark.xfail((not IS_WINDOWS_PLATFORM), reason='does not have a drive')
def test_parse_volume_windows_relative_path(self):
windows_relative_path = "c:\\Users\\msamblanet\\Documents\\anvil\\connect\\config:\\opt\\connect\\config:ro"
windows_relative_path = "c:\\Users\\me\\Documents\\shiny\\config:\\opt\\shiny\\config:ro"
spec = parse_volume_spec(windows_relative_path)
self.assertEqual(
spec,
(
"c:\\Users\\msamblanet\\Documents\\anvil\\connect\\config",
"\\opt\\connect\\config",
"/c/Users/me/Documents/shiny/config",
"/opt/shiny/config",
"ro"
)
)