diff --git a/src/test/java/io/floci/aws/core/common/IamStsSharedEnablementIntegrationTest.java b/src/test/java/io/floci/aws/core/common/IamStsSharedEnablementIntegrationTest.java index 87ddd157f1..61bffe3dd5 100644 --- a/src/test/java/io/floci/aws/core/common/IamStsSharedEnablementIntegrationTest.java +++ b/src/test/java/io/floci/aws/core/common/IamStsSharedEnablementIntegrationTest.java @@ -1,17 +1,16 @@ package io.floci.aws.core.common; +import io.floci.aws.testing.PerServicePersistentStorageProfile; 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; -import java.util.Map; - import static org.junit.jupiter.api.Assertions.assertFalse; +/** Turning IAM off turns STS off too. {@link PerServicePersistentStorageProfile} turns IAM off. */ @QuarkusTest -@TestProfile(IamStsSharedEnablementIntegrationTest.IamDisabledProfile.class) +@TestProfile(PerServicePersistentStorageProfile.class) class IamStsSharedEnablementIntegrationTest { @Inject @@ -22,11 +21,4 @@ class IamStsSharedEnablementIntegrationTest { assertFalse(serviceRegistry.isServiceEnabled("iam")); assertFalse(serviceRegistry.isServiceEnabled("sts")); } - - public static final class IamDisabledProfile implements QuarkusTestProfile { - @Override - public Map getConfigOverrides() { - return Map.of("floci.services.iam.enabled", "false"); - } - } } diff --git a/src/test/java/io/floci/aws/services/cloudformation/CloudFormationEcsLinuxParametersIntegrationTest.java b/src/test/java/io/floci/aws/services/cloudformation/CloudFormationEcsLinuxParametersIntegrationTest.java index 181f4b463f..8f4f56baab 100644 --- a/src/test/java/io/floci/aws/services/cloudformation/CloudFormationEcsLinuxParametersIntegrationTest.java +++ b/src/test/java/io/floci/aws/services/cloudformation/CloudFormationEcsLinuxParametersIntegrationTest.java @@ -1,9 +1,9 @@ package io.floci.aws.services.cloudformation; import io.floci.aws.testing.CfnStackWaits; +import io.floci.aws.testing.PerServicePersistentStorageProfile; 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 org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; @@ -24,22 +24,14 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * An {@code AWS::ECS::TaskDefinition} container's {@code LinuxParameters} reach the task * definition as RegisterTaskDefinition keeps them: DescribeTaskDefinition shows them in the API's * shape, and the Fargate rules RegisterTaskDefinition applies to them apply to a template too. + * + *

Floci refuses a host path outside {@code floci.services.ecs.host-volume-roots} by default; the + * template's device, {@code /dev/fuse}, is let through by {@link PerServicePersistentStorageProfile}. */ @QuarkusTest -@TestProfile(CloudFormationEcsLinuxParametersIntegrationTest.DeviceProfile.class) +@TestProfile(PerServicePersistentStorageProfile.class) class CloudFormationEcsLinuxParametersIntegrationTest { - /** - * Floci refuses a host path outside {@code floci.services.ecs.host-volume-roots} by default; the - * template's device, {@code /dev/fuse}, is let through. - */ - public static final class DeviceProfile implements QuarkusTestProfile { - @Override - public Map getConfigOverrides() { - return Map.of("floci.services.ecs.host-volume-roots", "/dev/fuse"); - } - } - private static final String ECS_CT = "application/x-amz-json-1.1"; private static final String ECS_TARGET = "AmazonEC2ContainerServiceV20141113."; diff --git a/src/test/java/io/floci/aws/testing/PerServicePersistentStorageProfile.java b/src/test/java/io/floci/aws/testing/PerServicePersistentStorageProfile.java index a31f7653f0..12e3449687 100644 --- a/src/test/java/io/floci/aws/testing/PerServicePersistentStorageProfile.java +++ b/src/test/java/io/floci/aws/testing/PerServicePersistentStorageProfile.java @@ -6,8 +6,10 @@ import java.util.Map; /** * DynamoDB, ACM and S3 on persistent storage while every other service stays on the test default, - * memory, for the classes that test a per-service storage mode. Quarkus builds the application - * once per distinct profile class, so they share this one rather than each declaring their own. + * memory, for the classes that test a per-service storage mode, and the settings of two other + * classes that share the application. Quarkus builds the application once per distinct profile + * class, and keeps every one it built for the rest of the test JVM, so they share this one rather + * than each declaring their own. * *

The overrides, and who relies on them: *

* *

Each override is inert for the other classes, since each reaches a single service and each - * class is the only one here that calls its service. {@code StorageFactoryDuplicateBackendTest} + * class is the only one here that calls its service. No class here calls IAM or STS or registers + * an ECS task definition apart from the two that rely on those settings, and the persistent path + * 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 its own directory. {@code StorageFactoryDuplicateBackendTest} * clears every store before and after it runs, and writes placeholder strings into DynamoDB's * table store in between, so no other class here may call DynamoDB, and none may count on state * outliving its own class. * *

Each class also deletes what it creates, so a class that joins later finds nothing left - * behind. A class joins only if no other class here calls its service, and it deletes what it - * creates. + * behind. + * + *

A class joins if every setting here is either one it relies on or one that never reaches its + * requests, and if any setting it adds never reaches the requests of a class already here. It must also delete what it creates and must not call DynamoDB. */ public class PerServicePersistentStorageProfile implements QuarkusTestProfile { @@ -44,6 +56,8 @@ public class PerServicePersistentStorageProfile implements QuarkusTestProfile { "floci.storage.services.dynamodb.mode", "persistent", "floci.storage.services.acm.mode", "persistent", "floci.storage.services.s3.mode", "persistent", - "floci.storage.persistent-path", STORAGE_DIR); + "floci.storage.persistent-path", STORAGE_DIR, + "floci.services.ecs.host-volume-roots", "/dev/fuse", + "floci.services.iam.enabled", "false"); } }