aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-10-07 21:31:07 +0200
committerChristophe Besson <cbesson@gmail.com>2026-10-07 22:22:51 +0200
commite0dde3466fcb06570cc41b1c379707b2807040ad (patch)
treeb381337f127ada94a63afc9453d3c34f5671a470 /packages/meshbay-node
parente833fe1bfc8eb6f66cc5dc53997cc4158bab583f (diff)
downloadmeshbay-e0dde3466fcb06570cc41b1c379707b2807040ad.tar.gz
test(node): check the startup mode in the Windows end-to-end test
The boot task or the sign-in launcher, as chosen, and the node in session 0 for the service's S4U logon or in the signed-in session otherwise. Passed in service and sign-in modes on the installed 0.18.0 build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-node')
-rw-r--r--packages/meshbay-node/tests/test_e2e_windows_app.py27
1 files changed, 22 insertions, 5 deletions
diff --git a/packages/meshbay-node/tests/test_e2e_windows_app.py b/packages/meshbay-node/tests/test_e2e_windows_app.py
index b407aa8..86e6a62 100644
--- a/packages/meshbay-node/tests/test_e2e_windows_app.py
+++ b/packages/meshbay-node/tests/test_e2e_windows_app.py
@@ -66,11 +66,20 @@ def _launch(argv: list[str]) -> None:
subprocess.Popen(argv, creationflags=0x00000008 | 0x00000200, close_fds=True)
-def _node_pids() -> list[int]:
+def _node_processes() -> dict[int, int]:
+ """Every meshbay-node.exe, pid -> Windows session number."""
r = subprocess.run(["tasklist", "/FI", "IMAGENAME eq meshbay-node.exe", "/NH", "/FO", "CSV"],
capture_output=True, text=True)
- return [int(c[1]) for c in (line.split('","') for line in r.stdout.splitlines())
- if len(c) > 1 and c[1].isdigit()]
+ rows = (line.strip('"').split('","') for line in r.stdout.splitlines())
+ return {int(c[1]): int(c[3]) for c in rows if len(c) > 3 and c[1].isdigit()}
+
+
+def _node_pids() -> list[int]:
+ return list(_node_processes())
+
+
+STARTUP_VBS = (APPDATA / "Microsoft" / "Windows" / "Start Menu" / "Programs" / "Startup"
+ / "MeshBay Node.vbs")
def _wait(what: str, cond, timeout: float, every: float = 1.0):
@@ -201,9 +210,13 @@ def app(hub):
if there.exists():
pytest.fail(f"{there} exists: this test only runs on a machine with no node "
"and no app profile -- move them aside, it never deletes them")
+ task = subprocess.run(["schtasks", "/query", "/tn", "MeshBay Node"],
+ capture_output=True).returncode == 0
if MODE == "service":
- r = subprocess.run(["schtasks", "/query", "/tn", "MeshBay Node"], capture_output=True)
- assert r.returncode == 0, "service mode chosen at install, but there is no boot task"
+ assert task, "service mode chosen at install, but there is no boot task"
+ else:
+ assert not task, f"{MODE} mode chosen at install, but the boot task is still there"
+ assert STARTUP_VBS.exists() == (MODE == "signin"), "the sign-in launcher"
APP_PROFILE.mkdir(parents=True)
(APP_PROFILE / "config.json").write_text(json.dumps({"hubBase": hub["url"]}),
encoding="utf-8")
@@ -265,6 +278,10 @@ def test_a_fresh_account_gets_its_node_set_up_and_can_stop_it(app, hub):
token = page.eval("JSON.parse(localStorage.getItem('mb_auth')).token")
keys = json.loads(_http_get(f"{hub['url']}/v1/users/{username}/pubkeys", token))
assert keys.get("pk_node_ed25519") == status["pk_node_ed25519"]
+ # Where it runs is the mode: session 0 for the boot task's S4U logon, the
+ # signed-in session otherwise.
+ session = _node_processes()[status["pid"]]
+ assert (session == 0) == (MODE == "service"), f"{MODE} mode, node in session {session}"
# Stop: no process left, and only then "Stopped".
page.eval("(location.hash = '#/node', 1)")