fix(tests): two more container-env parity pins in gateway service tests

- test_supports_systemd_services_returns_true_when_systemctl_present:
  pin is_container=False (host contract; CI runner pods are containers)
- test_systemd_restart_gracefully_restarts_running_service_and_waits:
  stub _preflight_user_systemd — no user D-Bus in runner pods; the test
  asserts restart choreography, not D-Bus reachability
This commit is contained in:
ethernet 2026-07-30 12:35:24 -04:00
parent ede14b2426
commit 2b3fedacbb

View file

@ -460,6 +460,8 @@ class TestGatewayServiceDetection:
monkeypatch.setattr(gateway_cli, "is_linux", lambda: True)
monkeypatch.setattr(gateway_cli, "is_termux", lambda: False)
monkeypatch.setattr(gateway_cli, "is_wsl", lambda: False)
# CI runner pods are containers; pin the host case this test covers.
monkeypatch.setattr(gateway_cli, "is_container", lambda: False)
monkeypatch.setattr(gateway_cli.shutil, "which", lambda name: "/usr/bin/systemctl")
assert gateway_cli.supports_systemd_services() is True
@ -495,6 +497,10 @@ class TestGatewaySystemServiceRouting:
monkeypatch.setattr(gateway_cli, "_select_systemd_scope", lambda system=False: False)
monkeypatch.setattr(gateway_cli, "_require_service_installed", lambda action, system=False: None)
# Preflight probes the real user D-Bus; on CI runner pods there is
# none and it raises UserSystemdUnavailableError. Stub it — this
# test asserts the restart choreography, not D-Bus reachability.
monkeypatch.setattr(gateway_cli, "_preflight_user_systemd", lambda: None)
monkeypatch.setattr(gateway_cli, "refresh_systemd_unit_if_needed", lambda system=False: calls.append(("refresh", system)))
monkeypatch.setattr(gateway_cli, "_get_restart_drain_timeout", lambda: 12.0)
monkeypatch.setattr(