Skip to content

armgit / floci

Public Imported from GitHub
0

Light, fluffy, and always free - The AWS Local Emulator alternative

test(iot): wait for the MQTT ports to close around the failed restart (#4533)

Kenshin Okinakaf40402fa9322
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();