summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2020-04-20 12:26:47 +0000
committerJürg Billeter <j@bitron.ch>2020-04-20 12:26:47 +0000
commit74bbafa4c29caff91574316fb25fe2a5f9ff5fbf (patch)
tree0fa109178972960037a66cc5515c267391f7047f
parentf093e630d6d4272930f45595d5f1b069879412ce (diff)
parentb2c5f0137e5773c3d315554dd3a6e6c09d588d81 (diff)
downloadbuildstream-74bbafa4c29caff91574316fb25fe2a5f9ff5fbf.tar.gz
Merge branch 'juerg/tar-hardlinks' into 'master'
tests/sources/tar.py: Fix flaky test_out_of_basedir_hardlinks See merge request BuildStream/buildstream!1870
-rw-r--r--tests/internals/cascache.py4
-rw-r--r--tests/sources/tar.py7
2 files changed, 8 insertions, 3 deletions
diff --git a/tests/internals/cascache.py b/tests/internals/cascache.py
index f095663a3..043531c24 100644
--- a/tests/internals/cascache.py
+++ b/tests/internals/cascache.py
@@ -82,7 +82,7 @@ def test_casd_redirects_stderr_to_file_and_rotate(tmp_path, monkeypatch):
# Let's create the first `n_max_log_files` log files
for i in range(1, n_max_log_files + 1):
cache = CASCache(str(casd_files_path), casd=True, log_directory=str(casd_parent_logs_path))
- time.sleep(0.05)
+ time.sleep(0.5)
cache.release_resources()
existing_log_files = sorted(casd_logs_path.iterdir())
@@ -94,7 +94,7 @@ def test_casd_redirects_stderr_to_file_and_rotate(tmp_path, monkeypatch):
evicted_file = existing_log_files.pop(0)
cache = CASCache(str(casd_files_path), casd=True, log_directory=str(casd_parent_logs_path))
- time.sleep(0.05)
+ time.sleep(0.5)
cache.release_resources()
existing_log_files = sorted(casd_logs_path.iterdir())
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