diff --git a/src/test/java/io/floci/aws/services/ecs/EcsEssentialContainerExitDockerIntegrationTest.java b/src/test/java/io/floci/aws/services/ecs/EcsEssentialContainerExitDockerIntegrationTest.java index 7ea199055b..c1a46c0b90 100644 --- a/src/test/java/io/floci/aws/services/ecs/EcsEssentialContainerExitDockerIntegrationTest.java +++ b/src/test/java/io/floci/aws/services/ecs/EcsEssentialContainerExitDockerIntegrationTest.java @@ -6,9 +6,9 @@ import com.github.dockerjava.api.exception.NotFoundException; import com.github.dockerjava.api.model.Frame; import io.floci.aws.testing.AwsTestClients; import io.floci.aws.testing.DockerAvailability; +import io.floci.aws.testing.ScopedServiceSettingsProfile; import io.floci.aws.testing.TestImages; 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.AfterEach; @@ -23,7 +23,6 @@ import software.amazon.awssdk.services.ecs.model.RunTaskResponse; import software.amazon.awssdk.services.ecs.model.Task; import java.time.Duration; -import java.util.Map; import java.util.UUID; import java.util.concurrent.TimeUnit; @@ -35,18 +34,9 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assumptions.assumeTrue; @QuarkusTest -@TestProfile(EcsEssentialContainerExitDockerIntegrationTest.DockerEcsProfile.class) +@TestProfile(ScopedServiceSettingsProfile.class) class EcsEssentialContainerExitDockerIntegrationTest { - public static final class DockerEcsProfile implements QuarkusTestProfile { - @Override - public Map getConfigOverrides() { - return Map.of("floci.services.ecs.mock", "false", - "floci.services.ecs.reconcile-containers-on-startup", "false", - "floci.docker.resource-namespace", "ecs-essential-exit-it"); - } - } - @Inject DockerClient docker; diff --git a/src/test/java/io/floci/aws/services/ecs/EcsLinuxParametersDockerIntegrationTest.java b/src/test/java/io/floci/aws/services/ecs/EcsLinuxParametersDockerIntegrationTest.java index 83a0fdb8fd..c8017dcf2b 100644 --- a/src/test/java/io/floci/aws/services/ecs/EcsLinuxParametersDockerIntegrationTest.java +++ b/src/test/java/io/floci/aws/services/ecs/EcsLinuxParametersDockerIntegrationTest.java @@ -9,9 +9,9 @@ import com.github.dockerjava.api.model.HostConfig; import io.floci.aws.services.ecs.model.EcsTask; import io.floci.aws.testing.DockerAvailability; import io.floci.aws.testing.RestAssuredJsonUtils; +import io.floci.aws.testing.ScopedServiceSettingsProfile; import io.floci.aws.testing.TestImages; 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.AfterEach; @@ -38,7 +38,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * size of {@code /dev/shm} and the tmpfs mount, as ECS hands each of them to Docker. */ @QuarkusTest -@TestProfile(EcsLinuxParametersDockerIntegrationTest.DockerEcsProfile.class) +@TestProfile(ScopedServiceSettingsProfile.class) class EcsLinuxParametersDockerIntegrationTest { private static final String REGION = "us-east-1"; @@ -46,20 +46,6 @@ class EcsLinuxParametersDockerIntegrationTest { private static final String ECS_TARGET = "AmazonEC2ContainerServiceV20141113."; private static final long MIB = 1024L * 1024L; - /** - * Real containers, with security-group enforcement back to its shipped default of off, and - * {@code /dev/null} the one host path a device may take, since devices are refused by default. - */ - 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", - "floci.services.ecs.host-volume-roots", "/dev/null", - "floci.services.ecs.allow-privileged-containers", "true"); - } - } - @Inject EcsService ecsService; diff --git a/src/test/java/io/floci/aws/testing/ScopedServiceSettingsProfile.java b/src/test/java/io/floci/aws/testing/ScopedServiceSettingsProfile.java index 1c4cb760b0..3f273237aa 100644 --- a/src/test/java/io/floci/aws/testing/ScopedServiceSettingsProfile.java +++ b/src/test/java/io/floci/aws/testing/ScopedServiceSettingsProfile.java @@ -11,15 +11,24 @@ import java.util.Map; * *

The overrides, and who relies on them: *

* - *

Each is inert for the other classes. Only {@code EcsImagePullDockerIntegrationTest} runs an - * ECS task or any other container. Only {@code GlobalCorsFilterIntegrationTest} sends an - * {@code Origin} header, the only request the CORS settings answer differently. Every other class - * signs its requests for the commercial partition, where AWS publishes each service it calls. Only + *

Each is inert for the other classes. Only the three ECS classes run a task or any other + * container, so only their containers carry the namespace. Their tasks run in bridge mode, which security-group enforcement never protects, and + * only the Linux parameters class asks for a device or privilege. The pull on every launch reaches + * the other two ECS classes' tasks too, and changes nothing they check: their busybox tasks run + * the same way on the image the tag names now, and a failed pull runs the cached image. Only + * {@code GlobalCorsFilterIntegrationTest} sends an {@code Origin} header, the only request the CORS + * settings answer differently. Every other class signs its requests for the commercial partition, + * where AWS publishes each service it calls. Only * {@code Ec2MockFixedPublicAddressIntegrationTest} launches an instance. It stays apart from * {@link IndependentServiceSettingsProfile}, which runs EC2 for real. * @@ -54,6 +67,9 @@ public class ScopedServiceSettingsProfile implements QuarkusTestProfile { Map.entry("floci.network.security-group-enforcement.enabled", "false"), Map.entry("floci.services.ecs.image-pull-behavior", "default"), Map.entry("floci.services.ecs.reconcile-containers-on-startup", "false"), + Map.entry("floci.docker.resource-namespace", SidecarContainersProfile.namespace()), + Map.entry("floci.services.ecs.host-volume-roots", "/dev/null"), + Map.entry("floci.services.ecs.allow-privileged-containers", "true"), Map.entry("floci.security.extra-cors-allowed-origins", "http://localhost:3000,https://ui.example.test"), Map.entry("floci.security.extra-cors-allowed-headers", "x-added-header"), Map.entry("floci.security.extra-cors-expose-headers", "x-visible-header"),