aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests/test_node_page_connection_processes.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-10-11 19:09:04 +0200
committerChristophe Besson <cbesson@gmail.com>2026-10-11 19:09:04 +0200
commit176b5ed563f7022009b70751e62b7ee7901e6da0 (patch)
treedfc3d3b4653cb63ef680cfd5d914fe52ba3a9635 /packages/meshbay-hub/tests/test_node_page_connection_processes.py
parentaca58f66df5c21be71a7159620d0b50bb969199f (diff)
downloadmeshbay-176b5ed563f7022009b70751e62b7ee7901e6da0.tar.gz
feat(node): carry connections on several cores
connection_processes (default 1) starts that many processes for the WebRTC stack; sessions and keys stay in the node. Set from node.toml or the Node page, applied to new connections. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/tests/test_node_page_connection_processes.py')
-rw-r--r--packages/meshbay-hub/tests/test_node_page_connection_processes.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/packages/meshbay-hub/tests/test_node_page_connection_processes.py b/packages/meshbay-hub/tests/test_node_page_connection_processes.py
new file mode 100644
index 0000000..0342e6c
--- /dev/null
+++ b/packages/meshbay-hub/tests/test_node_page_connection_processes.py
@@ -0,0 +1,38 @@
+"""
+The Node page offers `connection_processes`, bounded by the machine's cores.
+
+The node refuses a number above its core count, so a field that let one be
+typed would be a field whose Save fails. The ceiling comes with the settings
+(`cpu_count`, which the node adds and ignores when it is sent back).
+"""
+
+import re
+from pathlib import Path
+
+STATIC = Path(__file__).resolve().parents[1] / "src" / "meshbay_hub" / "static"
+
+
+def _field() -> str:
+ src = (STATIC / "node-page.js").read_text(encoding="utf-8")
+ at = src.index("t('node.setting_connection_processes')")
+ return src[at:src.index("</label>", at)]
+
+
+def test_the_field_cannot_hold_more_than_the_cores():
+ field = _field()
+ assert "max=${editSettings.cpu_count || 1}" in field
+ assert re.search(r"Math\.min\(Math\.max\(parseInt\(e\.target\.value\) \|\| 1, 1\), "
+ r"s\.cpu_count \|\| 1\)", field), (
+ "a typed value is not held to the ceiling, only the spinner is")
+
+
+def test_it_says_how_many_cores_there_are():
+ assert "t('node.setting_unit_of', { n: editSettings.cpu_count || 1 })" in _field()
+
+
+def test_every_language_names_it():
+ for locale in sorted((STATIC / "locales").glob("*.js")):
+ text = locale.read_text(encoding="utf-8")
+ assert "'node.setting_connection_processes':" in text, locale.name
+ m = re.search(r"'node\.setting_unit_of': '([^']*)'", text)
+ assert m and "{n}" in m.group(1), locale.name