mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
test: fold three more Quarkus test profiles into CloudFormationSettingsProfile (#8830)
Quarkus builds one application per distinct test profile at discovery and keeps each for the rest of the surefire JVM, so every profile a shard holds costs heap. The profiles nested in EcsBackgroundTaskStopIntegrationTest (ECS in Docker mode with no boot sweep, also used by EcsBackgroundTaskLaunchIntegrationTest), KinesisStatusWindowIntegrationTest (minute-long status delays) and RdsTemplateDatabaseRestoreIntegrationTest (the PostGIS default image) now share CloudFormationSettingsProfile: each setting is read by one service no other class here calls, and none names a container namespace.
This commit is contained in:
1 parent
bb8a92b8fd
commit
3b2401433b
5 files changed
+36
-39
No files matched your search
@@ -7,6 +7,7 @@ import io.floci.aws.services.ecs.container.EcsTaskHandle;
|
||||
import io.floci.aws.services.ecs.model.ContainerDefinition;
|
||||
import io.floci.aws.services.ecs.model.EcsTask;
|
||||
import io.floci.aws.services.ecs.model.LaunchType;
|
||||
import io.floci.aws.testing.CloudFormationSettingsProfile;
|
||||
import io.quarkus.test.InjectMock;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.quarkus.test.junit.TestProfile;
|
||||
@@ -31,7 +32,7 @@ import static org.mockito.Mockito.when;
|
||||
* so this runs in Quarkus, in Docker mode over a container manager that starts nothing for real.
|
||||
*/
|
||||
@QuarkusTest
|
||||
@TestProfile(EcsBackgroundTaskStopIntegrationTest.DockerModeProfile.class)
|
||||
@TestProfile(CloudFormationSettingsProfile.class)
|
||||
class EcsBackgroundTaskLaunchIntegrationTest {
|
||||
|
||||
private static final String REGION = "us-east-1";
|
||||
|
||||
@@ -7,9 +7,9 @@ import io.floci.aws.services.ecs.model.Container;
|
||||
import io.floci.aws.services.ecs.model.ContainerDefinition;
|
||||
import io.floci.aws.services.ecs.model.EcsTask;
|
||||
import io.floci.aws.services.ecs.model.LaunchType;
|
||||
import io.floci.aws.testing.CloudFormationSettingsProfile;
|
||||
import io.quarkus.test.InjectMock;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.quarkus.test.junit.QuarkusTestProfile;
|
||||
import io.quarkus.test.junit.TestProfile;
|
||||
import jakarta.inject.Inject;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -32,24 +32,16 @@ import static org.mockito.Mockito.when;
|
||||
* request context, and account-aware storage reads the account from that context. Only a running
|
||||
* Arc container has one, so this runs in Quarkus, in Docker mode over a container manager that
|
||||
* stops nothing for real: a stop that landed in the wrong account would leave the task's own
|
||||
* cluster still counting it.
|
||||
* cluster still counting it. {@link CloudFormationSettingsProfile} turns Docker mode on, with no
|
||||
* sweep of a previous run's containers, which the mock would refuse.
|
||||
*/
|
||||
@QuarkusTest
|
||||
@TestProfile(EcsBackgroundTaskStopIntegrationTest.DockerModeProfile.class)
|
||||
@TestProfile(CloudFormationSettingsProfile.class)
|
||||
class EcsBackgroundTaskStopIntegrationTest {
|
||||
|
||||
private static final String REGION = "us-east-1";
|
||||
private static final String ACCOUNT = "111122223333";
|
||||
|
||||
/** Docker mode, with no sweep of a previous run's containers, which the mock would refuse. */
|
||||
public static final class DockerModeProfile implements QuarkusTestProfile {
|
||||
@Override
|
||||
public Map<String, String> getConfigOverrides() {
|
||||
return Map.of("floci.services.ecs.mock", "false",
|
||||
"floci.services.ecs.reconcile-containers-on-startup", "false");
|
||||
}
|
||||
}
|
||||
|
||||
@Inject
|
||||
EcsService ecsService;
|
||||
|
||||
|
||||
+6
-11
@@ -1,10 +1,10 @@
|
||||
package io.floci.aws.services.kinesis;
|
||||
|
||||
import io.floci.aws.services.kinesis.model.KinesisStream;
|
||||
import io.floci.aws.testing.CloudFormationSettingsProfile;
|
||||
import io.floci.aws.testing.PartitionCleanup;
|
||||
import io.floci.aws.testing.RestAssuredJsonUtils;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.quarkus.test.junit.QuarkusTestProfile;
|
||||
import io.quarkus.test.junit.TestProfile;
|
||||
import jakarta.inject.Inject;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
@@ -12,12 +12,15 @@ import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
* A stream is seen CREATING and UPDATING over the wire. The delays, a minute each, come from
|
||||
* {@link CloudFormationSettingsProfile}, so nothing moves on while the test runs.
|
||||
*/
|
||||
@QuarkusTest
|
||||
@TestProfile(KinesisStatusWindowIntegrationTest.WindowProfile.class)
|
||||
@TestProfile(CloudFormationSettingsProfile.class)
|
||||
class KinesisStatusWindowIntegrationTest {
|
||||
|
||||
private static final String KINESIS_TARGET = "Kinesis_20131202";
|
||||
@@ -97,12 +100,4 @@ class KinesisStatusWindowIntegrationTest {
|
||||
.statusCode(200)
|
||||
.body("StreamDescription.StreamStatus", equalTo("ACTIVE"));
|
||||
}
|
||||
|
||||
public static final class WindowProfile implements QuarkusTestProfile {
|
||||
@Override
|
||||
public Map<String, String> getConfigOverrides() {
|
||||
return Map.of("floci.services.kinesis.creating-delay-millis", "60000",
|
||||
"floci.services.kinesis.updating-delay-millis", "60000");
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-12
@@ -1,14 +1,12 @@
|
||||
package io.floci.aws.services.rds;
|
||||
|
||||
import io.floci.aws.testing.CloudFormationSettingsProfile;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.quarkus.test.junit.QuarkusTestProfile;
|
||||
import io.quarkus.test.junit.TestProfile;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static io.floci.aws.testing.RdsRequests.assumeDocker;
|
||||
import static io.floci.aws.testing.RdsRequests.deleteInstance;
|
||||
import static io.floci.aws.testing.RdsRequests.rds;
|
||||
@@ -17,20 +15,14 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
/**
|
||||
* A snapshot restores on an image that creates a template database at startup, such as PostGIS's
|
||||
* {@code template_postgis}, which the snapshot's dump creates again.
|
||||
* {@code template_postgis}, which the snapshot's dump creates again. The PostGIS image is the
|
||||
* default PostgreSQL image {@link CloudFormationSettingsProfile} sets.
|
||||
*/
|
||||
@QuarkusTest
|
||||
@Tag("docker")
|
||||
@TestProfile(RdsTemplateDatabaseRestoreIntegrationTest.PostgisImageProfile.class)
|
||||
@TestProfile(CloudFormationSettingsProfile.class)
|
||||
class RdsTemplateDatabaseRestoreIntegrationTest {
|
||||
|
||||
public static class PostgisImageProfile implements QuarkusTestProfile {
|
||||
@Override
|
||||
public Map<String, String> getConfigOverrides() {
|
||||
return Map.of("floci.services.rds.default-postgres-image", "postgis/postgis:17-3.5-alpine");
|
||||
}
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
void checkDocker() throws InterruptedException {
|
||||
assumeDocker();
|
||||
|
||||
@@ -47,12 +47,24 @@ import java.util.Map;
|
||||
* {@code cdi} mode with the device the {@value #SAGEMAKER_GPU_CDI_DEVICE_PROPERTY} system property
|
||||
* names, or in {@code count} mode when it names none. {@code SageMakerGpuDockerIntegrationTest}
|
||||
* relies on it.</li>
|
||||
* <li>{@code floci.services.ecs.mock=false} runs ECS in Docker mode, and
|
||||
* {@code floci.services.ecs.reconcile-containers-on-startup=false} leaves a previous run's
|
||||
* containers unswept at boot. {@code EcsBackgroundTaskStopIntegrationTest} and
|
||||
* {@code EcsBackgroundTaskLaunchIntegrationTest} rely on them, over a container manager that
|
||||
* starts and stops nothing for real.</li>
|
||||
* <li>{@code floci.services.kinesis.creating-delay-millis} and {@code updating-delay-millis}, a
|
||||
* minute each, keep a stream CREATING and UPDATING for the whole test.
|
||||
* {@code KinesisStatusWindowIntegrationTest} relies on them.</li>
|
||||
* <li>{@code floci.services.rds.default-postgres-image=postgis/postgis:17-3.5-alpine} starts a
|
||||
* PostgreSQL instance on an image that creates a template database at startup.
|
||||
* {@code RdsTemplateDatabaseRestoreIntegrationTest} relies on it.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>Each override is inert for the other classes: each is read by a single service, CloudFormation,
|
||||
* the Timestream for InfluxDB data plane, an EKS cluster's container start, the EMR and EMR
|
||||
* Serverless runners, CloudFront, DynamoDB and SageMaker training, and no other class here calls
|
||||
* that service. The persistent path is the one setting every class sees: it moves where this
|
||||
* Serverless runners, CloudFront, DynamoDB, SageMaker training, ECS, Kinesis and RDS, and no other
|
||||
* class here calls that service. Boot-time reconciliation only acts on containers a previous run
|
||||
* left, which this application never adopts. The persistent path is the one setting every class sees: it moves where this
|
||||
* application writes what services keep on disk whatever their storage mode, Timestream backups and
|
||||
* Lambda code-volume markers among them, each under a directory of its own, and DynamoDB is the only
|
||||
* service here that stores its records there.
|
||||
@@ -91,7 +103,12 @@ public class CloudFormationSettingsProfile implements QuarkusTestProfile {
|
||||
Map.entry("floci.storage.services.dynamodb.item-layout", "per-table"),
|
||||
Map.entry("floci.storage.services.dynamodb.item-shards", "4"),
|
||||
Map.entry("floci.storage.persistent-path", DYNAMODB_PARTITIONED_STORAGE_DIR),
|
||||
Map.entry("floci.services.sagemaker.gpu.enabled", "true")));
|
||||
Map.entry("floci.services.sagemaker.gpu.enabled", "true"),
|
||||
Map.entry("floci.services.ecs.mock", "false"),
|
||||
Map.entry("floci.services.ecs.reconcile-containers-on-startup", "false"),
|
||||
Map.entry("floci.services.kinesis.creating-delay-millis", "60000"),
|
||||
Map.entry("floci.services.kinesis.updating-delay-millis", "60000"),
|
||||
Map.entry("floci.services.rds.default-postgres-image", "postgis/postgis:17-3.5-alpine")));
|
||||
String device = System.getProperty(SAGEMAKER_GPU_CDI_DEVICE_PROPERTY);
|
||||
if (device != null && !device.isBlank()) {
|
||||
overrides.put("floci.services.sagemaker.gpu.mode", "cdi");
|
||||
|
||||
Reference in new issue
Block a user