summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShahwat Dalal <sdalal29@bloomberg.net>2019-07-30 17:49:47 +0100
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2019-09-05 09:09:25 +0000
commit36ba7e2c1ee039d7dadc6fedb858780d0d33b644 (patch)
treef99e28fc0fadf44b402203883dd0f21b976baad7
parentfeefb5c1ff569efbf9821b0d95d0874a6696b0d8 (diff)
downloadbuildstream-shashwatdalal/docker-source-patch.tar.gz
tests/workspaces: Test edge case when linking files to RO directoryshashwatdalal/docker-source-patch
When we open a workspace, we are linking the sources to the directory specified. As such testing that we are able to open a workspace on a read-only directory should show that we are able to link files to a RO directory when we are staging complex sources (eg. Docker source).
-rw-r--r--tests/integration/workspace.py14
-rw-r--r--tests/sources/tar.py8
2 files changed, 18 insertions, 4 deletions
diff --git a/tests/integration/workspace.py b/tests/integration/workspace.py
index fe5e76ea3..9e74e574f 100644
--- a/tests/integration/workspace.py
+++ b/tests/integration/workspace.py
@@ -37,6 +37,20 @@ def test_workspace_mount(cli, datafiles):
@pytest.mark.datafiles(DATA_DIR)
+def test_workspace_mount_on_read_only_directory(cli, datafiles):
+ project = str(datafiles)
+ workspace = os.path.join(cli.directory, 'workspace')
+ os.makedirs(workspace)
+ element_name = 'workspace/workspace-mount.bst'
+
+ # make directory RO
+ os.chmod(workspace, 0o555)
+
+ res = cli.run(project=project, args=['workspace', 'open', '--directory', workspace, element_name])
+ assert res.exit_code == 0
+
+
+@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox')
@pytest.mark.xfail(HAVE_SANDBOX == 'buildbox', reason='Not working with BuildBox', strict=True)
def test_workspace_commanddir(cli, datafiles):
diff --git a/tests/sources/tar.py b/tests/sources/tar.py
index 9789a4484..fac6f3f8b 100644
--- a/tests/sources/tar.py
+++ b/tests/sources/tar.py
@@ -279,10 +279,10 @@ def test_stage_default_basedir_lzip(cli, tmpdir, datafiles, srcdir):
# Test that tarballs with read-only files work
# a - contains read-only files in a writable directory
# b - root directory has read-only permission
-# c - contains one file that has no read nor write permissions
+# c - contains one file that has no read nor write permissions. Base-dir set to '' to extract root of tarball
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'read-only'))
-@pytest.mark.parametrize("tar_name", ["a", "b", "c"])
-def test_read_only_dir(cli, tmpdir, datafiles, tar_name):
+@pytest.mark.parametrize("tar_name, base_dir", [("a", "*"), ("b", '*'), ("c", '')])
+def test_read_only_dir(cli, tmpdir, datafiles, tar_name, base_dir):
try:
project = str(datafiles)
generate_project(project, tmpdir)
@@ -297,7 +297,7 @@ def test_read_only_dir(cli, tmpdir, datafiles, tar_name):
'kind': 'tar',
'url': 'tmpdir:/{}'.format(tar_file),
'ref': 'foo',
- 'base-dir': ''
+ 'base-dir': base_dir
}
]
}, bst_path)