diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-10-16 10:41:17 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-10-16 10:41:17 +0200 |
| commit | 9236ffdb295301f8cd61ad34689f84cf685d676e (patch) | |
| tree | 7f1d71b70aeaac6b095ae3d4fd491b28aeadce77 /packages/meshbay-node/tests | |
| parent | 4802be13580de1529b7824a2337d132d64849801 (diff) | |
| download | meshbay-9236ffdb295301f8cd61ad34689f84cf685d676e.tar.gz | |
feat(node): connection processes on by default, one per core up to four
At 1 no process starts and every lane of a download lands on the node's
one core. The Node page also sent every setting on each Save, pinning
untouched ones at the day's default; it sends only what changed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-node/tests')
| -rw-r--r-- | packages/meshbay-node/tests/test_connection_processes.py | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/packages/meshbay-node/tests/test_connection_processes.py b/packages/meshbay-node/tests/test_connection_processes.py index ab9dfd3..778da5a 100644 --- a/packages/meshbay-node/tests/test_connection_processes.py +++ b/packages/meshbay-node/tests/test_connection_processes.py @@ -13,6 +13,7 @@ not carry. """ import asyncio +import re import struct from pathlib import Path @@ -231,11 +232,21 @@ async def test_one_process_starts_none(): # ── the setting ───────────────────────────────────────────────────────────── -def test_the_default_is_one_process(tmp_path): - assert node_settings_defaults()["connection_processes"] == 1 +@pytest.mark.parametrize("cores, expected", [(1, 1), (2, 2), (4, 4), (28, 4)]) +def test_the_default_is_one_per_core_up_to_four(tmp_path, monkeypatch, cores, expected): + """It was 1, which starts none: the path was shipped and reached by no node + whose operator had not found the setting.""" + monkeypatch.setattr("meshbay_node.config.max_processes", lambda: cores) + assert node_settings_defaults()["connection_processes"] == expected conf = tmp_path / "node.toml" conf.write_text('[hub]\nurl = "https://example.invalid"\nusername = "op"\n') - assert load_config(conf).node.connection_processes == 1 + assert load_config(conf).node.connection_processes == expected + + +def test_a_new_node_toml_leaves_it_to_the_default(tmp_path): + from meshbay_node.config import EXAMPLE_CONFIG + assert not re.search(r"^connection_processes\s*=", EXAMPLE_CONFIG, re.M), ( + "a value written by `init` is a value no later default reaches") def test_node_toml_cannot_ask_for_more_than_the_cores(tmp_path): @@ -296,4 +307,5 @@ async def test_a_number_the_machine_cannot_honour_is_refused(state, monkeypatch, with pytest.raises(ops.OpError): await ops.set_node_settings(state, {"connection_processes": value}) assert state["webrtc"].asked == [] - assert (await ops.get_node_settings(state))["connection_processes"] == 1 + assert ((await ops.get_node_settings(state))["connection_processes"] + == state["config"].node.connection_processes) |