diff --git a/stage_ui/console_core/backend/test_core_services.py b/stage_ui/console_core/backend/test_core_services.py index 3a97022..c1e2af9 100644 --- a/stage_ui/console_core/backend/test_core_services.py +++ b/stage_ui/console_core/backend/test_core_services.py @@ -10,6 +10,26 @@ SPEC.loader.exec_module(provider) class ReverseTunnelBootstrapTest(unittest.TestCase): + def test_mqtt_bridge_card_keeps_remote_port_without_network_probe(self): + unit = { + "active": True, + "active_state": "active", + "result": "success", + "exec_main_status": "0", + "raw_error": "", + } + context = { + "read_env_file": lambda _path: {"ENABLE_BRIDGE": "1", "REMOTE_HOST": "mqtt.example", "REMOTE_PORT": "8883"}, + "file_exists": lambda _path: True, + "any_exists": lambda _paths: True, + "systemd_unit": lambda _name: dict(unit), + } + + card = provider.mqtt_bridge_card(context) + + self.assertTrue(card["active"]) + self.assertIn({"label": "Remote port", "value": "8883"}, card["details"]) + def test_bootstrap_generation_never_calls_external_network(self): files = { "/etc/hostname": "g-box-12345678\n", diff --git a/stage_ui/console_core/providers/00_core_services.py b/stage_ui/console_core/providers/00_core_services.py index 9b42c97..be20fc4 100644 --- a/stage_ui/console_core/providers/00_core_services.py +++ b/stage_ui/console_core/providers/00_core_services.py @@ -513,6 +513,7 @@ def mqtt_bridge_card(ctx): ]) ) remote_host = str(env.get("REMOTE_HOST", "")).strip() + remote_port = str(env.get("REMOTE_PORT", "1883")).strip() or "1883" mosquitto = ctx["systemd_unit"]("mosquitto.service") health_timer = ctx["systemd_unit"]("iomatex-mqtt-health.timer") active = bool(enabled and remote_host and bridge_conf_exists and mosquitto["active"])