mirror of
https://github.com/floci-io/floci.git
synced 2026-12-06 03:28:18 -05:00
test(iot): use the shared TCP probe when MQTT is disabled (#10239)
The disabled-MQTT integration test checks the configured loopback listener with TcpListenerProbe.accepts, keeping its 250 ms connect timeout, and reports the listener's address if it accepts a connection. Signed-off-by: Jackson Price <jxnprice@amazon.com>
This commit is contained in:
1 parent
7beb09902b
commit
2e9697760a
1 file changed
+4
-6
@@ -1,13 +1,13 @@
|
||||
package io.floci.aws.services.iot;
|
||||
|
||||
import io.floci.aws.testing.IndependentServiceSettingsProfile;
|
||||
import io.floci.aws.testing.TcpListenerProbe;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.quarkus.test.junit.TestProfile;
|
||||
import org.eclipse.microprofile.config.inject.ConfigProperty;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.WebSocket;
|
||||
@@ -17,6 +17,7 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static io.floci.aws.testing.IndependentServiceSettingsProfile.IOT_MQTT_PORT;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
@@ -37,11 +38,8 @@ class IotMqttDisabledIntegrationTest {
|
||||
|
||||
@Test
|
||||
void disabledMqttDoesNotOpenConfiguredPort() {
|
||||
assertThrows(Exception.class, () -> {
|
||||
try (Socket socket = new Socket()) {
|
||||
socket.connect(new InetSocketAddress("127.0.0.1", IOT_MQTT_PORT), 250);
|
||||
}
|
||||
});
|
||||
InetSocketAddress listener = new InetSocketAddress("127.0.0.1", IOT_MQTT_PORT);
|
||||
assertFalse(TcpListenerProbe.accepts(listener, 250), "disabled MQTT listener accepts connections on " + listener);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user