summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim MacArthur <jim.macarthur@codethink.co.uk>2018-10-11 15:33:48 +0100
committerJim MacArthur <jim.macarthur@codethink.co.uk>2018-10-11 15:33:48 +0100
commit3dcc81bbe4b5c59ce66e210ff14381a0088b15f7 (patch)
tree14e590db0373491c512ef05a61ec909cd22a2205
parent7cf28a8d62c163774064951358cff7ea0215c069 (diff)
downloadbuildstream-jmac/vdir_import_test.tar.gz
virtual_directory_import.py: Test direct import of randomly generated directoryjmac/vdir_import_test
-rw-r--r--tests/storage/virtual_directory_import.py44
1 files changed, 23 insertions, 21 deletions
diff --git a/tests/storage/virtual_directory_import.py b/tests/storage/virtual_directory_import.py
index 1c78c1bb4..b383aff4c 100644
--- a/tests/storage/virtual_directory_import.py
+++ b/tests/storage/virtual_directory_import.py
@@ -141,7 +141,7 @@ def directory_not_empty(path):
return os.listdir(path)
-@pytest.mark.parametrize("original,overlay", combinations([1, 2, 3, 4, 5]))
+@pytest.mark.parametrize("original,overlay", combinations([1, 2, 3, 4, 5, 6]))
def test_cas_import(cli, tmpdir, original, overlay):
fake_context = FakeContext()
fake_context.artifactdir = tmpdir
@@ -153,26 +153,28 @@ def test_cas_import(cli, tmpdir, original, overlay):
d.import_files(d2)
d.export_files(os.path.join(tmpdir, "output"))
- for item in root_filesets[overlay - 1]:
- (path, typename, content) = item
- realpath = resolve_symlinks(path, os.path.join(tmpdir, "output"))
- if typename == 'F':
- if os.path.isdir(realpath) and directory_not_empty(realpath):
- # The file should not have overwritten the directory in this case.
- pass
- else:
- assert os.path.isfile(realpath), "{} did not exist in the combined virtual directory".format(path)
- assert file_contents_are(realpath, content)
- elif typename == 'S':
- if os.path.isdir(realpath) and directory_not_empty(realpath):
- # The symlink should not have overwritten the directory in this case.
- pass
- else:
- assert os.path.islink(realpath)
- assert os.readlink(realpath) == content
- elif typename == 'D':
- # Note that isdir accepts symlinks to dirs, so a symlink to a dir is acceptable.
- assert os.path.isdir(realpath)
+ if overlay < 6:
+ # TODO: We don't do a detailed content check for root 6, the random one
+ for item in root_filesets[overlay - 1]:
+ (path, typename, content) = item
+ realpath = resolve_symlinks(path, os.path.join(tmpdir, "output"))
+ if typename == 'F':
+ if os.path.isdir(realpath) and directory_not_empty(realpath):
+ # The file should not have overwritten the directory in this case.
+ pass
+ else:
+ assert os.path.isfile(realpath), "{} did not exist in the combined virtual directory".format(path)
+ assert file_contents_are(realpath, content)
+ elif typename == 'S':
+ if os.path.isdir(realpath) and directory_not_empty(realpath):
+ # The symlink should not have overwritten the directory in this case.
+ pass
+ else:
+ assert os.path.islink(realpath)
+ assert os.readlink(realpath) == content
+ elif typename == 'D':
+ # Note that isdir accepts symlinks to dirs, so a symlink to a dir is acceptable.
+ assert os.path.isdir(realpath)
# Now do the same thing with filebaseddirectories and check the contents match
d3 = create_new_casdir(original, fake_context, tmpdir)