diff options
Diffstat (limited to 'tests/internals/cascache.py')
-rw-r--r-- | tests/internals/cascache.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/internals/cascache.py b/tests/internals/cascache.py index d669f2a2c..f095663a3 100644 --- a/tests/internals/cascache.py +++ b/tests/internals/cascache.py @@ -14,7 +14,7 @@ def test_report_when_cascache_dies_before_asked_to(tmp_path, monkeypatch): monkeypatch.setenv("PATH", str(tmp_path), prepend=os.pathsep) messenger = MagicMock(spec_set=Messenger) - cache = CASCache(str(tmp_path.joinpath("casd")), casd=True) + cache = CASCache(str(tmp_path.joinpath("casd")), casd=True, log_directory=str(tmp_path.joinpath("logs"))) time.sleep(1) cache.release_resources(messenger) @@ -26,14 +26,14 @@ def test_report_when_cascache_dies_before_asked_to(tmp_path, monkeypatch): assert "died" in message.message -def test_report_when_cascache_exist_not_cleanly(tmp_path, monkeypatch): +def test_report_when_cascache_exits_not_cleanly(tmp_path, monkeypatch): dummy_buildbox_casd = tmp_path.joinpath("buildbox-casd") dummy_buildbox_casd.write_text("#!/usr/bin/env sh\nwhile :\ndo\nsleep 60\ndone") dummy_buildbox_casd.chmod(0o777) monkeypatch.setenv("PATH", str(tmp_path), prepend=os.pathsep) messenger = MagicMock(spec_set=Messenger) - cache = CASCache(str(tmp_path.joinpath("casd")), casd=True) + cache = CASCache(str(tmp_path.joinpath("casd")), casd=True, log_directory=str(tmp_path.joinpath("logs"))) time.sleep(1) cache.release_resources(messenger) @@ -52,7 +52,7 @@ def test_report_when_cascache_is_forcefully_killed(tmp_path, monkeypatch): monkeypatch.setenv("PATH", str(tmp_path), prepend=os.pathsep) messenger = MagicMock(spec_set=Messenger) - cache = CASCache(str(tmp_path.joinpath("casd")), casd=True) + cache = CASCache(str(tmp_path.joinpath("casd")), casd=True, log_directory=str(tmp_path.joinpath("logs"))) time.sleep(1) cache.release_resources(messenger) @@ -72,7 +72,8 @@ def test_casd_redirects_stderr_to_file_and_rotate(tmp_path, monkeypatch): monkeypatch.setenv("PATH", str(tmp_path), prepend=os.pathsep) casd_files_path = tmp_path.joinpath("casd") - casd_logs_path = casd_files_path.joinpath("cas", "logs") + casd_parent_logs_path = tmp_path.joinpath("logs") + casd_logs_path = casd_parent_logs_path.joinpath("_casd") # Ensure we don't have any files in the log directory assert not casd_logs_path.exists() @@ -80,7 +81,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) + cache = CASCache(str(casd_files_path), casd=True, log_directory=str(casd_parent_logs_path)) time.sleep(0.05) cache.release_resources() @@ -92,7 +93,7 @@ def test_casd_redirects_stderr_to_file_and_rotate(tmp_path, monkeypatch): for _ in range(3): evicted_file = existing_log_files.pop(0) - cache = CASCache(str(casd_files_path), casd=True) + cache = CASCache(str(casd_files_path), casd=True, log_directory=str(casd_parent_logs_path)) time.sleep(0.05) cache.release_resources() |