Skip to content

armgit / floci

Public Imported from GitHub
0

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

test: move seven more single-setting test classes onto the shared profile (#6068)

Priamo Germosen9d1565fda3e5
diff --git a/src/test/java/io/github/hectorvent/floci/services/bedrockruntime/BedrockProxyInvalidUrlIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/bedrockruntime/BedrockProxyInvalidUrlIntegrationTest.java
index 913693bf5e..3f3862143c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/bedrockruntime/BedrockProxyInvalidUrlIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/bedrockruntime/BedrockProxyInvalidUrlIntegrationTest.java
@@ -1,21 +1,24 @@
package io.github.hectorvent.floci.services.bedrockruntime;
+import io.github.hectorvent.floci.testing.IndependentServiceSettingsProfile;
import io.quarkus.test.junit.QuarkusTest;
-import io.quarkus.test.junit.QuarkusTestProfile;
import io.quarkus.test.junit.TestProfile;
import org.junit.jupiter.api.Test;
-import java.util.Map;
-
import static io.restassured.RestAssured.given;
+import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
/**
* Verifies a syntactically-invalid {@code proxy.url} surfaces as a clean
* 400 ValidationException rather than an unmapped IllegalArgumentException.
+ *
+ * <p>The proxy backend, its invalid URL and the model passthrough that gets a call as far as the
+ * URL come from {@link IndependentServiceSettingsProfile}, which this class shares with other
+ * classes that each call a different service.
*/
@QuarkusTest
-@TestProfile(BedrockProxyInvalidUrlIntegrationTest.InvalidUrlProfile.class)
+@TestProfile(IndependentServiceSettingsProfile.class)
class BedrockProxyInvalidUrlIntegrationTest {
private static final String AUTH_HEADER =
@@ -33,17 +36,7 @@ class BedrockProxyInvalidUrlIntegrationTest {
.post("/model/anthropic.claude-3-haiku-20240307-v1:0/converse")
.then()
.statusCode(400)
- .body("__type", equalTo("ValidationException"));
- }
-
- public static final class InvalidUrlProfile implements QuarkusTestProfile {
- @Override
- public Map<String, String> getConfigOverrides() {
- return Map.of(
- "floci.services.bedrock-runtime.backend", "proxy",
- "floci.services.bedrock-runtime.proxy.url", "not a valid url",
- "floci.services.bedrock-runtime.proxy.passthrough", "true"
- );
- }
+ .body("__type", equalTo("ValidationException"))
+ .body("message", containsString("proxy.url is not a valid URL"));
}
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2VolumeBlockDeviceDockerIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2VolumeBlockDeviceDockerIntegrationTest.java
index 22a450f341..7956506684 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2VolumeBlockDeviceDockerIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2VolumeBlockDeviceDockerIntegrationTest.java
@@ -14,8 +14,8 @@ import io.github.hectorvent.floci.services.ec2.model.Placement;
import io.github.hectorvent.floci.services.ec2.model.Volume;
import io.github.hectorvent.floci.services.ec2.model.VolumeAttachment;
import io.github.hectorvent.floci.services.ec2.model.VolumeModification;
+import io.github.hectorvent.floci.testing.IndependentServiceSettingsProfile;
import io.quarkus.test.junit.QuarkusTest;
-import io.quarkus.test.junit.QuarkusTestProfile;
import io.quarkus.test.junit.TestProfile;
import jakarta.inject.Inject;
import org.jboss.logging.Logger;
@@ -27,7 +27,6 @@ import org.junit.jupiter.api.Test;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
@@ -39,20 +38,18 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
+/**
+ * EBS volumes backed by real storage: attaching one gives a running instance container a block
+ * device of the right size, and detaching, resizing, restoring and deleting it act on that device
+ * and its backing file.
+ *
+ * <p>Real instances and volume block devices come from {@link IndependentServiceSettingsProfile},
+ * which this class shares with other classes that each call a different service.
+ */
@QuarkusTest
-@TestProfile(Ec2VolumeBlockDeviceDockerIntegrationTest.Profile.class)
+@TestProfile(IndependentServiceSettingsProfile.class)
class Ec2VolumeBlockDeviceDockerIntegrationTest {
- public static class Profile implements QuarkusTestProfile {
- @Override
- public Map<String, String> getConfigOverrides() {
- return Map.of(
- "floci.services.ec2.mock", "false",
- "floci.services.ec2.volume-block-devices", "true"
- );
- }
- }
-
@Inject
Ec2Service ec2Service;
@@ -127,6 +124,7 @@ class Ec2VolumeBlockDeviceDockerIntegrationTest {
}
instancesToClean.clear();
+ // After the volumes: detaching one from a cluster node finds the node through the provider.
ec2Service.setClusterNodeInstanceProvider(null);
for (String cid : containersToClean) {
@@ -380,8 +378,6 @@ class Ec2VolumeBlockDeviceDockerIntegrationTest {
ContainerExec.Result checkDev = execIn(containerId, "test -b /dev/xvdf || test -L /dev/xvdf");
assertEquals(0, checkDev.exitCode(), "Block device should exist inside cluster node container: " + checkDev.summary());
-
- ec2Service.setClusterNodeInstanceProvider(null);
}
@Test
@@ -396,6 +392,7 @@ class Ec2VolumeBlockDeviceDockerIntegrationTest {
instance.setPlacement(placement);
instance.setState(InstanceState.running());
ec2Service.putInstanceForTest(instance);
+ instancesToClean.add(instance.getInstanceId());
Volume volume = ec2Service.createVolume("us-east-1", "us-east-1a", "gp3", 1, false, 3000, 125, null, null);
volumesToClean.add(volume.getVolumeId());
diff --git a/src/test/java/io/github/hectorvent/floci/services/firehose/FirehoseFlushRecordCountIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/firehose/FirehoseFlushRecordCountIntegrationTest.java
index cb080c03a7..33e9034593 100644
--- a/src/test/java/io/github/hectorvent/floci/services/firehose/FirehoseFlushRecordCountIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/firehose/FirehoseFlushRecordCountIntegrationTest.java
@@ -1,8 +1,8 @@
package io.github.hectorvent.floci.services.firehose;
+import io.github.hectorvent.floci.testing.IndependentServiceSettingsProfile;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
-import io.quarkus.test.junit.QuarkusTestProfile;
import io.quarkus.test.junit.TestProfile;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
@@ -10,12 +10,13 @@ import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
-import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.hasItem;
+import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -25,20 +26,16 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
*
* Kept separate from {@link FirehoseFlushIntegrationTest} (size and interval
* triggers) because this class needs a different config override and a
- * Quarkus test profile applies to the whole class.
+ * Quarkus test profile applies to the whole class. The override comes from
+ * {@link IndependentServiceSettingsProfile}, which this class shares with other
+ * classes that each call a different service, so it deletes its delivery
+ * stream and the bucket Firehose created for it.
*/
@QuarkusTest
-@TestProfile(FirehoseFlushRecordCountIntegrationTest.FlushEveryRecordProfile.class)
+@TestProfile(IndependentServiceSettingsProfile.class)
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class FirehoseFlushRecordCountIntegrationTest {
- public static class FlushEveryRecordProfile implements QuarkusTestProfile {
- @Override
- public Map<String, String> getConfigOverrides() {
- return Map.of("floci.services.firehose.flush-record-count", "1");
- }
- }
-
private static final String STREAM_NAME = "test-flush-count-stream";
private static final String BUCKET = "flush-count-archive";
private static final String CONTENT_TYPE = "application/x-amz-json-1.1";
@@ -106,4 +103,44 @@ class FirehoseFlushRecordCountIntegrationTest {
.statusCode(200)
.body(equalTo("{\"n\":1}\n"));
}
+
+ /**
+ * Runs last, since the tests above share the stream: deletes the delivery stream, the record it
+ * delivered and the bucket Firehose created for it.
+ */
+ @Test
+ @Order(3)
+ void cleanupDeletesTheStreamAndBucketItCreated() {
+ given()
+ .contentType(CONTENT_TYPE)
+ .header("X-Amz-Target", TARGET_PREFIX + "DeleteDeliveryStream")
+ .body("{ \"DeliveryStreamName\": \"" + STREAM_NAME + "\" }")
+ .when()
+ .post("/")
+ .then()
+ .statusCode(200);
+
+ String listing = given()
+ .when()
+ .get("/" + BUCKET)
+ .then()
+ .statusCode(200)
+ .extract().asString();
+ Matcher key = Pattern.compile("<Key>([^<]+)</Key>").matcher(listing);
+ while (key.find()) {
+ given().when().delete("/" + BUCKET + "/" + key.group(1)).then().statusCode(204);
+ }
+ given().when().delete("/" + BUCKET).then().statusCode(204);
+
+ given()
+ .contentType(CONTENT_TYPE)
+ .header("X-Amz-Target", TARGET_PREFIX + "ListDeliveryStreams")
+ .body("{}")
+ .when()
+ .post("/")
+ .then()
+ .statusCode(200)
+ .body("DeliveryStreamNames", not(hasItem(STREAM_NAME)));
+ given().when().head("/" + BUCKET).then().statusCode(404);
+ }
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttDisabledIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttDisabledIntegrationTest.java
index 2c5080d384..b7eb232cf8 100644
--- a/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttDisabledIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttDisabledIntegrationTest.java
@@ -1,7 +1,7 @@
package io.github.hectorvent.floci.services.iot;
+import io.github.hectorvent.floci.testing.IndependentServiceSettingsProfile;
import io.quarkus.test.junit.QuarkusTest;
-import io.quarkus.test.junit.QuarkusTestProfile;
import io.quarkus.test.junit.TestProfile;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.junit.jupiter.api.Test;
@@ -12,20 +12,26 @@ import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.WebSocket;
import java.net.http.WebSocketHandshakeException;
-import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
+import static io.github.hectorvent.floci.testing.IndependentServiceSettingsProfile.IOT_MQTT_PORT;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertThrows;
+/**
+ * With the MQTT broker off, nothing listens on its configured port and the MQTT WebSocket upgrade
+ * is refused with 503.
+ *
+ * <p>The broker settings, port {@link IndependentServiceSettingsProfile#IOT_MQTT_PORT} included,
+ * come from {@link IndependentServiceSettingsProfile}, which this class shares with other classes
+ * that each call a different service.
+ */
@QuarkusTest
-@TestProfile(IotMqttDisabledIntegrationTest.DisabledMqttProfile.class)
+@TestProfile(IndependentServiceSettingsProfile.class)
class IotMqttDisabledIntegrationTest {
- private static final int PORT = 18830;
-
@ConfigProperty(name = "quarkus.http.test-port", defaultValue = "0")
int testHttpPort;
@@ -33,7 +39,7 @@ class IotMqttDisabledIntegrationTest {
void disabledMqttDoesNotOpenConfiguredPort() {
assertThrows(Exception.class, () -> {
try (Socket socket = new Socket()) {
- socket.connect(new InetSocketAddress("127.0.0.1", PORT), 250);
+ socket.connect(new InetSocketAddress("127.0.0.1", IOT_MQTT_PORT), 250);
}
});
}
@@ -48,15 +54,4 @@ class IotMqttDisabledIntegrationTest {
WebSocketHandshakeException handshake = assertInstanceOf(WebSocketHandshakeException.class, failure.getCause());
assertEquals(503, handshake.getResponse().statusCode());
}
-
- public static final class DisabledMqttProfile implements QuarkusTestProfile {
- @Override
- public Map<String, String> getConfigOverrides() {
- return Map.of(
- "floci.services.iot.mqtt.enabled", "false",
- "floci.services.iot.mqtt.host", "127.0.0.1",
- "floci.services.iot.mqtt.port", Integer.toString(PORT)
- );
- }
- }
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/lambda/launcher/ImageResolverConfigIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/lambda/launcher/ImageResolverConfigIntegrationTest.java
index 9cf78d07c8..02ffbd1e6b 100644
--- a/src/test/java/io/github/hectorvent/floci/services/lambda/launcher/ImageResolverConfigIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/lambda/launcher/ImageResolverConfigIntegrationTest.java
@@ -1,23 +1,27 @@
package io.github.hectorvent.floci.services.lambda.launcher;
import io.github.hectorvent.floci.config.EmulatorConfig;
+import io.github.hectorvent.floci.testing.IndependentServiceSettingsProfile;
import io.quarkus.test.junit.QuarkusTest;
-import io.quarkus.test.junit.QuarkusTestProfile;
import io.quarkus.test.junit.TestProfile;
-import io.smallrye.config.source.yaml.YamlConfigSource;
import jakarta.inject.Inject;
import org.junit.jupiter.api.Test;
-import java.util.Map;
-
+import static io.github.hectorvent.floci.testing.IndependentServiceSettingsProfile.LAMBDA_PYTHON_312_IMAGE;
import static org.junit.jupiter.api.Assertions.assertEquals;
+/**
+ * A runtime image set under a quoted YAML key, {@code "python3.12"}, is the image the resolver
+ * returns for that runtime, and the other runtimes keep their defaults.
+ *
+ * <p>The image, {@link IndependentServiceSettingsProfile#LAMBDA_PYTHON_312_IMAGE}, comes from
+ * {@link IndependentServiceSettingsProfile}, which this class shares with other classes that each
+ * call a different service.
+ */
@QuarkusTest
-@TestProfile(ImageResolverConfigIntegrationTest.RuntimeImageProfile.class)
+@TestProfile(IndependentServiceSettingsProfile.class)
class ImageResolverConfigIntegrationTest {
- private static final String DIGEST_IMAGE = "public.ecr.aws/lambda/python:3.12@sha256:" + "a".repeat(64);
-
@Inject
EmulatorConfig config;
@@ -26,22 +30,9 @@ class ImageResolverConfigIntegrationTest {
@Test
void quotedRuntimeKeySelectsExactImageReference() {
- assertEquals(DIGEST_IMAGE, config.services().lambda().runtimeImages().get("python3.12"));
- assertEquals(DIGEST_IMAGE, resolver.resolve("python3.12"));
+ assertEquals(LAMBDA_PYTHON_312_IMAGE,
+ config.services().lambda().runtimeImages().get("python3.12"));
+ assertEquals(LAMBDA_PYTHON_312_IMAGE, resolver.resolve("python3.12"));
assertEquals("public.ecr.aws/lambda/python:3.11", resolver.resolve("python3.11"));
}
-
- public static class RuntimeImageProfile implements QuarkusTestProfile {
- @Override
- public Map<String, String> getConfigOverrides() {
- YamlConfigSource source = new YamlConfigSource("runtime-images", """
- floci:
- services:
- lambda:
- runtime-images:
- "python3.12": "%s"
- """.formatted(DIGEST_IMAGE));
- return source.getProperties();
- }
- }
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/rds/container/RdsDataResumingIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/rds/container/RdsDataResumingIntegrationTest.java
index b98fd0517a..22583ffa09 100644
--- a/src/test/java/io/github/hectorvent/floci/services/rds/container/RdsDataResumingIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/rds/container/RdsDataResumingIntegrationTest.java
@@ -2,9 +2,9 @@ package io.github.hectorvent.floci.services.rds.container;
import com.github.dockerjava.api.DockerClient;
import io.github.hectorvent.floci.services.rds.RdsService;
+import io.github.hectorvent.floci.testing.IndependentServiceSettingsProfile;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
-import io.quarkus.test.junit.QuarkusTestProfile;
import io.quarkus.test.junit.TestProfile;
import io.restassured.specification.RequestSpecification;
import jakarta.inject.Inject;
@@ -20,8 +20,16 @@ import static io.restassured.http.ContentType.URLENC;
import static org.awaitility.Awaitility.await;
import static org.hamcrest.Matchers.equalTo;
+/**
+ * Every Data API operation sent to a paused Aurora Serverless cluster is refused with
+ * DatabaseResumingException while the cluster resumes, and the retry runs once it has.
+ *
+ * <p>The resuming error and the five-second resume delay come from
+ * {@link IndependentServiceSettingsProfile}, which this class shares with other classes that each
+ * call a different service.
+ */
@QuarkusTest
-@TestProfile(RdsDataResumingIntegrationTest.ResumingProfile.class)
+@TestProfile(IndependentServiceSettingsProfile.class)
@Tag("docker")
class RdsDataResumingIntegrationTest {
@@ -91,12 +99,4 @@ class RdsDataResumingIntegrationTest {
return given().header("Authorization", RDS_AUTH).contentType(URLENC)
.formParam("Action", action).formParam("Version", "2014-10-31");
}
-
- public static class ResumingProfile implements QuarkusTestProfile {
- @Override
- public Map<String, String> getConfigOverrides() {
- return Map.of("floci.services.rds-data.database-resuming-exception-enabled", "true",
- "floci.services.rds.aurora-resume-delay-millis", "5000");
- }
- }
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/sagemaker/SageMakerGpuIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/sagemaker/SageMakerGpuIntegrationTest.java
index 20940e0069..f465306bbf 100644
--- a/src/test/java/io/github/hectorvent/floci/services/sagemaker/SageMakerGpuIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/sagemaker/SageMakerGpuIntegrationTest.java
@@ -1,15 +1,14 @@
package io.github.hectorvent.floci.services.sagemaker;
+import io.github.hectorvent.floci.testing.IndependentServiceSettingsProfile;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
-import io.quarkus.test.junit.QuarkusTestProfile;
import io.quarkus.test.junit.TestProfile;
import io.restassured.response.Response;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import java.time.Duration;
-import java.util.Map;
import static io.restassured.RestAssured.given;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -28,20 +27,16 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
* reason naming the fix, rather than falling back to CPU. A job that reports {@code Completed}
* after training on the wrong hardware leaves an artifact that looks legitimate.
*
- * <p>The profile turns the feature on because {@code application.yml} ships it off. Devices are
- * deliberately left unset, which is what makes the third case reachable.
+ * <p>{@link IndependentServiceSettingsProfile}, which this class shares with other classes that
+ * each call a different service, turns the feature on because {@code application.yml} ships it
+ * off. Devices are deliberately left unset, which is what makes the third case reachable.
+ * SageMaker has no way to delete a training job, so the jobs these cases start stay behind; no
+ * other class on that profile calls SageMaker.
*/
@QuarkusTest
-@TestProfile(SageMakerGpuIntegrationTest.GpuEnabledProfile.class)
+@TestProfile(IndependentServiceSettingsProfile.class)
class SageMakerGpuIntegrationTest {
- public static class GpuEnabledProfile implements QuarkusTestProfile {
- @Override
- public Map<String, String> getConfigOverrides() {
- return Map.of("floci.services.sagemaker.gpu.enabled", "true");
- }
- }
-
private static final String AUTH =
"AWS4-HMAC-SHA256 Credential=test/20260205/us-east-1/sagemaker/aws4_request";
diff --git a/src/test/java/io/github/hectorvent/floci/testing/IndependentServiceSettingsProfile.java b/src/test/java/io/github/hectorvent/floci/testing/IndependentServiceSettingsProfile.java
index 1e9b99ddc2..7bf3042635 100644
--- a/src/test/java/io/github/hectorvent/floci/testing/IndependentServiceSettingsProfile.java
+++ b/src/test/java/io/github/hectorvent/floci/testing/IndependentServiceSettingsProfile.java
@@ -1,13 +1,15 @@
package io.github.hectorvent.floci.testing;
import io.quarkus.test.junit.QuarkusTestProfile;
+import io.smallrye.config.source.yaml.YamlConfigSource;
+import java.util.HashMap;
import java.util.Map;
/**
- * One setting each for services that only one class in this group calls, for the classes that
- * test those settings. Quarkus builds the application once per distinct profile class, so they
- * share this one rather than each declaring their own.
+ * The settings of services that only one class in this group calls, for the classes that test
+ * those settings. Quarkus builds the application once per distinct profile class, so they share
+ * this one rather than each declaring their own.
*
* <p>The overrides, and who relies on them:
* <ul>
@@ -34,14 +36,45 @@ import java.util.Map;
* <li>{@code floci.services.scheduler.invocation-enabled=false} keeps the background schedule
* dispatcher off, so a schedule fires only when a test ticks a dispatcher of its own.
* {@code SchedulerRateFirstOccurrenceIntegrationTest} relies on it.</li>
+ * <li>{@code floci.services.rds-data.database-resuming-exception-enabled=true} answers a
+ * statement sent to a paused Aurora Serverless cluster with DatabaseResumingException, and
+ * {@code floci.services.rds.aurora-resume-delay-millis=5000} keeps the cluster resuming for five
+ * seconds. {@code RdsDataResumingIntegrationTest} relies on both.</li>
+ * <li>{@code floci.services.firehose.flush-record-count=1} delivers every record to S3 as soon as
+ * it arrives. {@code FirehoseFlushRecordCountIntegrationTest} relies on it.</li>
+ * <li>{@code floci.services.lambda.runtime-images."python3.12"} pins the {@code python3.12}
+ * runtime to {@link #LAMBDA_PYTHON_312_IMAGE}, set through a quoted YAML key.
+ * {@code ImageResolverConfigIntegrationTest} relies on it.</li>
+ * <li>{@code floci.services.iot.mqtt.enabled=false} keeps the MQTT broker off.
+ * {@code IotMqttDisabledIntegrationTest} relies on it, and checks that nothing listens where the
+ * broker would have, which {@code floci.services.iot.mqtt.host=127.0.0.1} and
+ * {@code floci.services.iot.mqtt.port=}{@value #IOT_MQTT_PORT} pin to an address it knows.</li>
+ * <li>{@code floci.services.ec2.mock=false} runs instances as real containers, and
+ * {@code floci.services.ec2.volume-block-devices=true} attaches EBS volumes to them as block
+ * devices. {@code Ec2VolumeBlockDeviceDockerIntegrationTest} relies on both.</li>
+ * <li>{@code floci.services.sagemaker.gpu.enabled=true} gives a training job on a GPU instance
+ * type a GPU, and fails a job whose GPU request Floci cannot honour rather than training it on
+ * CPU. {@code SageMakerGpuIntegrationTest} relies on it.</li>
+ * <li>{@code floci.services.bedrock-runtime.backend=proxy} and
+ * {@code floci.services.bedrock-runtime.proxy.url=not a valid url} send Bedrock Runtime calls to
+ * a proxy whose URL does not parse, and
+ * {@code floci.services.bedrock-runtime.proxy.passthrough=true} passes the model id through
+ * unmapped, so a call gets as far as that URL.
+ * {@code BedrockProxyInvalidUrlIntegrationTest} relies on all three.</li>
* </ul>
*
* <p>Each override is inert for the other classes. Each one is read by a single service: the
* Bedrock AgentCore data plane on an invocation, IAM's account alias actions, Kinesis ListShards,
* Neptune cluster creation, Route53 VPC association and authorization, CloudFront origin fetches,
- * Cognito app client validation, and the Scheduler dispatcher. Each class is the only one here
- * that calls its service, so no override reaches another class. Each class also deletes what it
- * creates, so a class that joins later finds nothing left behind.
+ * Cognito app client validation, the Scheduler dispatcher, the RDS Data API and Aurora auto-pause,
+ * Firehose delivery, the Lambda runtime image resolver, the IoT MQTT broker, EC2, SageMaker
+ * training jobs and Bedrock Runtime. Each class is the only one here that calls its service, so no
+ * override reaches another class. Route53 and RDS do look VPCs and subnets up in EC2, but only
+ * read what EC2 has stored, which does not change with EC2 mocked or not.
+ *
+ * <p>Each class also deletes what it creates, so a class that joins later finds nothing left
+ * behind. The one exception is the training jobs {@code SageMakerGpuIntegrationTest} starts:
+ * SageMaker has no way to delete a training job, and no other class here calls SageMaker.
*
* <p>A class joins only if no other class here calls its service, and it deletes what it creates.
* One that shares a service with a class already here takes a profile of its own.
@@ -50,16 +83,41 @@ public class IndependentServiceSettingsProfile implements QuarkusTestProfile {
public static final String IAM_ACCOUNT_ALIAS = "seeded-alias";
+ public static final String LAMBDA_PYTHON_312_IMAGE =
+ "public.ecr.aws/lambda/python:3.12@sha256:" + "a".repeat(64);
+
+ public static final int IOT_MQTT_PORT = 18830;
+
@Override
public Map<String, String> getConfigOverrides() {
- return Map.of(
- "floci.services.bedrock-agent-core.validate-runtime-exists", "true",
- "floci.services.iam.account-alias", IAM_ACCOUNT_ALIAS,
- "floci.services.kinesis.list-shards-next-token-ttl-millis", "0",
- "floci.services.neptune.db-type", "neo4j",
- "floci.services.route53.vpc-association-control-plane-delay-ms", "150",
- "floci.services.cloudfront.allowed-private-origin-hosts", "127.0.0.1",
- "floci.services.cognito.enforce-token-validity-limits", "false",
- "floci.services.scheduler.invocation-enabled", "false");
+ Map<String, String> overrides = new HashMap<>(Map.ofEntries(
+ Map.entry("floci.services.bedrock-agent-core.validate-runtime-exists", "true"),
+ Map.entry("floci.services.iam.account-alias", IAM_ACCOUNT_ALIAS),
+ Map.entry("floci.services.kinesis.list-shards-next-token-ttl-millis", "0"),
+ Map.entry("floci.services.neptune.db-type", "neo4j"),
+ Map.entry("floci.services.route53.vpc-association-control-plane-delay-ms", "150"),
+ Map.entry("floci.services.cloudfront.allowed-private-origin-hosts", "127.0.0.1"),
+ Map.entry("floci.services.cognito.enforce-token-validity-limits", "false"),
+ Map.entry("floci.services.scheduler.invocation-enabled", "false"),
+ Map.entry("floci.services.rds-data.database-resuming-exception-enabled", "true"),
+ Map.entry("floci.services.rds.aurora-resume-delay-millis", "5000"),
+ Map.entry("floci.services.firehose.flush-record-count", "1"),
+ Map.entry("floci.services.iot.mqtt.enabled", "false"),
+ Map.entry("floci.services.iot.mqtt.host", "127.0.0.1"),
+ Map.entry("floci.services.iot.mqtt.port", Integer.toString(IOT_MQTT_PORT)),
+ Map.entry("floci.services.ec2.mock", "false"),
+ Map.entry("floci.services.ec2.volume-block-devices", "true"),
+ Map.entry("floci.services.sagemaker.gpu.enabled", "true"),
+ Map.entry("floci.services.bedrock-runtime.backend", "proxy"),
+ Map.entry("floci.services.bedrock-runtime.proxy.url", "not a valid url"),
+ Map.entry("floci.services.bedrock-runtime.proxy.passthrough", "true")));
+ overrides.putAll(new YamlConfigSource("runtime-images", """
+ floci:
+ services:
+ lambda:
+ runtime-images:
+ "python3.12": "%s"
+ """.formatted(LAMBDA_PYTHON_312_IMAGE)).getProperties());
+ return overrides;
}
}