diff --git a/src/test/java/io/floci/aws/core/common/UnknownServiceScopeGuardDisabledIntegrationTest.java b/src/test/java/io/floci/aws/core/common/UnknownServiceScopeGuardDisabledIntegrationTest.java index b367e1efb2..22d507759c 100644 --- a/src/test/java/io/floci/aws/core/common/UnknownServiceScopeGuardDisabledIntegrationTest.java +++ b/src/test/java/io/floci/aws/core/common/UnknownServiceScopeGuardDisabledIntegrationTest.java @@ -1,14 +1,12 @@ package io.floci.aws.core.common; +import io.floci.aws.testing.RdsMockProfile; import io.floci.aws.testing.RestAssuredJsonUtils; import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.junit.QuarkusTestProfile; import io.quarkus.test.junit.TestProfile; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import java.util.Map; - import static io.restassured.RestAssured.given; import static org.hamcrest.Matchers.containsString; @@ -16,9 +14,10 @@ import static org.hamcrest.Matchers.containsString; * The guard is only as good as the catalog's scope list, so it has an off switch: if Floci * serves a route whose signing scope is not enumerated, rejecting it is a 404 with no * workaround. Disabling restores the pre-#1754 fall-through rather than failing the request. + * {@link RdsMockProfile} turns the guard off. */ @QuarkusTest -@TestProfile(UnknownServiceScopeGuardDisabledIntegrationTest.GuardDisabledProfile.class) +@TestProfile(RdsMockProfile.class) class UnknownServiceScopeGuardDisabledIntegrationTest { @BeforeAll @@ -66,11 +65,4 @@ class UnknownServiceScopeGuardDisabledIntegrationTest { .statusCode(400) .body(containsString("InvalidArgument")); } - - public static final class GuardDisabledProfile implements QuarkusTestProfile { - @Override - public Map getConfigOverrides() { - return Map.of("floci.protocols.reject-unknown-service-scope", "false"); - } - } } diff --git a/src/test/java/io/floci/aws/testing/RdsMockProfile.java b/src/test/java/io/floci/aws/testing/RdsMockProfile.java index 539f306664..780174a8aa 100644 --- a/src/test/java/io/floci/aws/testing/RdsMockProfile.java +++ b/src/test/java/io/floci/aws/testing/RdsMockProfile.java @@ -59,6 +59,12 @@ import java.util.Set; * relies on it. The refusal comes from the reset preflight, before any service is cleared. * DynamoDB itself never starts in this application: its state and its TTL sweeper are set up by * the lifecycle this one replaces. + *
  • {@code floci.protocols.reject-unknown-service-scope=false} turns off two refusals that + * would otherwise answer with {@code UnknownOperationException}: a REST request signed for a + * scope the catalog does not list, and a known REST JSON service's request that lands on S3's + * path-style wildcard route or on another service's colliding route. Either now falls through to + * the route it matched. {@code UnknownServiceScopeGuardDisabledIntegrationTest} relies on it, and + * checks both.
  • * * *

    Each override is inert for the other classes. Each is read by a single service: RDS, the @@ -66,11 +72,15 @@ import java.util.Set; * EMR release catalogue, Firehose delivery, ElastiCache and the DynamoDB backend. No other class * here calls the service an override changes, none calls DynamoDB, and no class here posts an * emulator reset apart from {@code DynamoDbBackendResetIntegrationTest}, whose reset is the refused - * one. + * one. The two refusals the guard setting turns off only answer a request signed for an unlisted + * scope or a known REST JSON service's request on a route that is not its own, and only + * {@code UnknownServiceScopeGuardDisabledIntegrationTest} sends either. * - *

    A class joins only if no other class here calls the service its setting changes, and if it - * neither resets the emulator nor calls DynamoDB, directly or through a CloudFormation stack. A - * class that needs RDS mocked and nothing else can join on those terms. + *

    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. It must + * also neither reset the emulator nor call DynamoDB, directly or through a CloudFormation stack, nor + * expect either refusal above, so a class that needs RDS mocked and nothing else can join on those + * terms. */ public class RdsMockProfile implements QuarkusTestProfile { @@ -96,7 +106,8 @@ public class RdsMockProfile implements QuarkusTestProfile { Map.entry("floci.services.firehose.flush-record-count", "2"), Map.entry("floci.services.elasticache.default-image", ELASTICACHE_SHELL_LESS_IMAGE), Map.entry("floci.services.elasticache.shell-less-backend", "true"), - Map.entry("floci.services.elasticache.shell-less-backend-dbfilename", "dump.kdb")); + Map.entry("floci.services.elasticache.shell-less-backend-dbfilename", "dump.kdb"), + Map.entry("floci.protocols.reject-unknown-service-scope", "false")); } @Override