diff options
author | Joffrey F <f.joffrey@gmail.com> | 2018-10-08 18:51:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-08 18:51:40 +0200 |
commit | 90185117501861558f265f5ac83bddb1aca0bad2 (patch) | |
tree | b026e1735ecb37489be7eee754577c06c489d317 /tests/unit/config/config_test.py | |
parent | 7107431ae0aac97e468b1d393d88f386b19808f6 (diff) | |
parent | 9d7202d12256d8672b0ddfa6840877e551323f08 (diff) |
Merge pull request #6234 from zasca/tilda_src_paths
Improved expanding source paths of volumes
Diffstat (limited to 'tests/unit/config/config_test.py')
-rw-r--r-- | tests/unit/config/config_test.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/unit/config/config_test.py b/tests/unit/config/config_test.py index 52c89a9e..bcff21c9 100644 --- a/tests/unit/config/config_test.py +++ b/tests/unit/config/config_test.py @@ -1323,6 +1323,29 @@ class ConfigTest(unittest.TestCase): assert mount.type == 'bind' assert mount.source == expected_source + def test_load_bind_mount_relative_path_with_tilde(self): + base_file = config.ConfigFile( + 'base.yaml', { + 'version': '3.4', + 'services': { + 'web': { + 'image': 'busybox:latest', + 'volumes': [ + {'type': 'bind', 'source': '~/web', 'target': '/web'}, + ], + }, + }, + }, + ) + + details = config.ConfigDetails('.', [base_file]) + config_data = config.load(details) + mount = config_data.services[0].get('volumes')[0] + assert mount.target == '/web' + assert mount.type == 'bind' + assert (not mount.source.startswith('~') + and mount.source.endswith('{}web'.format(os.path.sep))) + def test_config_invalid_ipam_config(self): with pytest.raises(ConfigurationError) as excinfo: config.load( |