mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-10-12 17:21:55 +00:00
test: resolve server temporary path aliases before containment checks (#1361)
* test: canonicalize temporary server directory * test: compare resolved server configuration paths * test: check canonical system-test configuration path * test: expose path containment through pytest fixture * test: request containment fixture in server checks * test: use injected fixture in system path check
This commit is contained in:
+10
-1
@@ -526,6 +526,15 @@ def cleanup_eos_eosdash(
|
||||
assert not running, f"Test server cleanup timed out for PIDs {running}"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def is_in_test_dir() -> Callable[[Path, str], bool]:
|
||||
"""Check containment after resolving temporary-directory aliases."""
|
||||
def contains(path: Path, eos_dir: str) -> bool:
|
||||
return path.resolve().is_relative_to(Path(eos_dir).resolve())
|
||||
|
||||
return contains
|
||||
|
||||
|
||||
@contextmanager
|
||||
def server_base(
|
||||
xprocess: XProcess,
|
||||
@@ -565,7 +574,7 @@ def server_base(
|
||||
eosdash_server = f"http://{eosdash_host}:{eosdash_port}"
|
||||
|
||||
eos_tmp_dir = tempfile.TemporaryDirectory()
|
||||
eos_dir = str(eos_tmp_dir.name)
|
||||
eos_dir = str(Path(eos_tmp_dir.name).resolve())
|
||||
eos_general_data_folder_path = str(Path(eos_dir) / "data")
|
||||
process_name = f"eos-{Path(eos_dir).name}"
|
||||
owned_processes: list[psutil.Process] = []
|
||||
|
||||
Reference in New Issue
Block a user