summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-03-06 18:25:06 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-03-06 18:28:26 +0900
commiteef265834d60578adae0401cfc00ea9076a108bc (patch)
tree98ca4b0de4125b08174c5cdd2e5a575a52376cb1
parentc0be9295404815aae1418ee437b7c8dd28b2d97d (diff)
downloadbuildstream-tristan/shell-enhancements.tar.gz
tests/integration/shell.py: Adding tests for env var expansions in `host-files`tristan/shell-enhancements
-rw-r--r--tests/integration/shell.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/integration/shell.py b/tests/integration/shell.py
index 210db4251..55528ab92 100644
--- a/tests/integration/shell.py
+++ b/tests/integration/shell.py
@@ -155,6 +155,31 @@ def test_host_files(cli, tmpdir, datafiles, path):
assert result.output == 'pony\n'
+# Test that bind mounts defined in project.conf work
+@pytest.mark.parametrize("path", [("/etc"), ("/usr/share/pony")])
+@pytest.mark.datafiles(DATA_DIR)
+def test_host_files_expand_environ(cli, tmpdir, datafiles, path):
+ project = os.path.join(datafiles.dirname, datafiles.basename)
+ hostpath = os.path.join(project, 'files', 'shell-mount')
+ fullpath = os.path.join(path, 'pony.txt')
+
+ os.environ['BASE_PONY'] = path
+ os.environ['HOST_PONY_PATH'] = hostpath
+
+ result = execute_shell(cli, project, ['cat', fullpath], config={
+ 'shell': {
+ 'host-files': [
+ {
+ 'host_path': '${HOST_PONY_PATH}/pony.txt',
+ 'path': '${BASE_PONY}/pony.txt'
+ }
+ ]
+ }
+ })
+ assert result.exit_code == 0
+ assert result.output == 'pony\n'
+
+
# Test that bind mounts defined in project.conf dont mount in isolation
@pytest.mark.parametrize("path", [("/etc/pony.conf"), ("/usr/share/pony/pony.txt")])
@pytest.mark.datafiles(DATA_DIR)