From e494e1aecf539bc3a292e004dd48e3c846234607 Mon Sep 17 00:00:00 2001 From: Priamo Germosen <6233424+pgermosen@users.noreply.github.com> Date: Fri, 16 Oct 2026 08:55:40 -0400 Subject: [PATCH] test: fold the CloudFormation and IoT one-off profiles into shared ones (#5791) Slice 8 of #4542. Three CloudFormation classes each declared a profile for one setting, and ApiGatewayV2DomainCfnIntegrationTest borrowed the strict one. All four now use CloudFormationSettingsProfile, which carries the three settings: an unsupported resource type fails instead of being stubbed, Lambda code that cannot be read falls back to the stub handler, and a deleted stack is retained for a day. Each only reaches the class that tests it: the other templates declare only types Floci provisions and no Lambda function, and only the race test lists stacks or looks one up by its id after a delete. The two IoT classes that changed a default, the DescribeEndpoint address and strict rule SQL, share IotSettingsProfile. The address only changes what DescribeEndpoint and the AWS-managed domain configurations report, which the rule test never reads, and strict SQL only changes how a topic rule is created, which the endpoint test never does. Why the race test keeps a deleted stack for a day, the test clock advancing on every read, moves from the retired profile's javadoc to the class javadoc. IotTopicRuleSqlStrictIntegrationTest gains a class javadoc saying what strict mode changes. --- .../ApiGatewayV2DomainCfnIntegrationTest.java | 3 +- ...dFormationDeletedStackListingRaceTest.java | 24 ++++------- ...nLambdaStubCodeAllowedIntegrationTest.java | 16 +++---- ...rtedResourceTypeStrictIntegrationTest.java | 16 +++---- ...scribeEndpointOverrideIntegrationTest.java | 19 +++------ .../IotTopicRuleSqlStrictIntegrationTest.java | 21 +++++----- .../CloudFormationSettingsProfile.java | 42 +++++++++++++++++++ .../floci/testing/IotSettingsProfile.java | 35 ++++++++++++++++ 8 files changed, 113 insertions(+), 63 deletions(-) create mode 100644 src/test/java/io/github/hectorvent/floci/testing/CloudFormationSettingsProfile.java create mode 100644 src/test/java/io/github/hectorvent/floci/testing/IotSettingsProfile.java diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayV2DomainCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayV2DomainCfnIntegrationTest.java index 7640f99866..0cb82cd035 100644 --- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayV2DomainCfnIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayV2DomainCfnIntegrationTest.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import com.sun.net.httpserver.HttpServer; import io.github.hectorvent.floci.core.common.XmlParser; +import io.github.hectorvent.floci.testing.CloudFormationSettingsProfile; import io.github.hectorvent.floci.testing.RestAssuredJsonUtils; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; @@ -48,7 +49,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * domain under a key with several levels, which CDK maps with {@code AWS::ApiGatewayV2::ApiMapping}. */ @QuarkusTest -@TestProfile(CloudFormationUnsupportedResourceTypeStrictIntegrationTest.StrictProfile.class) +@TestProfile(CloudFormationSettingsProfile.class) class ApiGatewayV2DomainCfnIntegrationTest { private static final String CFN_AUTH = diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDeletedStackListingRaceTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDeletedStackListingRaceTest.java index 13a21e5a03..9f2c80f769 100644 --- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDeletedStackListingRaceTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDeletedStackListingRaceTest.java @@ -2,9 +2,9 @@ package io.github.hectorvent.floci.services.cloudformation; import io.github.hectorvent.floci.core.common.RequestScopes; import io.github.hectorvent.floci.services.cloudformation.model.Stack; +import io.github.hectorvent.floci.testing.CloudFormationSettingsProfile; import io.github.hectorvent.floci.testing.RestAssuredJsonUtils; 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.BeforeAll; @@ -12,7 +12,6 @@ import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.List; -import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; @@ -26,24 +25,17 @@ import static org.junit.jupiter.api.Assertions.fail; * A stack being deleted moves from the live map to the retained-deleted one. Handing it over in * the wrong order leaves a window in which it is in neither, and a ListStacks landing there loses * a stack that both exists and is retained. + * + *
{@link CloudFormationSettingsProfile} keeps a deleted stack for a day, long enough that
+ * retention cannot end this test. The shipped 30 seconds are measured on the test
+ * {@code MutableClock}, which advances a millisecond on every read, and the pollers below read it
+ * thousands of times: left at the default they expire the retained record themselves and lose the
+ * stack for a reason that has nothing to do with the handoff.
*/
@QuarkusTest
-@TestProfile(CloudFormationDeletedStackListingRaceTest.LongRetentionProfile.class)
+@TestProfile(CloudFormationSettingsProfile.class)
class CloudFormationDeletedStackListingRaceTest {
- /**
- * Retention long enough that it cannot end this test. The shipped 30 seconds are measured on
- * the test {@code MutableClock}, which advances a millisecond on every read, and the pollers
- * below read it thousands of times: left at the default they expire the retained record
- * themselves and lose the stack for a reason that has nothing to do with the handoff.
- */
- public static final class LongRetentionProfile implements QuarkusTestProfile {
- @Override
- public Map A separate top-level class rather than a nested one, because {@code @TestProfile} applies per
* test class and Surefire discovers test classes by file name: a nested class carrying the profile
* compiles and passes when targeted directly, but is silently skipped in a full {@code mvn test}.
+ *
+ * The setting comes from {@link CloudFormationSettingsProfile}, which this class shares with the
+ * other CloudFormation classes that change a default.
*/
@QuarkusTest
-@TestProfile(CloudFormationLambdaStubCodeAllowedIntegrationTest.AllowStubProfile.class)
+@TestProfile(CloudFormationSettingsProfile.class)
class CloudFormationLambdaStubCodeAllowedIntegrationTest {
- public static final class AllowStubProfile implements QuarkusTestProfile {
- @Override
- public Map A separate top-level class rather than a nested one, because {@code @TestProfile} applies per
* test class and Surefire discovers test classes by file name: a nested class carrying the profile
* compiles and passes when targeted directly, but is silently skipped in a full {@code mvn test}.
+ *
+ * The setting comes from {@link CloudFormationSettingsProfile}, which this class shares with the
+ * other CloudFormation classes that change a default.
*/
@QuarkusTest
-@TestProfile(CloudFormationUnsupportedResourceTypeStrictIntegrationTest.StrictProfile.class)
+@TestProfile(CloudFormationSettingsProfile.class)
class CloudFormationUnsupportedResourceTypeStrictIntegrationTest {
- public static final class StrictProfile implements QuarkusTestProfile {
- @Override
- public Map The address comes from {@link IotSettingsProfile}, which this class shares with the other IoT
+ * class that changes a default.
*/
@QuarkusTest
-@TestProfile(IotDescribeEndpointOverrideIntegrationTest.Profile.class)
+@TestProfile(IotSettingsProfile.class)
class IotDescribeEndpointOverrideIntegrationTest {
- static final String ENDPOINT_ADDRESS = "iot.example.localhost.floci.io";
-
@Test
void omittedEndpointTypeReturnsTheConfiguredAddress() {
given()
@@ -68,11 +68,4 @@ class IotDescribeEndpointOverrideIntegrationTest {
.body("domainType", equalTo("AWS_MANAGED"))
.body("domainName", equalTo(ENDPOINT_ADDRESS));
}
-
- public static final class Profile implements QuarkusTestProfile {
- @Override
- public Map The setting comes from {@link IotSettingsProfile}, which this class shares with the other IoT
+ * class that changes a default.
+ */
@QuarkusTest
-@TestProfile(IotTopicRuleSqlStrictIntegrationTest.StrictRuleSqlProfile.class)
+@TestProfile(IotSettingsProfile.class)
class IotTopicRuleSqlStrictIntegrationTest {
@Test
@@ -56,11 +62,4 @@ class IotTopicRuleSqlStrictIntegrationTest {
}
""".formatted(sql);
}
-
- public static final class StrictRuleSqlProfile implements QuarkusTestProfile {
- @Override
- public Map The overrides, and who relies on them:
+ * Each override is inert for the other classes. Every type their templates declare has a
+ * provisioner, so the strict gate never fires for them. Only the stub test declares a Lambda
+ * function. Retention only changes what ListStacks and DescribeStacks by stack id return after a
+ * delete, and the other classes look a stack up only by name, which stops answering as soon as the
+ * stack is deleted.
+ */
+public class CloudFormationSettingsProfile implements QuarkusTestProfile {
+
+ @Override
+ public Map The overrides, and who relies on them:
+ * Each override is inert for the other class. The address only changes what DescribeEndpoint
+ * and the AWS-managed domain configurations report, which the rule test never reads, and strict
+ * SQL only changes how a topic rule is created, which the endpoint test never does.
+ */
+public class IotSettingsProfile implements QuarkusTestProfile {
+
+ public static final String ENDPOINT_ADDRESS = "iot.example.localhost.floci.io";
+
+ @Override
+ public Map
+ *
+ *
+ *
+ *
+ *
+ *