diff --git a/src/test/java/io/floci/aws/services/eks/EksKubeletRegistrationIntegrationTest.java b/src/test/java/io/floci/aws/services/eks/EksKubeletRegistrationIntegrationTest.java index 31ca97cbd7..fa05ae68ad 100644 --- a/src/test/java/io/floci/aws/services/eks/EksKubeletRegistrationIntegrationTest.java +++ b/src/test/java/io/floci/aws/services/eks/EksKubeletRegistrationIntegrationTest.java @@ -6,8 +6,8 @@ import io.floci.aws.services.ec2.Ec2Service; import io.floci.aws.services.ec2.model.Instance; import io.floci.aws.services.eks.model.Cluster; import io.floci.aws.services.eks.model.CreateClusterRequest; +import io.floci.aws.testing.IamEnforcedServiceSettingsProfile; import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.junit.QuarkusTestProfile; import io.quarkus.test.junit.TestProfile; import io.quarkus.test.junit.mockito.InjectSpy; import jakarta.inject.Inject; @@ -17,7 +17,6 @@ import java.nio.charset.StandardCharsets; import java.time.Duration; import java.util.Base64; import java.util.List; -import java.util.Map; import java.util.UUID; import static io.restassured.RestAssured.given; @@ -33,16 +32,9 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; @QuarkusTest -@TestProfile(EksKubeletRegistrationIntegrationTest.ImageCatalogProfile.class) +@TestProfile(IamEnforcedServiceSettingsProfile.class) class EksKubeletRegistrationIntegrationTest { - public static final class ImageCatalogProfile implements QuarkusTestProfile { - @Override - public Map getConfigOverrides() { - return Map.of("floci.services.ec2.image-catalog-path", "src/test/resources/ec2/kubelet-image-catalog.yaml"); - } - } - @Inject EksService eksService; diff --git a/src/test/java/io/floci/aws/testing/IamEnforcedServiceSettingsProfile.java b/src/test/java/io/floci/aws/testing/IamEnforcedServiceSettingsProfile.java index 7fe3091757..9ee04891e5 100644 --- a/src/test/java/io/floci/aws/testing/IamEnforcedServiceSettingsProfile.java +++ b/src/test/java/io/floci/aws/testing/IamEnforcedServiceSettingsProfile.java @@ -31,6 +31,12 @@ import java.util.Map; *
  • {@code floci.services.s3.global-bucket-namespace=true} resolves a bucket name across * accounts, so finding the bucket does not depend on the ambient account. * {@code S3PresignedPostBucketPolicyAccountContextIntegrationTest} relies on it.
  • + *
  • {@code floci.services.ec2.image-catalog-path} names + * {@code src/test/resources/ec2/kubelet-image-catalog.yaml}, a full EC2 image catalog in place of + * the built-in one, whose kubelet worker image registers its node itself. + * {@code EksKubeletRegistrationIntegrationTest} relies on it. Its one request through the HTTP + * layer signs with a 12-digit account id as the access key, which IAM enforcement passes through, + * and it creates its cluster through the service directly, so enforcement never reaches it.
  • *
  • The HTTP port, {@code floci.port} and {@code floci.base-url} name one free port, chosen once * when the class loads, so a Lambda container calls back to the port the application listens on. * {@code LambdaExecutionRoleDockerIntegrationTest} relies on it. The other classes send to the @@ -38,9 +44,9 @@ import java.util.Map; * * *

    Each service setting is inert for the other classes: none of them calls RDS, DocumentDB, DSQL - * or Lambda, and the only S3 call outside the S3 class is the function's ListBuckets in + * or Lambda, the only S3 call outside the S3 class is the function's ListBuckets in * {@code LambdaExecutionRoleDockerIntegrationTest}, which its execution role denies whichever way - * bucket names resolve. + * bucket names resolve, and only the kubelet class launches an instance or looks up an image. * *

    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. @@ -57,6 +63,7 @@ public class IamEnforcedServiceSettingsProfile extends IamEnforcementProfile { overrides.put("floci.services.dsql.mock", "false"); overrides.put("floci.services.lambda.ephemeral", "true"); overrides.put("floci.services.s3.global-bucket-namespace", "true"); + overrides.put("floci.services.ec2.image-catalog-path", "src/test/resources/ec2/kubelet-image-catalog.yaml"); overrides.put("quarkus.http.test-port", String.valueOf(TEST_PORT)); overrides.put("floci.port", String.valueOf(TEST_PORT)); overrides.put("floci.base-url", "http://localhost:" + TEST_PORT);