summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShahwat Dalal <sdalal29@bloomberg.net>2019-07-30 14:37:18 +0100
committerShahwat Dalal <sdalal29@bloomberg.net>2019-09-05 11:12:25 +0100
commita0a8015177306efda0823175945ce54342e03e45 (patch)
treea1e463c52ab3ee11dc0164d2e3c79bcdaf264fcb
parent07e35b3c688b4b105285550fa5a2bf216952df10 (diff)
downloadbuildstream-a0a8015177306efda0823175945ce54342e03e45.tar.gz
tests/tar: Add test for unreadable and unwritable content tar source
This test was added to consider the edge case when a unreadable file is being added to CAS.
-rw-r--r--tests/sources/tar.py8
-rw-r--r--tests/sources/tar/read-only/content/c.tar.gzbin0 -> 128 bytes
2 files changed, 5 insertions, 3 deletions
diff --git a/tests/sources/tar.py b/tests/sources/tar.py
index 9a5559d47..fac6f3f8b 100644
--- a/tests/sources/tar.py
+++ b/tests/sources/tar.py
@@ -279,9 +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. 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"])
-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)
@@ -295,7 +296,8 @@ def test_read_only_dir(cli, tmpdir, datafiles, tar_name):
{
'kind': 'tar',
'url': 'tmpdir:/{}'.format(tar_file),
- 'ref': 'foo'
+ 'ref': 'foo',
+ 'base-dir': base_dir
}
]
}, bst_path)
diff --git a/tests/sources/tar/read-only/content/c.tar.gz b/tests/sources/tar/read-only/content/c.tar.gz
new file mode 100644
index 000000000..016a5a218
--- /dev/null
+++ b/tests/sources/tar/read-only/content/c.tar.gz
Binary files differ