From 5d3c72fd1ee440cf487aa06756ab70baf4efe6af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Mon, 20 Apr 2020 11:50:19 +0200 Subject: tests/sources/tar.py: Fix flaky test_out_of_basedir_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`. --- tests/sources/tar.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- cgit v1.2.1 From b2c5f0137e5773c3d315554dd3a6e6c09d588d81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Mon, 20 Apr 2020 13:07:22 +0200 Subject: tests/internals/cascache.py: Increase sleep duration to fix flaky test Increase sleep duration in test_casd_redirects_stderr_to_file_and_rotate from 0.05s to 0.5s to reduce risk of test failure. --- tests/internals/cascache.py | 4 ++-- 1 file changed, 2 insertions(+), 2 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()) -- cgit v1.2.1