mirror of
https://github.com/ipnet-mesh/meshcore-mqtt.git
synced 2026-07-06 01:41:22 +02:00
fix: update default TCP port from 12345 to 5000 in code and tests
Updates the default TCP port throughout the codebase to match the documentation changes made in the previous commit. Changes: - config.py: Update TCP port validator default (line 136) - config.py: Update environment variable fallback default (line 255) - test_config.py: Update test assertions (lines 117, 145) - test_bridge.py: Update test assertion and fixture (lines 23, 63) - test_command_forwarding.py: Update test fixture (line 20) - test_rate_limiting.py: Update test fixtures (lines 22, 37) Co-authored-by: JingleManSweep <jinglemansweep@users.noreply.github.com>
This commit is contained in:
@@ -133,7 +133,7 @@ class MeshCoreConfig(BaseModel):
|
||||
|
||||
# Set default port for TCP if None provided
|
||||
if connection_type == ConnectionType.TCP and v is None:
|
||||
v = 12345
|
||||
v = 5000
|
||||
|
||||
if v is not None and not 1 <= v <= 65535:
|
||||
raise ValueError("Port must be between 1 and 65535")
|
||||
@@ -252,7 +252,7 @@ class Config(BaseModel):
|
||||
connection_type=ConnectionType(os.getenv("MESHCORE_CONNECTION", "tcp")),
|
||||
address=os.getenv("MESHCORE_ADDRESS", ""),
|
||||
port=(
|
||||
int(os.getenv("MESHCORE_PORT", "12345"))
|
||||
int(os.getenv("MESHCORE_PORT", "5000"))
|
||||
if os.getenv("MESHCORE_PORT")
|
||||
else None
|
||||
),
|
||||
|
||||
@@ -20,7 +20,7 @@ def test_config() -> Config:
|
||||
meshcore=MeshCoreConfig(
|
||||
connection_type=ConnectionType.TCP,
|
||||
address="127.0.0.1",
|
||||
port=12345,
|
||||
port=5000,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -60,7 +60,7 @@ class TestBridgeCoordinator:
|
||||
bridge = BridgeCoordinator(test_config)
|
||||
assert bridge.config.meshcore.connection_type == ConnectionType.TCP
|
||||
assert bridge.config.meshcore.address == "127.0.0.1"
|
||||
assert bridge.config.meshcore.port == 12345
|
||||
assert bridge.config.meshcore.port == 5000
|
||||
|
||||
def test_serial_connection_config(self) -> None:
|
||||
"""Test serial connection configuration."""
|
||||
|
||||
@@ -17,7 +17,7 @@ def test_config() -> Config:
|
||||
meshcore=MeshCoreConfig(
|
||||
connection_type=ConnectionType.TCP,
|
||||
address="127.0.0.1",
|
||||
port=12345,
|
||||
port=5000,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -110,11 +110,11 @@ class TestMeshCoreConfig:
|
||||
def test_valid_tcp_config(self) -> None:
|
||||
"""Test valid TCP configuration."""
|
||||
config = MeshCoreConfig(
|
||||
connection_type=ConnectionType.TCP, address="192.168.1.100", port=12345
|
||||
connection_type=ConnectionType.TCP, address="192.168.1.100", port=5000
|
||||
)
|
||||
assert config.connection_type == ConnectionType.TCP
|
||||
assert config.address == "192.168.1.100"
|
||||
assert config.port == 12345
|
||||
assert config.port == 5000
|
||||
assert config.timeout == 5
|
||||
|
||||
def test_valid_serial_config(self) -> None:
|
||||
@@ -142,7 +142,7 @@ class TestMeshCoreConfig:
|
||||
config = MeshCoreConfig(
|
||||
connection_type=ConnectionType.TCP, address="192.168.1.100", port=None
|
||||
)
|
||||
assert config.port == 12345
|
||||
assert config.port == 5000
|
||||
|
||||
def test_custom_baudrate(self) -> None:
|
||||
"""Test custom baudrate for serial connections."""
|
||||
|
||||
@@ -19,7 +19,7 @@ def test_config() -> Config:
|
||||
meshcore=MeshCoreConfig(
|
||||
connection_type=ConnectionType.TCP,
|
||||
address="127.0.0.1",
|
||||
port=12345,
|
||||
port=5000,
|
||||
message_initial_delay=0.1, # 100ms for faster tests
|
||||
message_send_delay=0.2, # 200ms for faster tests
|
||||
),
|
||||
@@ -34,7 +34,7 @@ def test_config_zero_delays() -> Config:
|
||||
meshcore=MeshCoreConfig(
|
||||
connection_type=ConnectionType.TCP,
|
||||
address="127.0.0.1",
|
||||
port=12345,
|
||||
port=5000,
|
||||
message_initial_delay=0.0,
|
||||
message_send_delay=0.0,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user