From 08e2824a2ca9c2e1a94b79135ee2bb4403f2dee1 Mon Sep 17 00:00:00 2001 From: Priamo Germosen <6233424+pgermosen@users.noreply.github.com> Date: Wed, 18 Nov 2026 14:59:21 -0400 Subject: [PATCH] test: run the Lambda leftover containers class on ScopedServiceSettingsProfile (#8887) LambdaLeftoverContainersDockerIntegrationTest's nested profile set the Lambda executor to docker, the default already, and a Docker resource namespace of its own. ScopedServiceSettingsProfile names its containers in this test JVM's sidecar namespace, which keeps the class's sweep away from another Floci's containers just as well. The sweep removes only Lambda environments, which no other class there starts, and the class drives the launcher directly, so none of the ECS, CORS, partition or EC2 settings reaches it. --- ...mbdaLeftoverContainersDockerIntegrationTest.java | 12 ++---------- .../aws/testing/ScopedServiceSettingsProfile.java | 13 +++++++++---- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/test/java/io/floci/aws/services/lambda/launcher/LambdaLeftoverContainersDockerIntegrationTest.java b/src/test/java/io/floci/aws/services/lambda/launcher/LambdaLeftoverContainersDockerIntegrationTest.java index 4d2d5b139c..3a6be0dba6 100644 --- a/src/test/java/io/floci/aws/services/lambda/launcher/LambdaLeftoverContainersDockerIntegrationTest.java +++ b/src/test/java/io/floci/aws/services/lambda/launcher/LambdaLeftoverContainersDockerIntegrationTest.java @@ -9,9 +9,9 @@ import io.floci.aws.core.common.docker.ContainerLifecycleManager; import io.floci.aws.core.common.docker.ContainerStorageHelper; import io.floci.aws.services.lambda.model.LambdaFunction; 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.Assumptions; @@ -33,7 +33,7 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @QuarkusTest -@TestProfile(LambdaLeftoverContainersDockerIntegrationTest.LeftoversProfile.class) +@TestProfile(ScopedServiceSettingsProfile.class) class LambdaLeftoverContainersDockerIntegrationTest { @Inject @@ -126,12 +126,4 @@ class LambdaLeftoverContainersDockerIntegrationTest { return false; // The sweep removed this exact test container. } } - - public static final class LeftoversProfile implements QuarkusTestProfile { - @Override - public Map getConfigOverrides() { - return Map.of("floci.docker.resource-namespace", "lambda-leftovers-7731", - "floci.services.lambda.executor", "docker"); - } - } } diff --git a/src/test/java/io/floci/aws/testing/ScopedServiceSettingsProfile.java b/src/test/java/io/floci/aws/testing/ScopedServiceSettingsProfile.java index 3f273237aa..9fb95493a8 100644 --- a/src/test/java/io/floci/aws/testing/ScopedServiceSettingsProfile.java +++ b/src/test/java/io/floci/aws/testing/ScopedServiceSettingsProfile.java @@ -24,7 +24,9 @@ import java.util.Map; * tasks, so none needs the sweep. {@code floci.docker.resource-namespace} names their containers * in this run's {@link SidecarContainersProfile#namespace() sidecar namespace}, so another test * JVM on the same Docker daemon and port, whose startup sweep is on, never takes them for its own - * leftovers. + * leftovers. {@code LambdaLeftoverContainersDockerIntegrationTest} relies on the namespace too: + * it sweeps the Lambda environments its deployment left on an earlier run, and the namespace, + * which only this test JVM uses, keeps that sweep away from another Floci's containers. *
  • {@code floci.services.ecs.host-volume-roots=/dev/null} makes {@code /dev/null} the one host * path a device may take, since devices are refused by default, and * {@code floci.services.ecs.allow-privileged-containers=true} lets a task definition ask for @@ -41,9 +43,12 @@ import java.util.Map; * them.
  • * * - *

    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 + *

    Each is inert for the other classes. Only the three ECS classes and the Lambda leftovers class + * start containers, so only theirs carry the namespace. The leftovers class sweeps only Lambda + * environments, which no other class here starts, and drives the Lambda launcher directly, without + * sending a request, so none of the ECS, CORS, partition or EC2 settings reaches it. The ECS 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