test(update): fleet-matrix live-pid tests verify pytest as the home's gateway

collect_fleet_versions now classifies a live pid from the state file only when the
home's identity resolver verifies it (#110420); these two tests write the record about
the pytest process itself, so they verify it explicitly. Dead-pid rows are unchanged.
This commit is contained in:
teknium1
2026-09-14 20:28:52 -07:00
committed by Teknium
parent 1348295036
commit f39b034db9

View File

@@ -31,6 +31,13 @@ def _setup(monkeypatch, tmp_path, record: dict):
return home
def _verify_self_as_gateway(monkeypatch):
"""Without a socket answer the state file is only a claim; the fallback classifies a LIVE
pid from it only when the home's identity resolver verifies that pid as the gateway
(#110420). The live-pid tests write the record about pytest itself, so verify it."""
monkeypatch.setattr("gateway.status.live_gateway_pid_for_home", lambda h: os.getpid())
_DEAD_PID = 999999899 # never a live pid
@@ -100,6 +107,7 @@ def test_matching_start_time_is_still_live(monkeypatch, tmp_path):
from gateway.status import _get_process_start_time
pid = os.getpid()
_verify_self_as_gateway(monkeypatch)
_setup(
monkeypatch,
tmp_path,
@@ -118,6 +126,7 @@ def test_matching_start_time_is_still_live(monkeypatch, tmp_path):
def test_live_gateway_rows_unchanged(monkeypatch, tmp_path):
"""The live-pid path is untouched by the down-state addition."""
_verify_self_as_gateway(monkeypatch)
_setup(
monkeypatch,
tmp_path,