aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-cli/tests/test_e2e_local.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-cli/tests/test_e2e_local.py')
-rw-r--r--packages/meshbay-cli/tests/test_e2e_local.py38
1 files changed, 25 insertions, 13 deletions
diff --git a/packages/meshbay-cli/tests/test_e2e_local.py b/packages/meshbay-cli/tests/test_e2e_local.py
index b131658..385693d 100644
--- a/packages/meshbay-cli/tests/test_e2e_local.py
+++ b/packages/meshbay-cli/tests/test_e2e_local.py
@@ -196,7 +196,14 @@ def _build(root: Path, procs: list) -> dict:
_wait_http(f"http://127.0.0.1:{ui_port}/", timeout=90)
# Attaching reloads the node by itself; the key needs the group loaded.
- run_node("group", "add", group_id, "--dir", str(share))
+ # The control API answers before the hub socket is up, later still now
+ # that the connection processes start first.
+ deadline = time.monotonic() + 90
+ while "Hub not connected" in (out := _try(run_node, "group", "add", group_id,
+ "--dir", str(share))):
+ assert time.monotonic() < deadline, f"group add never succeeded: {out}"
+ time.sleep(1)
+ assert "meshbay-node (" not in out, out
deadline = time.monotonic() + 90
while "GEK ready" not in (out := _try(run_node, "gek", "init", "--group", group_id)):
assert time.monotonic() < deadline, f"gek init never succeeded: {out}"
@@ -781,7 +788,11 @@ class _Chrome:
target = next(p for p in pages if p["type"] == "page")
break
except (httpx.HTTPError, StopIteration):
- assert time.monotonic() < deadline, "Chrome did not come up"
+ if time.monotonic() > deadline:
+ # Not left running: nobody holds this object to close it.
+ self.proc.kill()
+ self.proc.wait(10)
+ raise AssertionError("Chrome did not come up") from None
time.sleep(0.2)
self.ws = connect(target["webSocketDebuggerUrl"], max_size=None)
self.n = 0
@@ -1375,17 +1386,18 @@ def test_tab_completes_remote_paths_from_the_real_node(world):
assert complete("ls", "No such group/") == [] # nothing, quietly
# bash itself: the function the script installs, on a word typed with its
- # spaces escaped, as bash hands it over.
- script = cli(world, "completion", "bash").stdout
- escaped = group[:10].replace(" ", "\\ ")
- bash = subprocess.run(
- ["bash", "-c", script + "\nCOMP_WORDS=(meshbay-cli ls " + escaped + ")\n"
- "COMP_CWORD=2\n_meshbay_cli\nprintf '%s\\n' \"${COMPREPLY[@]}\"\n"],
- env={**os.environ, "MESHBAY_CLI_HOME": str(world["root"] / "cli-chat"),
- "PYTHON_KEYRING_BACKEND": "keyring.backends.fail.Keyring",
- "PATH": f"{BIN}{os.pathsep}{os.environ['PATH']}"},
- capture_output=True, text=True, encoding="utf-8", timeout=60)
- assert bash.stdout.splitlines() == [group + "/"], (bash.stdout, bash.stderr)
+ # spaces escaped, as bash hands it over. On Windows, where Git's is on PATH.
+ if shutil.which("bash"):
+ script = cli(world, "completion", "bash").stdout
+ escaped = group[:10].replace(" ", "\\ ")
+ bash = subprocess.run(
+ ["bash", "-c", script + "\nCOMP_WORDS=(meshbay-cli ls " + escaped + ")\n"
+ "COMP_CWORD=2\n_meshbay_cli\nprintf '%s\\n' \"${COMPREPLY[@]}\"\n"],
+ env={**os.environ, "MESHBAY_CLI_HOME": str(world["root"] / "cli-chat"),
+ "PYTHON_KEYRING_BACKEND": "keyring.backends.fail.Keyring",
+ "PATH": f"{BIN}{os.pathsep}{os.environ['PATH']}"},
+ capture_output=True, text=True, encoding="utf-8", timeout=60)
+ assert bash.stdout.splitlines() == [group + "/"], (bash.stdout, bash.stderr)
# PowerShell 7, or Windows PowerShell 5.1, which decodes a program's output
# with the console's code page unless told otherwise: an accented name is the