diff options
Diffstat (limited to 'packages/meshbay-cli/tests/test_e2e_local.py')
| -rw-r--r-- | packages/meshbay-cli/tests/test_e2e_local.py | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/packages/meshbay-cli/tests/test_e2e_local.py b/packages/meshbay-cli/tests/test_e2e_local.py index 85e5e85..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}" @@ -1379,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 |