blob: c0c15687f494f3bbb3dd566df47d8f5548bd8866 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
"""
The QUIC MNP listener is off unless the operator turns it on.
No shipping client speaks QUIC (browser and desktop use WebRTC; the hub-less
`group://` sidecar is unbuilt), so a node that started it by default would only
be exposing a UDP port. `daemon.py` gates `QuicChunkServer` on
`self._config.node.quic_enabled`; these follow the value down the config path.
"""
import textwrap
from pathlib import Path
from meshbay_node.config import load_config
def _cfg(tmp_path: Path, body: str):
p = tmp_path / "node.toml"
p.write_text(textwrap.dedent(body))
return load_config(p)
def test_off_by_default(tmp_path):
cfg = _cfg(tmp_path, """
[node]
quic_port = 19010
""")
assert cfg.node.quic_enabled is False
def test_the_operator_turns_it_on(tmp_path):
cfg = _cfg(tmp_path, """
[node]
quic_enabled = true
""")
assert cfg.node.quic_enabled is True
def test_the_environment_can_force_it_on(tmp_path, monkeypatch):
monkeypatch.setenv("MESHBAY_QUIC_ENABLED", "1")
cfg = _cfg(tmp_path, """
[node]
quic_enabled = false
""")
assert cfg.node.quic_enabled is True
def test_the_environment_can_force_it_off(tmp_path, monkeypatch):
monkeypatch.setenv("MESHBAY_QUIC_ENABLED", "false")
cfg = _cfg(tmp_path, """
[node]
quic_enabled = true
""")
assert cfg.node.quic_enabled is False
|