mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
test: run the lazy MQTT start classes on ServicesOffSettingsProfile (#8870)
LazyMqttTestProfile only moved the broker to port 18838, off the shipped 1883 a developer's running Floci may hold; the test config already leaves auto-start off. Both classes stop the broker before and after each test, so they need no application of their own, and no class on ServicesOffSettingsProfile reaches the broker or calls IoT. The port becomes ServicesOffSettingsProfile.MQTT_PORT.
This commit is contained in:
1 parent
5548bb78eb
commit
1c3a6b615e
4 files changed
+20
-27
No files matched your search
@@ -1,5 +1,6 @@
|
||||
package io.floci.aws.services.iot;
|
||||
|
||||
import io.floci.aws.testing.ServicesOffSettingsProfile;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.quarkus.test.junit.TestProfile;
|
||||
import jakarta.inject.Inject;
|
||||
@@ -16,10 +17,10 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
@QuarkusTest
|
||||
@TestProfile(LazyMqttTestProfile.class)
|
||||
@TestProfile(ServicesOffSettingsProfile.class)
|
||||
class IotMqttLazyStartupIntegrationTest {
|
||||
|
||||
private static final int PORT = LazyMqttTestProfile.PORT;
|
||||
private static final int PORT = ServicesOffSettingsProfile.MQTT_PORT;
|
||||
|
||||
@Inject
|
||||
IotMqttBrokerService mqttBrokerService;
|
||||
|
||||
+3
-2
@@ -1,5 +1,6 @@
|
||||
package io.floci.aws.services.iot;
|
||||
|
||||
import io.floci.aws.testing.ServicesOffSettingsProfile;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.quarkus.test.junit.TestProfile;
|
||||
import jakarta.inject.Inject;
|
||||
@@ -32,10 +33,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
* broker, concurrent first ones all get a session, and an upgrade after a stop starts it again.
|
||||
*/
|
||||
@QuarkusTest
|
||||
@TestProfile(LazyMqttTestProfile.class)
|
||||
@TestProfile(ServicesOffSettingsProfile.class)
|
||||
class IotMqttWebSocketLazyStartIntegrationTest {
|
||||
|
||||
private static final int PORT = LazyMqttTestProfile.PORT;
|
||||
private static final int PORT = ServicesOffSettingsProfile.MQTT_PORT;
|
||||
|
||||
@ConfigProperty(name = "quarkus.http.test-port", defaultValue = "0")
|
||||
int testHttpPort;
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package io.floci.aws.services.iot;
|
||||
|
||||
import io.quarkus.test.junit.QuarkusTestProfile;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public final class LazyMqttTestProfile implements QuarkusTestProfile {
|
||||
|
||||
static final int PORT = 18838;
|
||||
|
||||
@Override
|
||||
public Map<String, String> getConfigOverrides() {
|
||||
return Map.of(
|
||||
"floci.services.iot.mqtt.enabled", "true",
|
||||
"floci.services.iot.mqtt.auto-start", "false",
|
||||
"floci.services.iot.mqtt.host", "127.0.0.1",
|
||||
"floci.services.iot.mqtt.port", Integer.toString(PORT));
|
||||
}
|
||||
}
|
||||
@@ -25,12 +25,18 @@ import java.util.Map;
|
||||
* {@code floci.services.servicequotas.standard-on-demand-vcpus=2}, refuses a launch that would run
|
||||
* more than two Standard On-Demand vCPUs. {@code Ec2VcpuAdmissionIntegrationTest} relies on
|
||||
* them.</li>
|
||||
* <li>{@code floci.services.iot.mqtt.port=}{@value #MQTT_PORT} moves the MQTT broker off the
|
||||
* shipped 1883, which a developer's running Floci may hold. The test config leaves
|
||||
* {@code auto-start} off, so the broker listens only once something needs it.
|
||||
* {@code IotMqttLazyStartupIntegrationTest} and {@code IotMqttWebSocketLazyStartIntegrationTest}
|
||||
* rely on it: they check what starts it, and stop it before and after each test.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>Each is inert for the other classes: none of them calls a service switched off here, files a
|
||||
* delegation request as the partner account, restores an S3 object or launches an instance. Their
|
||||
* requests go to IAM, CloudFormation for an IAM role, S3, EC2 and Service Quotas, and to the
|
||||
* disabled services only from {@code ServiceEnablementIntegrationTest}. It stays apart from
|
||||
* delegation request as the partner account, restores an S3 object, launches an instance or
|
||||
* reaches the MQTT broker. Their requests go to IAM, CloudFormation for an IAM role, S3, EC2,
|
||||
* Service Quotas and IoT, and to the disabled services only from
|
||||
* {@code ServiceEnablementIntegrationTest}. It stays apart from
|
||||
* {@link ScopedServiceSettingsProfile}, whose classes call DynamoDB, ECS and FIS.
|
||||
*
|
||||
* <p>A class joins if it calls none of the services switched off here, if every other setting here
|
||||
@@ -39,6 +45,9 @@ import java.util.Map;
|
||||
*/
|
||||
public class ServicesOffSettingsProfile implements QuarkusTestProfile {
|
||||
|
||||
/** The port the MQTT broker listens on once something starts it. */
|
||||
public static final int MQTT_PORT = 18838;
|
||||
|
||||
@Override
|
||||
public Map<String, String> getConfigOverrides() {
|
||||
return Map.ofEntries(
|
||||
@@ -56,6 +65,7 @@ public class ServicesOffSettingsProfile implements QuarkusTestProfile {
|
||||
"src/test/resources/partner-permission-boundaries.json"),
|
||||
Map.entry("floci.services.s3.restore-completion-delay-seconds", "60"),
|
||||
Map.entry("floci.services.ec2.enforce-vcpu-quotas", "true"),
|
||||
Map.entry("floci.services.servicequotas.standard-on-demand-vcpus", "2"));
|
||||
Map.entry("floci.services.servicequotas.standard-on-demand-vcpus", "2"),
|
||||
Map.entry("floci.services.iot.mqtt.port", Integer.toString(MQTT_PORT)));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user