From a0a8015177306efda0823175945ce54342e03e45 Mon Sep 17 00:00:00 2001 From: Shahwat Dalal Date: Tue, 30 Jul 2019 14:37:18 +0100 Subject: 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. --- tests/sources/tar.py | 8 +++++--- tests/sources/tar/read-only/content/c.tar.gz | Bin 0 -> 128 bytes 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 tests/sources/tar/read-only/content/c.tar.gz 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 Binary files /dev/null and b/tests/sources/tar/read-only/content/c.tar.gz differ -- cgit v1.2.1