From 0b48ae8d96441d02042e1d7c6bdbe05dcc13ba73 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Tue, 15 Sep 2026 13:48:54 -0700 Subject: [PATCH] test(cli): split the incomplete-fleet-restart hint tests per host Once the launchd file carried the macos_only marker, the first real macOS lane run showed TestIncompleteWarningMentionsLaunchctl asserting the systemd-host branch (kickstart hint, systemctl line) that never runs on macOS. The two Linux-arm tests move to their own linux_only file; the launchd file keeps the macOS arm (bootstrap/list hint, no systemctl). --- .../test_update_fleet_incomplete_warning.py | 27 +++++++++++++++++++ .../test_update_launchd_fleet_restart.py | 16 +++++------ 2 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 tests/hermes_cli/test_update_fleet_incomplete_warning.py diff --git a/tests/hermes_cli/test_update_fleet_incomplete_warning.py b/tests/hermes_cli/test_update_fleet_incomplete_warning.py new file mode 100644 index 0000000000..8ec5b280a9 --- /dev/null +++ b/tests/hermes_cli/test_update_fleet_incomplete_warning.py @@ -0,0 +1,27 @@ +"""Incomplete-fleet-restart hint on a systemd host (Linux arm of +``_warn_incomplete_gateway_fleet_restart``; the macOS arm lives in +test_update_launchd_fleet_restart.py). Regression for #111866: this class used to +sit in the launchd file, where it asserted the non-macOS branch under a faked +``is_macos()`` — green on Linux, never run on macOS, wrong on both.""" + +from __future__ import annotations + +import pytest + +from hermes_cli.update_cmd_fleet import _warn_incomplete_gateway_fleet_restart + +pytestmark = pytest.mark.linux_only + + +def test_launchd_labels_get_launchctl_hint(capsys): + _warn_incomplete_gateway_fleet_restart(["ai.hermes.gateway-merit-ops"]) + out = capsys.readouterr().out + assert "Update incomplete" in out + assert "launchctl kickstart -k" in out + + +def test_systemd_units_keep_systemctl_hint(capsys): + _warn_incomplete_gateway_fleet_restart(["hermes-gateway-coder"]) + out = capsys.readouterr().out + assert "systemctl" in out + assert "launchctl" not in out diff --git a/tests/hermes_cli/test_update_launchd_fleet_restart.py b/tests/hermes_cli/test_update_launchd_fleet_restart.py index 550bf4090a..2f96f61338 100644 --- a/tests/hermes_cli/test_update_launchd_fleet_restart.py +++ b/tests/hermes_cli/test_update_launchd_fleet_restart.py @@ -640,15 +640,13 @@ class TestWaitForLaunchdServicePid: ) -class TestIncompleteWarningMentionsLaunchctl: - def test_launchd_labels_get_launchctl_hint(self, capsys): +class TestIncompleteWarningOnMacos: + """On the launchd host the hint is bootstrap/list, never the systemd or the + ``kickstart`` line — a label in this list is likely deregistered (#88848).""" + + def test_launchd_labels_get_bootstrap_hint(self, capsys): _warn_incomplete_gateway_fleet_restart(["ai.hermes.gateway-merit-ops"]) out = capsys.readouterr().out assert "Update incomplete" in out - assert "launchctl kickstart -k" in out - - def test_systemd_units_keep_systemctl_hint(self, capsys): - _warn_incomplete_gateway_fleet_restart(["hermes-gateway-coder"]) - out = capsys.readouterr().out - assert "systemctl" in out - assert "launchctl" not in out + assert "launchctl bootstrap" in out + assert "systemctl" not in out