Merge pull request #1633 from jeffk/parse_env_vars_in_all_volumes
Added env var parsing to volume container paths
This commit is contained in:
commit
a6b9982a1e
2 changed files with 26 additions and 7 deletions
|
|
@ -334,6 +334,25 @@ class EnvTest(unittest.TestCase):
|
|||
{'FILE_DEF': 'F1', 'FILE_DEF_EMPTY': '', 'ENV_DEF': 'E3', 'NO_DEF': ''},
|
||||
)
|
||||
|
||||
@mock.patch.dict(os.environ)
|
||||
def test_resolve_path(self):
|
||||
os.environ['HOSTENV'] = '/tmp'
|
||||
os.environ['CONTAINERENV'] = '/host/tmp'
|
||||
|
||||
service_dict = config.make_service_dict(
|
||||
'foo',
|
||||
{'volumes': ['$HOSTENV:$CONTAINERENV']},
|
||||
working_dir="tests/fixtures/env"
|
||||
)
|
||||
self.assertEqual(set(service_dict['volumes']), set(['/tmp:/host/tmp']))
|
||||
|
||||
service_dict = config.make_service_dict(
|
||||
'foo',
|
||||
{'volumes': ['/opt${HOSTENV}:/opt${CONTAINERENV}']},
|
||||
working_dir="tests/fixtures/env"
|
||||
)
|
||||
self.assertEqual(set(service_dict['volumes']), set(['/opt/tmp:/opt/host/tmp']))
|
||||
|
||||
|
||||
class ExtendsTest(unittest.TestCase):
|
||||
def test_extends(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue