From 39a164cd19fb39f0900706e4b95d3d656f30379e Mon Sep 17 00:00:00 2001 From: Priamo Germosen <6233424+pgermosen@users.noreply.github.com> Date: Mon, 19 Oct 2026 22:32:27 -0400 Subject: [PATCH] test: share one real EKS profile across the two k3s cluster classes (#6038) Slice 15 of #4542. EksRegistryHostsDockerIntegrationTest and EksStorageClassDockerIntegrationTest each declared a profile setting only floci.services.eks.mock=false. Both now share RealEksProfile, so two nested profiles become one. The registry hosts class creates its cluster and node group through the EKS API, which starts no container while EKS is mocked, so it relies on the override. The storage class test starts its cluster through EksClusterManager directly and passes with EKS mocked; it shares the profile because it runs a real cluster too. The profile's javadoc says which class relies on the override and why. The registry hosts class deleted its cluster after the test but left its node group and launch template behind, since deleting a cluster does not delete its node groups. It now registers deletes for all three with PartitionCleanup as it creates them. EksIrsaDockerIntegrationTest also turns the mock off, but keeps a profile of its own: it turns on IAM enforcement as well, which would decide every request the other classes send. --- ...EksRegistryHostsDockerIntegrationTest.java | 43 ++++++++----------- .../EksStorageClassDockerIntegrationTest.java | 18 +++----- .../floci/testing/RealEksProfile.java | 29 +++++++++++++ 3 files changed, 52 insertions(+), 38 deletions(-) create mode 100644 src/test/java/io/github/hectorvent/floci/testing/RealEksProfile.java diff --git a/src/test/java/io/github/hectorvent/floci/services/eks/EksRegistryHostsDockerIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/eks/EksRegistryHostsDockerIntegrationTest.java index e50e98b042..9216adef09 100644 --- a/src/test/java/io/github/hectorvent/floci/services/eks/EksRegistryHostsDockerIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/eks/EksRegistryHostsDockerIntegrationTest.java @@ -12,19 +12,20 @@ import io.github.hectorvent.floci.services.ec2.model.LaunchTemplate; import io.github.hectorvent.floci.services.ec2.model.LaunchTemplateData; import io.github.hectorvent.floci.services.eks.model.Cluster; import io.github.hectorvent.floci.services.eks.model.ClusterStatus; +import io.github.hectorvent.floci.testing.PartitionCleanup; +import io.github.hectorvent.floci.testing.RealEksProfile; import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.junit.QuarkusTestProfile; import io.quarkus.test.junit.TestProfile; import jakarta.inject.Inject; import org.apache.commons.compress.archivers.tar.TarArchiveEntry; import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream; import org.eclipse.microprofile.config.inject.ConfigProperty; import org.jboss.logging.Logger; -import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assumptions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; +import org.junit.jupiter.api.extension.RegisterExtension; import java.io.ByteArrayOutputStream; import java.nio.ByteBuffer; @@ -34,7 +35,6 @@ import java.time.Instant; import java.util.Arrays; import java.util.Base64; import java.util.List; -import java.util.Map; import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.zip.GZIPOutputStream; @@ -52,9 +52,13 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * directory (/var/lib/rancher/k3s/agent/etc/containerd/certs.d) before container start, so standard * user data works unchanged. A pod scheduled in the cluster pulls its image through the configured * host, with the custom header that registries.yaml could not express. + * + *
The real cluster comes from {@link RealEksProfile}, which this class shares with the other
+ * classes that run a k3s cluster, so it removes the cluster, node group and launch template it
+ * creates.
*/
@QuarkusTest
-@TestProfile(EksRegistryHostsDockerIntegrationTest.Profile.class)
+@TestProfile(RealEksProfile.class)
// Bounded cluster/workload waits total 285 s; allow Docker setup and cleanup as well.
@Timeout(value = 6, unit = TimeUnit.MINUTES)
class EksRegistryHostsDockerIntegrationTest {
@@ -62,12 +66,8 @@ class EksRegistryHostsDockerIntegrationTest {
private static final Logger LOG = Logger.getLogger(EksRegistryHostsDockerIntegrationTest.class);
private static final String JSON = "application/json";
- public static final class Profile implements QuarkusTestProfile {
- @Override
- public Map The cluster is started through {@link EksClusterManager} directly, which runs a k3s container
+ * whether or not EKS is mocked. The class runs on {@link RealEksProfile} with the other classes
+ * that run a real cluster.
*/
@QuarkusTest
-@TestProfile(EksStorageClassDockerIntegrationTest.Profile.class)
+@TestProfile(RealEksProfile.class)
class EksStorageClassDockerIntegrationTest {
private static final Logger LOG = Logger.getLogger(EksStorageClassDockerIntegrationTest.class);
private static final String ACCOUNT = "000000000000";
- public static final class Profile implements QuarkusTestProfile {
- @Override
- public Map {@code floci.services.eks.mock=false} is the only override.
+ * {@code EksRegistryHostsDockerIntegrationTest} relies on it: it creates its cluster and node group
+ * through the EKS API, which starts no container while EKS is mocked.
+ * {@code EksStorageClassDockerIntegrationTest} passes with it off, since it starts its cluster
+ * through {@code EksClusterManager} directly, which runs a k3s container either way. It shares
+ * the profile because it runs a real cluster too. Each class removes the clusters it starts, so the
+ * next one finds no container left behind.
+ *
+ * {@code EksIrsaDockerIntegrationTest} keeps a profile of its own: it also turns on IAM
+ * enforcement, which would decide every request the other classes send.
+ */
+public class RealEksProfile implements QuarkusTestProfile {
+
+ @Override
+ public Map