diff --git a/src/test/java/io/floci/aws/services/ecs/EcsLeftoverContainersDockerIntegrationTest.java b/src/test/java/io/floci/aws/services/ecs/EcsLeftoverContainersDockerIntegrationTest.java index c762eac2ff..fa7edf42f5 100644 --- a/src/test/java/io/floci/aws/services/ecs/EcsLeftoverContainersDockerIntegrationTest.java +++ b/src/test/java/io/floci/aws/services/ecs/EcsLeftoverContainersDockerIntegrationTest.java @@ -12,6 +12,7 @@ import io.floci.aws.services.ecs.model.LaunchType; import io.floci.aws.services.ecs.model.NetworkMode; import io.floci.aws.services.ecs.model.TaskDefinition; import io.floci.aws.testing.TestImages; +import io.floci.aws.testing.ValidateSignaturesProfile; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; import jakarta.inject.Inject; @@ -39,7 +40,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * and tells this run's containers from a previous run's by the run label rather than by time. */ @QuarkusTest -@TestProfile(EcsServiceDiscoveryDockerIntegrationTest.DockerEcsProfile.class) +@TestProfile(ValidateSignaturesProfile.class) class EcsLeftoverContainersDockerIntegrationTest { private static final String REGION = "us-east-1"; diff --git a/src/test/java/io/floci/aws/services/ecs/EcsServiceDiscoveryDockerIntegrationTest.java b/src/test/java/io/floci/aws/services/ecs/EcsServiceDiscoveryDockerIntegrationTest.java index 298f3c937a..b743d7903e 100644 --- a/src/test/java/io/floci/aws/services/ecs/EcsServiceDiscoveryDockerIntegrationTest.java +++ b/src/test/java/io/floci/aws/services/ecs/EcsServiceDiscoveryDockerIntegrationTest.java @@ -15,8 +15,8 @@ import io.floci.aws.services.ecs.model.NetworkMode; import io.floci.aws.services.ecs.model.TaskDefinition; import io.floci.aws.services.ecs.model.UpdateServiceRequest; import io.floci.aws.testing.TestImages; +import io.floci.aws.testing.ValidateSignaturesProfile; 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.Assumptions; @@ -39,9 +39,13 @@ import static org.junit.jupiter.api.Assertions.assertTrue; *

Nothing here touches the registrar. A service that declares {@code serviceRegistries} has a * real container launched for it, and the assertions are that the Cloud Map name resolves to the * task's address while it runs and stops resolving once the task does. + * + *

ECS runs unmocked here, and security-group enforcement goes back to its shipped default of + * off, both from {@link ValidateSignaturesProfile}: the suite turns enforcement on, and its helper + * needs rootful Docker, a requirement of security groups rather than of service discovery. */ @QuarkusTest -@TestProfile(EcsServiceDiscoveryDockerIntegrationTest.DockerEcsProfile.class) +@TestProfile(ValidateSignaturesProfile.class) class EcsServiceDiscoveryDockerIntegrationTest { private static final String REGION = "us-east-1"; @@ -51,20 +55,6 @@ class EcsServiceDiscoveryDockerIntegrationTest { private static final String CLOUD_MAP_SERVICE_NAME = "cache"; private static final String ECS_SERVICE_NAME = "cache-svc"; - /** - * The registration hooks only run for a task with a container behind it, so ECS runs - * unmocked. Security-group enforcement goes back to its shipped default of off: the test - * suite turns it on, and its helper needs rootful Docker, which is a requirement of security - * groups rather than of service discovery. - */ - public static final class DockerEcsProfile implements QuarkusTestProfile { - @Override - public Map getConfigOverrides() { - return Map.of("floci.services.ecs.mock", "false", - "floci.network.security-group-enforcement.enabled", "false"); - } - } - @Inject EcsService ecsService; diff --git a/src/test/java/io/floci/aws/testing/ValidateSignaturesProfile.java b/src/test/java/io/floci/aws/testing/ValidateSignaturesProfile.java index a42d585be3..7233ad9c19 100644 --- a/src/test/java/io/floci/aws/testing/ValidateSignaturesProfile.java +++ b/src/test/java/io/floci/aws/testing/ValidateSignaturesProfile.java @@ -5,14 +5,36 @@ import io.quarkus.test.junit.QuarkusTestProfile; import java.util.Map; /** - * Turns {@code floci.auth.validate-signatures} on, and nothing else. Quarkus builds the application - * once per distinct profile class, so the classes that need only this override share this one - * rather than each declaring an identical nested profile. + * Turns {@code floci.auth.validate-signatures} on, and carries the settings of two ECS 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 classes share this one rather than each + * declaring their own. + * + *

The overrides, and who relies on them: + *

+ * + *

Each override is inert for the other classes: the ECS classes drive ECS through its injected + * services, so no request of theirs is signed or checked, and no signature class starts an ECS task + * or a container that security groups would govern. + * + *

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. */ public class ValidateSignaturesProfile implements QuarkusTestProfile { @Override public Map getConfigOverrides() { - return Map.of("floci.auth.validate-signatures", "true"); + return Map.of( + "floci.auth.validate-signatures", "true", + "floci.services.ecs.mock", "false", + "floci.network.security-group-enforcement.enabled", "false"); } }