mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(iot): deflake MQTT lazy-startup test, align 1.5.28 version, make compat runner executable (#1580)
* test(iot): wait for broker port release in MQTT lazy-startup test Vert.x MqttServer.close() can resolve before the OS releases the listening socket, so a connect immediately after stop() may still succeed. @BeforeEach now polls until the port refuses connections before each test asserts the broker is not listening, fixing the IotMqttLazyStartupIntegrationTest flake under the full ordered suite that was failing CI on main. * chore(release): set version to 1.5.28 Align pom.xml with the 1.5.28 release commit and CHANGELOG header; it had been left at 1.6.0. * ci: make run-docker-tests.sh executable The compat test runner lacked the execute bit, so ./docker/run-docker-tests.sh failed with permission denied (exit 126).
This commit is contained in:
1 parent
ac7ce1d59d
commit
68fc4134c4
3 files changed
+22
-2
No files matched your search
+21
-1
@@ -26,8 +26,28 @@ class IotMqttLazyStartupIntegrationTest {
|
||||
IotMqttBrokerService mqttBrokerService;
|
||||
|
||||
@BeforeEach
|
||||
void stopBroker() {
|
||||
void stopBroker() throws InterruptedException {
|
||||
mqttBrokerService.stop();
|
||||
awaitPortClosed(PORT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vert.x's {@code MqttServer.close()} future can resolve a moment before the OS
|
||||
* releases the listening socket, so a fresh connect immediately after {@link
|
||||
* IotMqttBrokerService#stop()} may still succeed. Poll until the port actually
|
||||
* refuses connections before a test asserts the broker is not listening — this
|
||||
* removes a startup-order race that only surfaced under the full ordered suite.
|
||||
*/
|
||||
private static void awaitPortClosed(int port) throws InterruptedException {
|
||||
long deadline = System.currentTimeMillis() + 5_000;
|
||||
while (System.currentTimeMillis() < deadline) {
|
||||
try (Socket socket = new Socket()) {
|
||||
socket.connect(new InetSocketAddress("127.0.0.1", port), 100);
|
||||
} catch (Exception refused) {
|
||||
return; // connection refused — the broker port is closed
|
||||
}
|
||||
Thread.sleep(50); // still accepting connections; back off and retry
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user