Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion tests/test_desktop_update_windows_pipe_drain.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def test_update_step_survives_pipe_leak_flood_and_live_child_stall(
if not powershell.is_file():
pytest.skip(f"Windows PowerShell not found at {powershell}")

flood_kb = 8192
env = {
**os.environ,
# The fixture writes its child scripts, pid file and hand-off log under
Expand All @@ -180,6 +181,7 @@ def test_update_step_survives_pipe_leak_flood_and_live_child_stall(
"HERMES_UPDATE_PIPE_DRAIN_SECONDS": "3",
"HERMES_UPDATE_STEP_IDLE_SECONDS": "3",
"HERMES_SELFTEST_HOLD_SECONDS": "45",
"HERMES_SELFTEST_FLOOD_KB": str(flood_kb),
}

result = subprocess.run(
Expand All @@ -204,7 +206,7 @@ def test_update_step_survives_pipe_leak_flood_and_live_child_stall(

assert "PIPE-DRAIN SELF-TEST: PASS" in result.stdout, (
"The Windows update hand-off's step drain regressed: it either waited "
"on a descendant holding the pipe open (the Desktop parks on 'Updating "
"on a descendant holding the pipe open (the Desktop parks on 'Updating " # windows-footgun: ok -- prose, not open()
"Hermes' forever) or metered a chatty step (backpressure on the running "
f"update). Fixture diagnosis follows.\n--- stdout ---\n{result.stdout}\n"
f"--- stderr ---\n{result.stderr}"
Expand All @@ -213,3 +215,17 @@ def test_update_step_survives_pipe_leak_flood_and_live_child_stall(
f"-SelfTestPipeDrain exited {result.returncode}.\n"
f"--- stdout ---\n{result.stdout}\n--- stderr ---\n{result.stderr}"
)
handoff_log = tmp_path / "logs" / "desktop-update-handoff.log"
emitted_stdout_bytes = len(result.stdout.encode("utf-8"))
assert emitted_stdout_bytes < 64 * 1024, (
"GitHub Actions throttling risk: self-test emitted "
f"{emitted_stdout_bytes} stdout bytes"
)
if "pipeflood| " in result.stdout:
pytest.fail("GitHub Actions throttling risk: flood output was replayed")
assert "pipedrain| pipe-drain step output" in result.stdout
assert "stepstall| step entered silent finalization" in result.stdout
assert handoff_log.is_file()
assert handoff_log.stat().st_size >= flood_kb * 1024
with handoff_log.open(encoding="utf-8-sig") as log_handle:
assert any("pipeflood| " in line for line in log_handle)
Loading