summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2020-04-20 11:50:19 +0200
committerJürg Billeter <j@bitron.ch>2020-04-20 11:52:17 +0200
commit5d3c72fd1ee440cf487aa06756ab70baf4efe6af (patch)
tree5e662b6790017253f58d9522290522114f0034c2
parentf093e630d6d4272930f45595d5f1b069879412ce (diff)
downloadbuildstream-juerg/tar-hardlinks.tar.gz
tests/sources/tar.py: Fix flaky test_out_of_basedir_hardlinksjuerg/tar-hardlinks
Don't recursively add `contents` to the tar file as the order is not guaranteed. We need to add `elsewhere` before `to_extract` as the latter references the former in `linkname`.
-rw-r--r--tests/sources/tar.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/sources/tar.py b/tests/sources/tar.py
index 8ac627492..ed662dcd2 100644
--- a/tests/sources/tar.py
+++ b/tests/sources/tar.py
@@ -405,7 +405,12 @@ def test_out_of_basedir_hardlinks(cli, tmpdir, datafiles):
old_dir = os.getcwd()
os.chdir(str(tmpdir))
with tarfile.open(src_tar, "w:gz") as tar:
- tar.add("contents", filter=ensure_link)
+ # Don't recursively add `contents` as the order is not guaranteed.
+ # We need to add `elsewhere` before `to_extract` as the latter
+ # references the former in `linkname`.
+ tar.add("contents", recursive=False)
+ tar.add("contents/elsewhere")
+ tar.add("contents/to_extract", filter=ensure_link)
os.chdir(old_dir)
# Make sure our tarfile is actually created with the desired