From f6f5eda0be1b0e46d0a27d3be0b886ea39b24474 Mon Sep 17 00:00:00 2001 From: Priamo Germosen <6233424+pgermosen@users.noreply.github.com> Date: Thu, 24 Sep 2026 18:37:54 -0400 Subject: [PATCH] test: retire four test profiles that only restate configured defaults (#4328) Quarkus builds the application once per distinct @TestProfile class, so a profile whose overrides are already the configured test values costs a full augmentation and changes nothing about how the class runs. Two classes had a profile that was inert end to end, and now run on the default profile alongside every one of their siblings: CloudTrailAdvancedSelectorsIntegrationTest set cloudtrail.flush-interval-seconds to the hour it already is. Delivery is driven through CloudTrailLogWriter.flushNow(), its buckets and trails carry random suffixes, and its assertions match on those names. StepFunctionsEcsRunTaskIntegrationTest set ecs.mock to the true it already is. Its cluster and task-family names appear nowhere else in the suite. Two more collapse into a shared profile: S3PresignedPostIamOnlyEnforcementIntegrationTest additionally set s3.enforce-auth to false, the configured default, which its own javadoc calls out as the default. It now uses the shared IamEnforcementProfile, the same one as the presigned-URL class its javadoc names as the case it mirrors. CurDailyEmissionAccountIsolationIntegrationTest and ParquetEmitterIntegrationTest both reduce to pinning the HTTP port: floci.base-url already carries the same value, and CurEmissionScheduler acts only on emit-mode daily or synchronous, so every other value is inert. They share FixedPortNoEmissionProfile, which keeps the emit-mode entries so the assumption stays visible. Each retired profile carried an assumption worth keeping, so those moved into the class javadoc rather than disappearing with the profile. Distinct test profiles across src/test/java drop from 83 to 79. --- ...TrailAdvancedSelectorsIntegrationTest.java | 16 ++++------- ...issionAccountIsolationIntegrationTest.java | 20 ++------------ .../cur/ParquetEmitterIntegrationTest.java | 23 ++-------------- ...PostIamOnlyEnforcementIntegrationTest.java | 14 ++-------- ...tepFunctionsEcsRunTaskIntegrationTest.java | 21 +++------------ .../testing/FixedPortNoEmissionProfile.java | 27 +++++++++++++++++++ 6 files changed, 42 insertions(+), 79 deletions(-) create mode 100644 src/test/java/io/github/hectorvent/floci/testing/FixedPortNoEmissionProfile.java diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailAdvancedSelectorsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailAdvancedSelectorsIntegrationTest.java index 59248fad59..5f4275f9f3 100644 --- a/src/test/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailAdvancedSelectorsIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailAdvancedSelectorsIntegrationTest.java @@ -2,13 +2,10 @@ package io.github.hectorvent.floci.services.cloudtrail; 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; import org.junit.jupiter.api.Test; -import java.util.Map; import java.util.UUID; import static io.restassured.RestAssured.given; @@ -22,9 +19,13 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * This is the reproduction case for the CloudTrail circular-logging cost problem: excluding the * trail's own destination bucket via {@code resources.ARN notStartsWith} stops the trail from * recording its own delivery writes. + * + *

Delivery is driven explicitly through {@link CloudTrailLogWriter#flushNow()} rather than by + * the background flush, which the configured {@code cloudtrail.flush-interval-seconds} of an hour + * keeps out of the way. Every bucket and trail name here carries a random suffix and the + * assertions match on those names, so the class does not need an application of its own. */ @QuarkusTest -@TestProfile(CloudTrailAdvancedSelectorsIntegrationTest.IsolatedProfile.class) class CloudTrailAdvancedSelectorsIntegrationTest { private static final String CT_TARGET = "CloudTrail_20131101."; @@ -33,13 +34,6 @@ class CloudTrailAdvancedSelectorsIntegrationTest { @Inject CloudTrailLogWriter writer; - public static final class IsolatedProfile implements QuarkusTestProfile { - @Override - public Map getConfigOverrides() { - return Map.of("floci.services.cloudtrail.flush-interval-seconds", "3600"); - } - } - @BeforeAll static void configureRestAssured() { RestAssuredJsonUtils.configureAwsContentTypes(); diff --git a/src/test/java/io/github/hectorvent/floci/services/cur/CurDailyEmissionAccountIsolationIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cur/CurDailyEmissionAccountIsolationIntegrationTest.java index bec094389b..edb71c2908 100644 --- a/src/test/java/io/github/hectorvent/floci/services/cur/CurDailyEmissionAccountIsolationIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/cur/CurDailyEmissionAccountIsolationIntegrationTest.java @@ -1,15 +1,14 @@ package io.github.hectorvent.floci.services.cur; +import io.github.hectorvent.floci.testing.FixedPortNoEmissionProfile; 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; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; -import java.util.HashMap; import java.util.Map; import static io.restassured.RestAssured.given; @@ -32,7 +31,7 @@ import static org.hamcrest.Matchers.equalTo; * {@code NoSuchBucket}. */ @QuarkusTest -@TestProfile(CurDailyEmissionAccountIsolationIntegrationTest.DailyProfile.class) +@TestProfile(FixedPortNoEmissionProfile.class) @EnabledIfEnvironmentVariable(named = "FLOCI_DUCK_CROSS_CONTAINER_TEST", matches = "1|true|yes") class CurDailyEmissionAccountIsolationIntegrationTest { @@ -43,21 +42,6 @@ class CurDailyEmissionAccountIsolationIntegrationTest { private static final String S3_AUTH = "AWS4-HMAC-SHA256 Credential=" + ACCOUNT_ID + "/20260101/us-east-1/s3/aws4_request"; - public static final class DailyProfile implements QuarkusTestProfile { - @Override - public Map getConfigOverrides() { - Map o = new HashMap<>(); - o.put("quarkus.http.test-port", "4566"); - o.put("floci.base-url", "http://localhost:4566"); - // Sync mode is off so the put-report call below does NOT emit - // immediately. The test then drives the scheduler's runDaily - // codepath directly via the engine to simulate the daily tick. - o.put("floci.services.cur.emit-mode", "off"); - o.put("floci.services.bcm-data-exports.emit-mode", "off"); - return o; - } - } - @BeforeAll static void configureRestAssured() { RestAssuredJsonUtils.configureAwsContentTypes(); diff --git a/src/test/java/io/github/hectorvent/floci/services/cur/ParquetEmitterIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cur/ParquetEmitterIntegrationTest.java index d4a6a76e63..0eaff3dea6 100644 --- a/src/test/java/io/github/hectorvent/floci/services/cur/ParquetEmitterIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/cur/ParquetEmitterIntegrationTest.java @@ -3,15 +3,13 @@ package io.github.hectorvent.floci.services.cur; import io.github.hectorvent.floci.core.common.UsageLine; import io.github.hectorvent.floci.services.floci.duck.FlociDuckClient; import io.github.hectorvent.floci.services.s3.S3Service; +import io.github.hectorvent.floci.testing.FixedPortNoEmissionProfile; 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.Test; import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; -import java.util.HashMap; - import java.time.Instant; import java.util.List; import java.util.Map; @@ -46,27 +44,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * runner that adds the host alias). */ @QuarkusTest -@TestProfile(ParquetEmitterIntegrationTest.FixedPortProfile.class) +@TestProfile(FixedPortNoEmissionProfile.class) @EnabledIfEnvironmentVariable(named = "FLOCI_DUCK_CROSS_CONTAINER_TEST", matches = "1|true|yes") class ParquetEmitterIntegrationTest { - /** - * Force Floci's HTTP server onto a known port so the floci-duck sidecar can - * reach it via {@code host.docker.internal:}. The default test port - * of {@code 0} (random) is fine for tests that only hit the JVM-local API, - * but DuckDB writes Parquet by talking back to Floci's S3 service over the - * network and so needs a stable port. - */ - public static final class FixedPortProfile implements QuarkusTestProfile { - @Override - public java.util.Map getConfigOverrides() { - java.util.Map overrides = new HashMap<>(); - overrides.put("quarkus.http.test-port", "4566"); - overrides.put("floci.base-url", "http://localhost:4566"); - return overrides; - } - } - private static final Instant JAN_15 = Instant.parse("2026-01-15T00:00:00Z"); private static final Instant JAN_16 = Instant.parse("2026-01-16T00:00:00Z"); diff --git a/src/test/java/io/github/hectorvent/floci/services/s3/S3PresignedPostIamOnlyEnforcementIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/s3/S3PresignedPostIamOnlyEnforcementIntegrationTest.java index a97f75de03..8cd88daba5 100644 --- a/src/test/java/io/github/hectorvent/floci/services/s3/S3PresignedPostIamOnlyEnforcementIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/s3/S3PresignedPostIamOnlyEnforcementIntegrationTest.java @@ -1,7 +1,7 @@ package io.github.hectorvent.floci.services.s3; +import io.github.hectorvent.floci.testing.IamEnforcementProfile; import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.junit.QuarkusTestProfile; import io.quarkus.test.junit.TestProfile; import org.junit.jupiter.api.Test; @@ -9,7 +9,6 @@ import java.nio.charset.StandardCharsets; import java.time.Instant; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; -import java.util.Map; import java.util.UUID; import static io.restassured.RestAssured.given; @@ -27,7 +26,7 @@ import static org.hamcrest.Matchers.equalTo; * {@code S3PresignedPostAuthEnforcementIntegrationTest} cannot exercise. */ @QuarkusTest -@TestProfile(S3PresignedPostIamOnlyEnforcementIntegrationTest.IamOnlyProfile.class) +@TestProfile(IamEnforcementProfile.class) class S3PresignedPostIamOnlyEnforcementIntegrationTest { private static final String REGION = "us-east-1"; @@ -209,13 +208,4 @@ class S3PresignedPostIamOnlyEnforcementIntegrationTest { return "AWS4-HMAC-SHA256 Credential=" + accessKeyId + "/" + amzDate + "/" + REGION + "/" + service + "/aws4_request, SignedHeaders=host, Signature=abc"; } - - public static final class IamOnlyProfile implements QuarkusTestProfile { - @Override - public Map getConfigOverrides() { - return Map.of( - "floci.services.iam.enforcement-enabled", "true", - "floci.services.s3.enforce-auth", "false"); - } - } } diff --git a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsEcsRunTaskIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsEcsRunTaskIntegrationTest.java index 51004fe4e9..1cb960c8c8 100644 --- a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsEcsRunTaskIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsEcsRunTaskIntegrationTest.java @@ -4,8 +4,6 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; 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 io.restassured.response.Response; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.MethodOrderer; @@ -13,8 +11,6 @@ import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; -import java.util.Map; - import static io.restassured.RestAssured.given; import static org.junit.jupiter.api.Assertions.*; @@ -28,24 +24,15 @@ import static org.junit.jupiter.api.Assertions.*; * happy-path container-execution {@code .sync} poll-to-STOPPED is exercised empirically * against a live emulator with Docker available (it is not asserted here, to keep the * unit suite independent of a container runtime / image registry). + * + *

That works because ECS runs in mock mode, so {@code RunTask} moves a task to RUNNING with no + * container runtime behind it. Mock mode is the configured test default rather than something this + * class turns on, which is why it needs no profile of its own. */ @QuarkusTest -@TestProfile(StepFunctionsEcsRunTaskIntegrationTest.EcsMockProfile.class) @TestMethodOrder(MethodOrderer.OrderAnnotation.class) class StepFunctionsEcsRunTaskIntegrationTest { - /** - * Runs ECS in mock mode so RunTask transitions tasks to RUNNING without a container - * runtime. These tests assert only the Step Functions↔ECS wiring (routing, casing, - * validation, error propagation), which is independent of real container execution. - */ - public static final class EcsMockProfile implements QuarkusTestProfile { - @Override - public Map getConfigOverrides() { - return Map.of("floci.services.ecs.mock", "true"); - } - } - private static final String SFN_CONTENT_TYPE = "application/x-amz-json-1.0"; private static final String ECS_CONTENT_TYPE = "application/x-amz-json-1.1"; private static final String ECS_TARGET_PREFIX = "AmazonEC2ContainerServiceV20141113."; diff --git a/src/test/java/io/github/hectorvent/floci/testing/FixedPortNoEmissionProfile.java b/src/test/java/io/github/hectorvent/floci/testing/FixedPortNoEmissionProfile.java new file mode 100644 index 0000000000..417ace0ef8 --- /dev/null +++ b/src/test/java/io/github/hectorvent/floci/testing/FixedPortNoEmissionProfile.java @@ -0,0 +1,27 @@ +package io.github.hectorvent.floci.testing; + +import io.quarkus.test.junit.QuarkusTestProfile; + +import java.util.Map; + +/** + * Pins the Floci HTTP port so the DuckDB sidecar can reach Floci S3 over the network, and names + * both billing emitters as off so a report is only written when the test drives the emitter + * itself. {@code CurEmissionScheduler} acts only on {@code daily} and {@code synchronous}, so + * every other value leaves the emitters idle; the configured test default already resolves to one + * of those inert values, and spelling it out here keeps the assumption visible. + * + *

Quarkus builds the application once per distinct profile class, so the classes that need this + * share one profile rather than each declaring their own. + */ +public class FixedPortNoEmissionProfile implements QuarkusTestProfile { + + @Override + public Map getConfigOverrides() { + return Map.of( + "quarkus.http.test-port", "4566", + "floci.base-url", "http://localhost:4566", + "floci.services.cur.emit-mode", "off", + "floci.services.bcm-data-exports.emit-mode", "off"); + } +}