summaryrefslogtreecommitdiffstats
path: root/tests/test_keepalive.py
diff options
context:
space:
mode:
authorblasty <blasty@local>2026-07-24 14:53:56 +0200
committerblasty <blasty@local>2026-07-24 14:53:56 +0200
commit22ffea91210610d1def042e230ffe8d223022b30 (patch)
treea70c84470a0f4f46901cb221f2d0dd3859895b41 /tests/test_keepalive.py
parentmcp: collapse app + launcher to worker-only (diff)
downloadida-tui-22ffea91210610d1def042e230ffe8d223022b30.tar.gz
ida-tui-22ffea91210610d1def042e230ffe8d223022b30.tar.xz
ida-tui-22ffea91210610d1def042e230ffe8d223022b30.zip
mcp: delete the ida-pro-mcp transport, supervisor, and mcp-only tests
The idalib worker is the only backend now, so remove the dead HTTP/supervisor surface entirely (~2200 lines): * deleted idatui/client.py (the IDAClient HTTP/JSON-RPC transport + session manager), idatui/tui.py (the old mcp TUI entry, superseded by launch.py), spawn.sh, and systemd/ (the supervisor unit). * deleted the mcp-only tests (stress_client, smoke_client, test_keepalive, stress_paging, rpc_smoke, serverctl.sh, pane_smoke, test_domain) -- the worker pilot (tests/test_scenarios.py) supersedes them. * migrated the tmux RPC harness (idatui/pane.py) to the worker: it spawns `idatui.launch <binary> --rpc <sock>` instead of the mcp `idatui.tui`, drops the supervisor auto-start/ensure machinery, and reaps our own worker (idatui/worker.py) instead of ida_pro_mcp.idalib_server. --db/--url/--no- ensure-server are gone; --open is required. * __init__ / __main__ / domain no longer import client (exceptions come from errors.py, the domain client hint is WorkerClient); pyproject points both console scripts at idatui.launch; README + ida-tui header describe the worker-only flow. What stays (by design): the ida_pro_mcp *package* (the worker reuses its @tool functions in-process) and server/patch_server.py (the worker injects its custom tools on startup). Verified: whole package imports + IdaTui constructs + pilot lists 31 scenarios. The worker pilot (134 pass / 2 known flakes) is the E2E gate.
Diffstat (limited to 'tests/test_keepalive.py')
-rw-r--r--tests/test_keepalive.py76
1 files changed, 0 insertions, 76 deletions
diff --git a/tests/test_keepalive.py b/tests/test_keepalive.py
deleted file mode 100644
index 2910e1a..0000000
--- a/tests/test_keepalive.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/env python3
-"""Prove that an interactive session can 'just chill' without the worker idling
-out. Uses a deliberately short worker TTL to keep the test fast.
-
- python3 tests/test_keepalive.py
-
-Needs ~/ida-venv + a running server (tests/serverctl.sh) and a writable target.
-"""
-import os
-import sys
-import time
-
-HERE = os.path.dirname(os.path.abspath(__file__))
-REPO = os.path.dirname(HERE)
-sys.path.insert(0, REPO)
-from idatui.client import IDAClient, IDAToolError # noqa: E402
-
-PASS = FAIL = 0
-
-
-def check(name, cond, detail=""):
- global PASS, FAIL
- if cond:
- PASS += 1
- print(f" ok {name}")
- else:
- FAIL += 1
- print(f" FAIL {name} {detail}")
-
-
-def alive(c, sid):
- try:
- c.set_db(sid)
- c.health()
- return True
- except IDAToolError:
- return False
-
-
-def main():
- target = os.path.join(REPO, "targets", "ls_ttl")
- if not os.path.exists(target):
- src = os.path.join(REPO, "bin", "ls")
- os.makedirs(os.path.dirname(target), exist_ok=True)
- import shutil
- shutil.copy(src, target)
-
- c = IDAClient(timeout=300)
- c.connect()
- SHORT = 12 # worker self-exits after ~12s idle unless kept alive
-
- print("[heartbeat keeps a short-TTL worker alive]")
- sid = c.call("idb_open", input_path=target, idle_ttl_sec=SHORT)["session"]["session_id"]
- c.set_db(sid)
- ka = c.keepalive(interval=4.0).start()
- time.sleep(SHORT * 2 + 2) # idle well past the TTL, but heartbeat is beating
- ok = alive(c, sid)
- check("alive past 2x TTL with heartbeat", ok, f"beats={ka.beats}")
- check("heartbeat actually beat", ka.beats >= 4, f"beats={ka.beats}")
- check("heartbeat had no failures", ka.failures == 0, f"failures={ka.failures}")
- ka.stop()
-
- print("\n[bump_idle_ttl makes it effectively immortal]")
- sid = c.call("idb_open", input_path=target, idle_ttl_sec=SHORT)["session"]["session_id"]
- c.set_db(sid)
- c.bump_idle_ttl() # ~1e9 seconds
- time.sleep(SHORT * 2 + 6) # zero requests during this window
- check("alive past 2x TTL after bump, zero requests", alive(c, sid))
-
- c.close()
- print(f"\n{PASS} passed, {FAIL} failed")
- return 1 if FAIL else 0
-
-
-if __name__ == "__main__":
- raise SystemExit(main())