From 05275281d0a4bb8d422aef9ba0a42f17bdcea12e Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Sun, 20 Sep 2026 16:22:25 +0530 Subject: [PATCH] test(gateway): isolate the escaping test from the host's installed unit Gate review: with the installed-unit fallback, the absent-env assertions read the real ~/.config/systemd/user unit (conftest does not redirect HOME). --- tests/hermes_cli/test_gateway_service.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/hermes_cli/test_gateway_service.py b/tests/hermes_cli/test_gateway_service.py index 3a36050e4c..72798684e2 100644 --- a/tests/hermes_cli/test_gateway_service.py +++ b/tests/hermes_cli/test_gateway_service.py @@ -332,9 +332,11 @@ class TestGeneratedSystemdUnits: assert f"RestartForceExitStatus={GATEWAY_SERVICE_RESTART_EXIT_CODE}" in unit assert f"RestartPreventExitStatus={GATEWAY_FATAL_CONFIG_EXIT_CODE}" in unit - def test_user_unit_carries_ld_library_path_escaped_for_systemd(self, monkeypatch): + def test_user_unit_carries_ld_library_path_escaped_for_systemd(self, monkeypatch, tmp_path): """#14613: glibc reads LD_LIBRARY_PATH only at process start, so the unit file is the only place it can reach CUDA-backed tools; quotes/backslashes must survive systemd quoting.""" + # The absent-env branch falls back to the installed unit: keep the host's real one out. + monkeypatch.setattr(gateway_cli, "get_systemd_unit_path", lambda system=False: tmp_path / "hermes-gateway.service") monkeypatch.setenv("LD_LIBRARY_PATH", '/opt/cu"da/lib64:/opt/back\\slash/lib') unit = gateway_cli.generate_systemd_unit(system=False)