test: update systemd scope assertions for start_new_session=True

The #70716 regression fix changes popen_start_new_session from False to
True in the systemd-scope branch.  Update the assertion in
test_wraps_in_systemd_scope_when_supervisor_and_available and the
docstring in test_systemd_post_spawn_failure_never_kills_gateway_process_group.
This commit is contained in:
kshitij 2026-08-09 12:52:19 +05:30
parent 0e492a4840
commit f9f4fb4327
1 changed files with 7 additions and 3 deletions

View File

@ -1717,8 +1717,12 @@ class TestSystemdCgroupIsolation:
sep_idx = argv.index("--")
assert "/bin/bash" in argv[sep_idx:]
assert "set +m; echo hello" in argv[sep_idx:]
# systemd-run owns session/cgroup creation — no start_new_session.
assert captured["start_new_session"] is False
# systemd-run --scope gives the worker a new cgroup but NOT a new
# session (#70716 regression: start_new_session was False, so the
# worker kept the parent's session + controlling terminal → SIGTTIN/
# SIGTTOU stopped the TUI). start_new_session=True gives systemd-run
# (and the scoped worker below it) a private session.
assert captured["start_new_session"] is True
# The session must record the unit name so kill_process can stop it.
assert session.systemd_unit == f"hermes-worker-{session.id}.scope"
@ -1779,7 +1783,7 @@ class TestSystemdCgroupIsolation:
def test_systemd_post_spawn_failure_never_kills_gateway_process_group(
self, registry, monkeypatch
):
"""The scope wrapper shares the gateway PG, so cleanup must not killpg."""
"""Cleanup must not killpg: scope teardown is the authoritative path."""
fake_popen, _captured = self._fake_popen_capture()
fake_proc = fake_popen(["placeholder"])