test: run the kubelet registration class on IamEnforcedServiceSettingsProfile (#8869)

EksKubeletRegistrationIntegrationTest's profile only named the kubelet image
catalog. The catalog replaces EC2's built-in one, so it can only share an
application with classes that launch no instance and look up no image, which
holds for the four classes on IamEnforcedServiceSettingsProfile. The kubelet
class's 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.
This commit is contained in:
Priamo Germosen authored and GitHub committed 2026-11-18 11:00:31 -04:00
1 parent 7b750b8455
commit 0c1ee1ea32
2 files changed
+11 -12

No files matched your search

@@ -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<String, String> getConfigOverrides() {
return Map.of("floci.services.ec2.image-catalog-path", "src/test/resources/ec2/kubelet-image-catalog.yaml");
}
}
@Inject
EksService eksService;
@@ -31,6 +31,12 @@ import java.util.Map;
* <li>{@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.</li>
* <li>{@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.</li>
* <li>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;
* </ul>
*
* <p>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.
*
* <p>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);