From f40402fa93225a05621b74fbc7bd1ceb635b8fa7 Mon Sep 17 00:00:00 2001 From: Kenshin Okinaka Date: Tue, 29 Sep 2026 01:09:46 +0900 Subject: [PATCH] test(iot): wait for the MQTT ports to close around the failed restart (#4533) * fix(test): wait for the MQTT listeners to close before blocking the TLS port * test(iot): wait for the plain port to close after the failed restart --- .../floci/services/iot/IotMqttBrokerServiceTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttBrokerServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttBrokerServiceTest.java index 3ca77e0d25..e94d367c63 100644 --- a/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttBrokerServiceTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttBrokerServiceTest.java @@ -668,11 +668,14 @@ class IotMqttBrokerServiceTest { void aFailedRestartKeepsRulesOff() throws Exception { broker.startIfEnabled(); broker.stop(); + awaitClosed(plainPort); + awaitClosed(tlsPort); try (ServerSocket blocker = new ServerSocket()) { blocker.bind(new InetSocketAddress("127.0.0.1", tlsPort)); assertThrows(IllegalStateException.class, broker::startIfEnabled); assertFalse(rulesRun(), "a failed restart leaves rules off"); + awaitClosed(plainPort); } broker.startIfEnabled();