fix(glue): scope the Data Catalog and ETL resources to the request's Region (#8315)

This commit is contained in:
mrfelek authored and GitHub committed 2026-11-14 15:11:58 -04:00
1 parent 0816789e30
commit 7120e65ab3
35 files changed
+1101 -350

No files matched your search

@@ -0,0 +1,146 @@
package io.floci.aws.core.storage;
import com.fasterxml.jackson.core.type.TypeReference;
import io.floci.aws.core.common.RegionResolver;
import io.floci.aws.testing.StorageFactories;
import org.junit.jupiter.api.io.TempDir;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import java.nio.file.Path;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
class RegionScopedStorageTest {
@TempDir
Path directory;
@ParameterizedTest
@ValueSource(strings = {"memory", "persistent", "hybrid", "wal"})
void legacyKeysAndScopedKeysCannotEscapeTheirRegion(String mode) {
StorageFactory factory = StorageFactories.open(directory, mode, "000000000000");
try {
StorageBackend<String, String> legacy = factory.create(
"appconfig", "records.json", new TypeReference<>() {});
legacy.put("existing", "legacy");
RegionScopedStorage<String> east = store(factory, "us-east-1");
RegionScopedStorage<String> west = store(factory, "us-west-2");
assertEquals(Optional.of("legacy"), east.get("existing"));
assertEquals(Optional.empty(), west.get("existing"));
east.put("existing", "east");
west.put("existing", "west");
legacy.put("untouched", "older-record");
assertEquals(Optional.empty(), legacy.get("existing"));
assertEquals(Optional.of("east"), east.get("existing"));
assertEquals(Optional.of("west"), west.get("existing"));
assertEquals(Set.of("existing", "untouched"), east.keys());
assertEquals(Set.of("existing"), west.keys());
assertEquals(List.of("west"), west.scan(key -> key.equals("existing")));
List<String> selected = west.scan(key -> true);
selected.clear();
assertEquals(List.of("west"), west.scan(key -> true));
// A key naming another Region is a key of this one: it never reaches that Region's record.
assertEquals(Optional.empty(), east.get("us-west-2/existing"));
east.delete("us-west-2/existing");
east.put("us-west-2/existing", "east-named-west");
assertEquals(Optional.of("east-named-west"), east.get("us-west-2/existing"));
assertEquals(Set.of("existing", "untouched", "us-west-2/existing"), east.keys());
assertEquals(Optional.of("west"), west.get("existing"));
assertEquals(Set.of("existing"), west.keys());
east.clear();
assertEquals(Set.of(), east.keys());
assertEquals(Optional.of("west"), west.get("existing"));
} finally {
factory.shutdownAll();
}
}
/**
* A key may hold a slash, as a Glue name may, a Region and a slash at its start included. A label shaped
* like a Region that no partition admits ({@code my-cd-1}) is part of the key.
*/
@ParameterizedTest
@ValueSource(strings = {"memory", "persistent", "hybrid", "wal"})
void aKeyWithASlashThatIsNotARegionStaysInItsRegion(String mode) {
StorageFactory factory = StorageFactories.open(directory, mode, "000000000000");
try {
StorageBackend<String, String> legacy = factory.create(
"appconfig", "records.json", new TypeReference<>() {});
legacy.put("older/record", "legacy");
RegionScopedStorage<String> east = store(factory, "us-east-1");
RegionScopedStorage<String> west = store(factory, "us-west-2");
west.put("sales/2024:orders", "west");
west.put("my-cd-1/plan", "west-plan");
assertEquals(Optional.of("west"), west.get("sales/2024:orders"));
assertEquals(Optional.of("west-plan"), west.get("my-cd-1/plan"));
assertEquals(Optional.empty(), east.get("sales/2024:orders"));
assertEquals(Set.of("sales/2024:orders", "my-cd-1/plan"), west.keys());
assertEquals(Optional.of("legacy"), east.get("older/record"));
assertEquals(Set.of("older/record"), east.keys());
assertEquals(Optional.empty(), west.get("older/record"));
west.put("eu-west-1/plan", "west-named-eu");
east.put("us-east-1/plan", "east-named-east");
assertEquals(Optional.of("west-named-eu"), west.get("eu-west-1/plan"));
assertEquals(Optional.of("east-named-east"), east.get("us-east-1/plan"));
assertEquals(Optional.empty(), east.get("eu-west-1/plan"));
assertEquals(Optional.empty(), west.get("us-east-1/plan"));
assertEquals(Set.of("sales/2024:orders", "my-cd-1/plan", "eu-west-1/plan"), west.keys());
assertEquals(Set.of("older/record", "us-east-1/plan"), east.keys());
east.delete("us-east-1/plan");
assertEquals(Optional.empty(), east.get("us-east-1/plan"));
assertEquals(Optional.of("legacy"), east.get("older/record"));
} finally {
factory.shutdownAll();
}
}
/**
* A matching deletion acts in the request's Region only, in one commit; in the default Region it takes
* the regionless keys too.
*/
@ParameterizedTest
@ValueSource(strings = {"memory", "persistent", "hybrid", "wal"})
void matchingDeletionsStayInTheirRegion(String mode) {
StorageFactory factory = StorageFactories.open(directory, mode, "000000000000");
try {
StorageBackend<String, String> legacy = factory.create(
"appconfig", "records.json", new TypeReference<>() {});
legacy.put("older", "db");
RegionScopedStorage<String> east = store(factory, "us-east-1");
RegionScopedStorage<String> west = store(factory, "us-west-2");
east.put("a", "db");
east.put("kept", "other");
west.put("a", "db");
StorageOperations.deleteMatchingAtomically(west, "db"::equals);
assertEquals(Set.of(), west.keys());
assertEquals(Set.of("a", "kept", "older"), east.keys());
StorageOperations.deleteMatchingAtomically(east, "db"::equals);
assertEquals(Set.of("kept"), east.keys());
assertEquals(Set.of("us-east-1/kept"), legacy.keys());
} finally {
factory.shutdownAll();
}
}
private static RegionScopedStorage<String> store(StorageFactory factory, String region) {
RegionResolver regions = mock(RegionResolver.class);
when(regions.getDefaultRegion()).thenReturn("us-east-1");
when(regions.getRegion()).thenReturn(region);
return new RegionScopedStorage<>(factory, regions, "appconfig", "records.json", new TypeReference<>() {});
}
}
@@ -1,5 +1,6 @@
package io.floci.aws.core.storage;
import io.floci.aws.core.common.RegionResolver;
import io.floci.aws.core.common.RequestContext;
import jakarta.enterprise.inject.Instance;
import org.junit.jupiter.api.Test;
@@ -65,6 +66,37 @@ class StorageOperationsTest {
verify(raw, never()).put(any(), any());
}
/**
* A Region view deletes its own Region's matches; in the default Region the regionless ones go too,
* the account store's unprefixed legacy keys included, as the account store deletes them itself.
*/
@ParameterizedTest
@ValueSource(strings = {"us-east-1", "eu-west-1"})
void regionViewDeletionKeepsOtherRegionsAndLegacyOwnership(String region) {
InMemoryStorage<String, String> raw = spy(new InMemoryStorage<>());
raw.putAll(Map.of(
"db:legacy", "db",
"111111111111/db:regionless", "db",
"111111111111/us-east-1/db:east", "db",
"111111111111/eu-west-1/db:west", "db",
"111111111111/eu-west-1/db:neighbor:kept", "neighbor"));
RegionResolver regions = mock(RegionResolver.class);
when(regions.getDefaultRegion()).thenReturn("us-east-1");
when(regions.getRegion()).thenReturn(region);
RegionScopedStorage<String> storage = new RegionScopedStorage<>(
new AccountAwareStorageBackend<>(raw, null, "111111111111"), regions);
clearInvocations(raw);
StorageOperations.deleteMatchingAtomically(storage, "db"::equals);
Set<String> removed = region.equals("us-east-1")
? Set.of("db:legacy", "111111111111/db:regionless", "111111111111/us-east-1/db:east")
: Set.of("111111111111/eu-west-1/db:west");
verify(raw).deleteAllAtomically(removed);
verify(raw, never()).delete(any());
verify(raw, never()).put(any(), any());
}
@Test
void failedAtomicDeletionDoesNotMigrateLegacyEntries() {
InMemoryStorage<String, String> raw = spy(new InMemoryStorage<>());
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.floci.aws.core.common.AwsException;
import io.floci.aws.core.common.RegionResolver;
import io.floci.aws.core.storage.RegionScopedStorage;
import io.floci.aws.core.storage.StorageBackend;
import io.floci.aws.services.appconfig.model.ConfigurationSession;
import io.floci.aws.testing.InMemoryStorageFactory;
@@ -39,7 +40,7 @@ class AppConfigDataServiceTest {
AppConfigService appConfig = mock(AppConfigService.class);
RegionResolver regions = new RegionResolver("us-east-1", "000000000000");
AppConfigDataService service = new AppConfigDataService(factory, appConfig, MAPPER, regions);
StorageBackend<String, ConfigurationSession> sessions = new AppConfigStorage<>(factory, regions, "appconfigdata",
StorageBackend<String, ConfigurationSession> sessions = new RegionScopedStorage<>(factory, regions, "appconfigdata",
"appconfigdata-sessions.json", new TypeReference<Map<String, ConfigurationSession>>() {});
ConfigurationSession session = new ConfigurationSession();
session.setApplicationId("app");
@@ -1,71 +0,0 @@
package io.floci.aws.services.appconfig;
import com.fasterxml.jackson.core.type.TypeReference;
import io.floci.aws.core.common.RegionResolver;
import io.floci.aws.core.storage.StorageBackend;
import io.floci.aws.core.storage.StorageFactory;
import io.floci.aws.testing.StorageFactories;
import org.junit.jupiter.api.io.TempDir;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import java.nio.file.Path;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
class AppConfigStorageTest {
@TempDir
Path directory;
@ParameterizedTest
@ValueSource(strings = {"memory", "persistent", "hybrid", "wal"})
void legacyKeysAndScopedKeysCannotEscapeTheirRegion(String mode) {
StorageFactory factory = StorageFactories.open(directory, mode, "000000000000");
try {
StorageBackend<String, String> legacy = factory.create(
"appconfig", "records.json", new TypeReference<>() {});
legacy.put("existing", "legacy");
AppConfigStorage<String> east = store(factory, "us-east-1");
AppConfigStorage<String> west = store(factory, "us-west-2");
assertEquals(Optional.of("legacy"), east.get("existing"));
assertEquals(Optional.empty(), west.get("existing"));
east.put("existing", "east");
west.put("existing", "west");
legacy.put("untouched", "older-record");
assertEquals(Optional.empty(), legacy.get("existing"));
assertEquals(Optional.of("east"), east.get("existing"));
assertEquals(Optional.of("west"), west.get("existing"));
assertEquals(Set.of("existing", "untouched"), east.keys());
assertEquals(Set.of("existing"), west.keys());
assertEquals(List.of("west"), west.scan(key -> key.equals("existing")));
List<String> selected = west.scan(key -> true);
selected.clear();
assertEquals(List.of("west"), west.scan(key -> true));
assertEquals(Optional.empty(), east.get("us-west-2/existing"));
east.delete("us-west-2/existing");
assertThrows(IllegalArgumentException.class, () -> east.put("us-west-2/existing", "wrong"));
assertEquals(Optional.of("west"), west.get("existing"));
east.clear();
assertEquals(Set.of(), east.keys());
assertEquals(Optional.of("west"), west.get("existing"));
} finally {
factory.shutdownAll();
}
}
private static AppConfigStorage<String> store(StorageFactory factory, String region) {
RegionResolver regions = mock(RegionResolver.class);
when(regions.getDefaultRegion()).thenReturn("us-east-1");
when(regions.getRegion()).thenReturn(region);
return new AppConfigStorage<>(factory, regions, "appconfig", "records.json", new TypeReference<>() {});
}
}
@@ -0,0 +1,103 @@
package io.floci.aws.services.athena;
import io.floci.aws.config.EmulatorConfig;
import io.floci.aws.core.common.RegionResolver;
import io.floci.aws.core.common.RequestScopes;
import io.floci.aws.core.storage.StorageFactory;
import io.floci.aws.services.athena.model.QueryExecutionContext;
import io.floci.aws.services.athena.model.QueryExecutionState;
import io.floci.aws.services.floci.duck.FlociDuckClient;
import io.floci.aws.services.glue.GlueService;
import io.floci.aws.services.glue.model.Database;
import io.floci.aws.services.s3.S3Service;
import io.floci.aws.testing.TestAccounts;
import io.quarkus.test.junit.QuarkusTest;
import io.vertx.core.Vertx;
import jakarta.inject.Inject;
import org.junit.jupiter.api.Test;
import java.time.Duration;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import static org.awaitility.Awaitility.await;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
* A query runs on a worker after the call that started it has returned, with no request scope of its own;
* it still reads the Glue catalog of the account and Region it was started in, and its record stays in
* that account. Runs under Quarkus, where a scope sets the account and the Region; the duck client is
* stubbed and hands back the DDL the query was set up with.
*/
@QuarkusTest
class AthenaQueryScopeTest {
private static final String REGION = "eu-west-1";
@Inject
StorageFactory storageFactory;
@Inject
GlueService glueService;
@Inject
GlueViewDdlBuilder ddlBuilder;
@Inject
RegionResolver regionResolver;
@Inject
Vertx vertx;
@Test
void aQueryReadsTheCatalogOfTheAccountAndRegionItWasStartedIn() throws Exception {
String account = TestAccounts.randomId();
String database = "scope_" + account;
// The setup DDL the query reads the catalog through, and the account its S3 reads and writes go to.
CompletableFuture<List<String>> handedToDuck = new CompletableFuture<>();
FlociDuckClient duckClient = mock(FlociDuckClient.class);
doAnswer(invocation -> {
handedToDuck.complete(List.of(invocation.getArgument(1), invocation.getArgument(3)));
return null;
}).when(duckClient).execute(anyString(), any(), any(), any());
AthenaService athena = new AthenaService(storageFactory, duckClient, glueService, mock(S3Service.class),
realQueries(), vertx, ddlBuilder, regionResolver);
try {
String expected = RequestScopes.callAs(account, REGION, () -> {
glueService.createDatabase(new Database(database));
return ddlBuilder.build(database);
});
assertNotEquals(RequestScopes.callAs(account, "us-east-1", () -> ddlBuilder.build(database)), expected);
QueryExecutionContext context = new QueryExecutionContext();
context.setDatabase(database);
String id = RequestScopes.callAs(account, REGION,
() -> athena.startQueryExecution("SELECT 1", "primary", context, null));
assertEquals(List.of(expected, account), handedToDuck.get(10, TimeUnit.SECONDS));
await().atMost(Duration.ofSeconds(10)).pollInterval(Duration.ofMillis(50)).untilAsserted(() ->
assertEquals(QueryExecutionState.SUCCEEDED, RequestScopes.callAs(account, REGION,
() -> athena.getQueryExecution(id).getStatus().getState())));
} finally {
RequestScopes.runAs(account, REGION, () -> glueService.deleteDatabase(database));
}
}
/** A configuration under which a query is handed to the duck client rather than answered at once. */
private static EmulatorConfig realQueries() {
EmulatorConfig config = mock(EmulatorConfig.class);
EmulatorConfig.ServicesConfig services = mock(EmulatorConfig.ServicesConfig.class);
EmulatorConfig.AthenaServiceConfig athena = mock(EmulatorConfig.AthenaServiceConfig.class);
when(config.services()).thenReturn(services);
when(services.athena()).thenReturn(athena);
when(athena.mock()).thenReturn(false);
return config;
}
}
@@ -84,7 +84,7 @@ class AthenaServiceTest {
release.await(10, TimeUnit.SECONDS);
finished.countDown();
return null;
}).when(duckClient).execute(anyString(), any(), any());
}).when(duckClient).execute(anyString(), any(), any(), any());
String id = service.startQueryExecution("SELECT 1", "primary", null, null);
assertTrue(started.await(10, TimeUnit.SECONDS), "the worker never started");
@@ -108,7 +108,7 @@ class AthenaServiceTest {
release.await(10, TimeUnit.SECONDS);
finished.countDown();
throw new IllegalStateException("duck failed");
}).when(duckClient).execute(anyString(), any(), any());
}).when(duckClient).execute(anyString(), any(), any(), any());
String id = service.startQueryExecution("SELECT 1", "primary", null, null);
assertTrue(started.await(10, TimeUnit.SECONDS), "the worker never started");
@@ -135,7 +135,7 @@ class AthenaServiceTest {
void stopAfterFailureLeavesTheExecutionFailed() throws Exception {
doAnswer(invocation -> {
throw new IllegalStateException("duck failed");
}).when(duckClient).execute(anyString(), any(), any());
}).when(duckClient).execute(anyString(), any(), any(), any());
String id = service.startQueryExecution("SELECT 1", "primary", null, null);
@@ -150,7 +150,7 @@ class AthenaServiceTest {
void getQueryResultsReportsTheSqlTypeOfEachColumn() throws Exception {
String query = "SELECT CAST(1 AS BIGINT) AS n, CAST(1.5 AS DOUBLE) AS d, true AS b, "
+ "DATE '2026-01-01' AS dt, CAST(2.50 AS DECIMAL(10,2)) AS p, 'x' AS s";
when(duckClient.query(eq("DESCRIBE " + query), any())).thenReturn(List.of(
when(duckClient.query(eq("DESCRIBE " + query), any(), any())).thenReturn(List.of(
Map.of("column_name", "n", "column_type", "BIGINT"),
Map.of("column_name", "d", "column_type", "DOUBLE"),
Map.of("column_name", "b", "column_type", "BOOLEAN"),
@@ -166,7 +166,7 @@ class AthenaServiceTest {
@Test
void getQueryResultsReportsThePrecisionAndScaleOfADecimalColumn() throws Exception {
String query = "SELECT CAST(2.50 AS DECIMAL(10,2)) AS p";
when(duckClient.query(eq("DESCRIBE " + query), any())).thenReturn(List.of(
when(duckClient.query(eq("DESCRIBE " + query), any(), any())).thenReturn(List.of(
Map.of("column_name", "p", "column_type", "DECIMAL(10,2)")));
ResultSet.ColumnInfo column = columnInfo(query, "p\n2.50\n").get(0);
@@ -179,7 +179,7 @@ class AthenaServiceTest {
@Test
void getQueryResultsReportsTimeAndTimestampVariantsByTheirAthenaNames() throws Exception {
String query = "SELECT t, ts_s, ts_ms, ts_ns, ts_tz, t_tz FROM times";
when(duckClient.query(eq("DESCRIBE " + query), any())).thenReturn(List.of(
when(duckClient.query(eq("DESCRIBE " + query), any(), any())).thenReturn(List.of(
Map.of("column_name", "t", "column_type", "TIME"),
Map.of("column_name", "ts_s", "column_type", "TIMESTAMP_S"),
Map.of("column_name", "ts_ms", "column_type", "TIMESTAMP_MS"),
@@ -195,7 +195,7 @@ class AthenaServiceTest {
@Test
void getQueryResultsReportsVarcharWhenTheTypesCannotBeDescribed() throws Exception {
when(duckClient.query(anyString(), any())).thenThrow(new IllegalStateException("not describable"));
when(duckClient.query(anyString(), any(), any())).thenThrow(new IllegalStateException("not describable"));
assertEquals(List.of("varchar", "varchar"), columnInfo("SELECT 1 AS a, 2 AS b", "a,b\n1,2\n").stream()
.map(ResultSet.ColumnInfo::getType).toList());
@@ -0,0 +1,100 @@
package io.floci.aws.services.firehose;
import io.floci.aws.core.common.RegionResolver;
import io.floci.aws.services.s3.S3Service;
import io.floci.aws.services.s3.model.PutObjectOptions;
import io.floci.aws.testing.EnforcementFixtures;
import io.floci.aws.testing.FirehoseRequests;
import io.floci.aws.testing.PartitionCleanup;
import io.floci.aws.testing.RestAssuredJsonUtils;
import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.mockito.InjectSpy;
import io.restassured.response.ValidatableResponse;
import jakarta.inject.Inject;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import java.net.URI;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import static io.restassured.RestAssured.given;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyMap;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
/**
* A flush outside any request, as the scheduled one runs, delivers as its stream's account and in its
* stream's Region: every store the delivery touches, the Regional Glue catalog included, reads both from
* the request scope.
*/
@QuarkusTest
class FirehoseFlushRegionTest {
private static final AtomicLong ACCOUNTS = new AtomicLong(731200000000L);
private static final String REGION = "eu-west-1";
@InjectSpy
S3Service s3Service;
@Inject
FirehoseService firehoseService;
@Inject
RegionResolver regionResolver;
@TestHTTPResource
URI baseUri;
@RegisterExtension
final PartitionCleanup cleanup = new PartitionCleanup();
@BeforeAll
static void configureAwsJson() {
RestAssuredJsonUtils.configureAwsContentTypes();
}
@Test
void aFlushOutsideARequestDeliversInItsStreamsAccountAndRegion() {
String account = Long.toString(ACCOUNTS.incrementAndGet());
String stream = "flush-region-" + account;
String bucket = "flush-region-" + account;
AtomicReference<String> scope = new AtomicReference<>();
doAnswer(invocation -> {
scope.set(regionResolver.getAccountId() + " " + regionResolver.getRegion());
return invocation.callRealMethod();
}).when(s3Service).putObject(eq(bucket), anyString(), any(byte[].class), anyString(), anyMap(),
any(PutObjectOptions.class));
firehose(account, "CreateDeliveryStream", """
{"DeliveryStreamName": "%s", "DeliveryStreamType": "DirectPut",
"ExtendedS3DestinationConfiguration": {
"RoleARN": "arn:aws:iam::%s:role/firehose-delivery-role",
"BucketARN": "arn:aws:s3:::%s",
"BufferingHints": {"SizeInMBs": 5, "IntervalInSeconds": 60}}}
""".formatted(stream, account, bucket)).statusCode(200);
cleanup.register(() -> EnforcementFixtures.removeBucket(baseUri.getPort(),
EnforcementFixtures.auth(account, "s3"), bucket));
cleanup.register(() -> firehose(account, "DeleteDeliveryStream",
"{\"DeliveryStreamName\": \"" + stream + "\"}"));
firehose(account, "PutRecord", "{\"DeliveryStreamName\": \"" + stream + "\", \"Record\": {\"Data\": \""
+ FirehoseRequests.encode("{\"n\":1}") + "\"}}").statusCode(200);
firehoseService.flush(account, REGION, stream);
assertEquals(account + " " + REGION, scope.get());
}
private static ValidatableResponse firehose(String account, String action, String body) {
return given().contentType("application/x-amz-json-1.1")
.header("X-Amz-Target", "Firehose_20150804." + action)
.header("Authorization", EnforcementFixtures.auth(account, REGION, "firehose"))
.body(body)
.when().post("/")
.then();
}
}
@@ -65,9 +65,9 @@ import static org.mockito.Mockito.when;
*/
class FirehoseParquetConverterTest {
private static final String BUCKET = "results";
private static final String STAGING = "floci-firehose-staging";
private static final Instant DELIVERY_TIME = Instant.parse("2026-01-01T00:00:00Z");
static final String BUCKET = "results";
static final String STAGING = "floci-firehose-staging";
static final Instant DELIVERY_TIME = Instant.parse("2026-01-01T00:00:00Z");
private static final byte[] STAGED_PARQUET = "PAR1staged".getBytes(StandardCharsets.UTF_8);
private GlueService glueService;
@@ -94,7 +94,7 @@ class FirehoseParquetConverterTest {
new Column("ts", "timestamp")));
}
private static Table table(Column... columns) {
static Table table(Column... columns) {
StorageDescriptor descriptor = new StorageDescriptor();
descriptor.setColumns(Arrays.asList(columns));
Table table = new Table();
@@ -102,7 +102,7 @@ class FirehoseParquetConverterTest {
return table;
}
private static DeliveryStreamDescription stream() {
static DeliveryStreamDescription stream() {
SchemaConfiguration schema = new SchemaConfiguration();
schema.setRoleArn("arn:aws:iam::000000000000:role/firehose-role");
schema.setDatabaseName("db");
@@ -130,7 +130,7 @@ class FirehoseParquetConverterTest {
return new DeliveryStreamDescription("stream", "arn:aws:firehose:::stream", s3);
}
private static byte[] record(String json) {
static byte[] record(String json) {
return (json + "\n").getBytes(StandardCharsets.UTF_8);
}
@@ -0,0 +1,68 @@
package io.floci.aws.services.firehose;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.floci.aws.core.common.RegionResolver;
import io.floci.aws.core.common.RequestScopes;
import io.floci.aws.services.firehose.model.DeliveryStreamDescription;
import io.floci.aws.services.floci.duck.FlociDuckClient;
import io.floci.aws.services.glue.GlueService;
import io.floci.aws.services.glue.model.Column;
import io.floci.aws.services.s3.S3Service;
import io.quarkus.test.junit.QuarkusTest;
import jakarta.inject.Inject;
import org.junit.jupiter.api.Test;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
* A Parquet conversion reads its Glue table in SchemaConfiguration.Region when the stream names one, as
* AWS does, and in the Region the delivery runs in otherwise. The Glue catalog is Regional, so the Region
* decides which table is found. Runs under Quarkus, where a scoped call can set the Region; each delivery
* runs in a Region that is not the default, as a scheduled flush runs in its stream's.
*/
@QuarkusTest
class FirehoseParquetSchemaRegionTest {
private static final String ACCOUNT = "000000000000";
private static final String DELIVERY_REGION = "ap-southeast-2";
@Inject
RegionResolver regionResolver;
@Test
void theSchemasTableIsReadInTheRegionItsConfigurationNames() {
assertEquals("eu-west-1", RequestScopes.callAs(ACCOUNT, DELIVERY_REGION,
() -> regionOfTheTableRead("eu-west-1")));
}
@Test
void withoutARegionTheTableIsReadInTheDeliverysOwnRegion() {
assertEquals(DELIVERY_REGION, RequestScopes.callAs(ACCOUNT, DELIVERY_REGION,
() -> regionOfTheTableRead(null)));
}
/** The Region current when the converter read the Glue table, for a schema naming {@code schemaRegion}. */
private String regionOfTheTableRead(String schemaRegion) {
GlueService glueService = mock(GlueService.class);
AtomicReference<String> region = new AtomicReference<>();
when(glueService.getTable("db", "events")).thenAnswer(invocation -> {
region.set(regionResolver.getRegion());
return FirehoseParquetConverterTest.table(new Column("ticker", "string"));
});
FirehoseParquetConverter converter = new FirehoseParquetConverter(glueService, mock(FlociDuckClient.class),
mock(S3Service.class), new ObjectMapper(), regionResolver, FirehoseParquetConverterTest.STAGING);
DeliveryStreamDescription stream = FirehoseParquetConverterTest.stream();
stream.s3Destination().getDataFormatConversionConfiguration().getSchemaConfiguration().setRegion(schemaRegion);
converter.deliver(stream, FirehoseParquetConverterTest.BUCKET,
List.of(FirehoseParquetConverterTest.record("{\"ticker\": \"AAA\"}")),
FirehoseParquetConverterTest.DELIVERY_TIME);
return region.get();
}
}
@@ -3,14 +3,13 @@ package io.floci.aws.services.glue;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.floci.aws.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import java.util.List;
import java.util.UUID;
import static io.restassured.RestAssured.given;
import static io.floci.aws.testing.GlueRequests.call;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
@@ -29,7 +28,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
class GlueDataQualityRulesetIntegrationTest {
private static final ObjectMapper MAPPER = new ObjectMapper();
private static final String CONTENT_TYPE = "application/x-amz-json-1.1";
private static final String REGION = "us-east-1";
private static final String RULESET = "Rules = [ RowCount > 0, IsComplete \"id\", "
+ "(ColumnValues \"age\" > 0) and (ColumnValues \"age\" < 150) ]";
@@ -253,15 +251,6 @@ class GlueDataQualityRulesetIntegrationTest {
.extract().jsonPath().getList("Rulesets.Name", String.class);
}
private static ValidatableResponse call(String action, String account, String region, String body) {
return given().contentType(CONTENT_TYPE)
.header("X-Amz-Target", "AWSGlue." + action)
.header("Authorization", authorization(account, region))
.body(body)
.when().post("/")
.then();
}
private static String json(String text) {
return "\"" + text.replace("\\", "\\\\").replace("\"", "\\\"") + "\"";
}
@@ -269,9 +258,4 @@ class GlueDataQualityRulesetIntegrationTest {
private static String unique(String prefix) {
return prefix + "-" + UUID.randomUUID().toString().substring(0, 8);
}
private static String authorization(String account, String region) {
return "AWS4-HMAC-SHA256 Credential=" + account
+ "/20260918/" + region + "/glue/aws4_request, SignedHeaders=host, Signature=abc";
}
}
@@ -0,0 +1,141 @@
package io.floci.aws.services.glue;
import io.floci.aws.testing.GlueRequests;
import io.floci.aws.testing.PartitionCleanup;
import io.floci.aws.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The Glue Data Catalog and Glue's ETL resources are Regional, as on AWS: a resource created in one Region
* is listed and reached only there, and its name can be used again in another Region of the account. Each
* test works in an account of its own, so a listing holds only what that test created.
*/
@QuarkusTest
class GlueRegionScopingIntegrationTest {
private static final AtomicLong ACCOUNTS = new AtomicLong(731100000000L);
private static final String ROLE = "arn:aws:iam::000000000000:role/glue";
/**
* One resource of each type: its name; how to create, get and delete it; how to list its type, and where
* the listing puts the names.
*/
private record Kind(String resource, String createAction, String createBody, String getAction,
String getBody, String deleteAction, String deleteBody, String listAction,
String listBody, String names) {}
private static final List<Kind> KINDS = List.of(
new Kind("sales", "CreateDatabase", "{\"DatabaseInput\":{\"Name\":\"sales\"}}",
"GetDatabase", "{\"Name\":\"sales\"}", "DeleteDatabase", "{\"Name\":\"sales\"}",
"GetDatabases", "{}", "DatabaseList.Name"),
new Kind("orders", "CreateTable", "{\"DatabaseName\":\"sales\",\"TableInput\":{\"Name\":\"orders\"}}",
"GetTable", "{\"DatabaseName\":\"sales\",\"Name\":\"orders\"}",
"DeleteTable", "{\"DatabaseName\":\"sales\",\"Name\":\"orders\"}",
"GetTables", "{\"DatabaseName\":\"sales\"}", "TableList.Name"),
new Kind("etl", "CreateJob", "{\"Name\":\"etl\",\"Role\":\"" + ROLE
+ "\",\"Command\":{\"Name\":\"glueetl\",\"ScriptLocation\":\"s3://b/s.py\"}}",
"GetJob", "{\"JobName\":\"etl\"}", "DeleteJob", "{\"JobName\":\"etl\"}",
"ListJobs", "{}", "JobNames"),
new Kind("warehouse", "CreateConnection", "{\"ConnectionInput\":{\"Name\":\"warehouse\","
+ "\"ConnectionType\":\"JDBC\",\"ConnectionProperties\":{\"JDBC_CONNECTION_URL\":"
+ "\"jdbc:mysql://h:3306/d\",\"USERNAME\":\"u\",\"PASSWORD\":\"p\"}}}",
"GetConnection", "{\"Name\":\"warehouse\"}",
"DeleteConnection", "{\"ConnectionName\":\"warehouse\"}",
"GetConnections", "{}", "ConnectionList.Name"),
new Kind("crawl", "CreateCrawler", "{\"Name\":\"crawl\",\"Role\":\"" + ROLE
+ "\",\"Targets\":{\"S3Targets\":[{\"Path\":\"s3://b/p\"}]}}",
"GetCrawler", "{\"Name\":\"crawl\"}", "DeleteCrawler", "{\"Name\":\"crawl\"}",
"ListCrawlers", "{}", "CrawlerNames"),
new Kind("csv", "CreateClassifier", "{\"CsvClassifier\":{\"Name\":\"csv\"}}",
"GetClassifier", "{\"Name\":\"csv\"}", "DeleteClassifier", "{\"Name\":\"csv\"}",
"GetClassifiers", "{}", "Classifiers.CsvClassifier.Name"),
new Kind("nightly", "CreateWorkflow", "{\"Name\":\"nightly\"}",
"GetWorkflow", "{\"Name\":\"nightly\"}", "DeleteWorkflow", "{\"Name\":\"nightly\"}",
"ListWorkflows", "{}", "Workflows"),
new Kind("start", "CreateTrigger", "{\"Name\":\"start\",\"Type\":\"ON_DEMAND\","
+ "\"Actions\":[{\"JobName\":\"etl\"}]}",
"GetTrigger", "{\"Name\":\"start\"}", "DeleteTrigger", "{\"Name\":\"start\"}",
"ListTriggers", "{}", "TriggerNames"));
@RegisterExtension
final PartitionCleanup cleanup = new PartitionCleanup();
private String account;
@BeforeAll
static void configureAwsJson() {
RestAssuredJsonUtils.configureAwsContentTypes();
}
@BeforeEach
void accountOfItsOwn() {
account = Long.toString(ACCOUNTS.incrementAndGet());
}
@Test
void eachResourceIsSeenOnlyInTheRegionItWasCreatedIn() {
createAll("us-east-1");
for (Kind kind : KINDS) {
assertEquals(List.of(), names("eu-west-1", kind), kind.listAction());
glue("eu-west-1", kind.getAction(), kind.getBody())
.statusCode(400).body("__type", equalTo("EntityNotFoundException"));
}
createAll("eu-west-1");
for (Kind kind : KINDS) {
for (String region : List.of("us-east-1", "eu-west-1")) {
assertEquals(List.of(kind.resource()), names(region, kind), region + " " + kind.listAction());
glue(region, kind.getAction(), kind.getBody()).statusCode(200);
}
}
}
@Test
void deletingADatabaseInOneRegionLeavesTheOthersCatalog() {
for (String region : List.of("us-east-1", "eu-west-1")) {
create(region, KINDS.get(0));
create(region, KINDS.get(1));
}
glue("eu-west-1", "DeleteDatabase", "{\"Name\":\"sales\"}").statusCode(200);
glue("eu-west-1", "GetDatabase", "{\"Name\":\"sales\"}")
.statusCode(400).body("__type", equalTo("EntityNotFoundException"));
glue("us-east-1", "GetTable", "{\"DatabaseName\":\"sales\",\"Name\":\"orders\"}")
.statusCode(200).body("Table.Name", equalTo("orders"));
}
/** Creates one resource of each kind in {@code region}, each deleted after the test. */
private void createAll(String region) {
KINDS.forEach(kind -> create(region, kind));
}
/** Creates {@code kind}'s resource in {@code region}; the cleanup deletes it, unless the test already did. */
private void create(String region, Kind kind) {
glue(region, kind.createAction(), kind.createBody()).statusCode(200);
cleanup.register(() -> glue(region, kind.deleteAction(), kind.deleteBody()));
}
/** The names {@code region} lists for the kind's type. */
private List<String> names(String region, Kind kind) {
return glue(region, kind.listAction(), kind.listBody()).statusCode(200)
.extract().jsonPath().getList(kind.names(), String.class);
}
private ValidatableResponse glue(String region, String action, String body) {
return GlueRequests.call(action, account, region, body);
}
}
@@ -3,6 +3,7 @@ package io.floci.aws.services.glue;
import com.fasterxml.jackson.core.type.TypeReference;
import io.floci.aws.core.storage.PersistentStorage;
import io.floci.aws.services.glue.model.SecurityConfiguration;
import io.floci.aws.testing.GlueRequests;
import io.floci.aws.testing.PartitionCleanup;
import io.floci.aws.testing.PersistentStorageProfile;
import io.floci.aws.testing.RestAssuredJsonUtils;
@@ -117,20 +118,12 @@ class GlueSecurityConfigurationIntegrationTest {
create(NAME, "us-east-1", "000000000001");
cleanup.register(() -> delete(NAME, "us-east-1", "000000000001"));
given().contentType(CONTENT_TYPE)
.header("X-Amz-Target", "AWSGlue.GetSecurityConfiguration")
.header("Authorization", authorization("000000000002", "us-east-1"))
.body("{\"Name\":\"" + NAME + "\"}")
.when().post("/")
.then().statusCode(400)
GlueRequests.call("GetSecurityConfiguration", "000000000002", "us-east-1", "{\"Name\":\"" + NAME + "\"}")
.statusCode(400)
.body("__type", containsString("EntityNotFoundException"));
given().contentType(CONTENT_TYPE)
.header("X-Amz-Target", "AWSGlue.GetSecurityConfiguration")
.header("Authorization", authorization("000000000001", "us-west-2"))
.body("{\"Name\":\"" + NAME + "\"}")
.when().post("/")
.then().statusCode(400)
GlueRequests.call("GetSecurityConfiguration", "000000000001", "us-west-2", "{\"Name\":\"" + NAME + "\"}")
.statusCode(400)
.body("__type", containsString("EntityNotFoundException"));
PersistentStorage<String, SecurityConfiguration> store = new PersistentStorage<>(
@@ -141,37 +134,21 @@ class GlueSecurityConfigurationIntegrationTest {
}
private static void create(String name, String region, String account) {
given().contentType(CONTENT_TYPE)
.header("X-Amz-Target", "AWSGlue.CreateSecurityConfiguration")
.header("Authorization", authorization(account, region))
.body("{\"Name\":\"" + name + "\",\"EncryptionConfiguration\":" + ENCRYPTION + "}")
.when().post("/")
.then().statusCode(200)
GlueRequests.call("CreateSecurityConfiguration", account, region,
"{\"Name\":\"" + name + "\",\"EncryptionConfiguration\":" + ENCRYPTION + "}")
.statusCode(200)
.body("Name", equalTo(name))
.body("CreatedTimestamp", instanceOf(Number.class));
}
private static void delete(String name, String region, String account) {
given().contentType(CONTENT_TYPE)
.header("X-Amz-Target", "AWSGlue.DeleteSecurityConfiguration")
.header("Authorization", authorization(account, region))
.body("{\"Name\":\"" + name + "\"}")
.when().post("/")
.then().statusCode(200);
GlueRequests.call("DeleteSecurityConfiguration", account, region, "{\"Name\":\"" + name + "\"}")
.statusCode(200);
}
/** For cleanup: each test deletes its configuration itself, unless an assertion stops it. */
private static void deleteIfPresent(String name, String region, String account) {
given().contentType(CONTENT_TYPE)
.header("X-Amz-Target", "AWSGlue.DeleteSecurityConfiguration")
.header("Authorization", authorization(account, region))
.body("{\"Name\":\"" + name + "\"}")
.when().post("/")
.then().statusCode(anyOf(equalTo(200), equalTo(400)));
}
private static String authorization(String account, String region) {
return "AWS4-HMAC-SHA256 Credential=" + account
+ "/20260918/" + region + "/glue/aws4_request, SignedHeaders=host, Signature=abc";
GlueRequests.call("DeleteSecurityConfiguration", account, region, "{\"Name\":\"" + name + "\"}")
.statusCode(anyOf(equalTo(200), equalTo(400)));
}
}
@@ -8,6 +8,7 @@ import io.floci.aws.core.common.RegionResolver;
import io.floci.aws.core.storage.AccountAwareStorageBackend;
import io.floci.aws.core.storage.InMemoryStorage;
import io.floci.aws.core.storage.PersistentStorage;
import io.floci.aws.core.storage.RegionScopedStorage;
import io.floci.aws.core.storage.StorageBackend;
import io.floci.aws.core.storage.StorageFactory;
import io.floci.aws.services.glue.model.AuthenticationConfiguration;
@@ -2406,7 +2407,9 @@ class GlueServiceTest {
ACCOUNT_ID + "/db1:neighbor:legacy", function("db1:neighbor", "legacy")));
PersistentStorage<String, UserDefinedFunction> reloaded = new PersistentStorage<>(file, new TypeReference<>() {});
reloaded.load();
setUp(new InMemoryStorage<>(), new AccountAwareStorageBackend<>(reloaded, null, ACCOUNT_ID));
// As GlueService's own constructor builds it: the Region view over the account store.
setUp(new InMemoryStorage<>(), new RegionScopedStorage<>(
new AccountAwareStorageBackend<>(reloaded, null, ACCOUNT_ID), new RegionResolver(REGION, ACCOUNT_ID)));
glueService.deleteDatabase("db1");
glueService.createDatabase(new Database("db1"));
@@ -980,6 +980,25 @@ class RedshiftServiceTest {
autoCopyConsumer);
}
/**
* Work done outside a request on a cluster's behalf, Redshift Spectrum over JDBC, learns the cluster's Region: the
* one it was created in, and the default Region for a cluster stored before clusters kept one.
*/
@Test
void aClustersRegionIsTheOneItWasCreatedIn() {
Cluster analytics = new Cluster();
analytics.setClusterIdentifier("analytics");
analytics.setSnapshotRegion("eu-west-1");
Cluster legacy = new Cluster();
legacy.setClusterIdentifier("legacy");
when(clusterBackend.getForAccount("111111111111", "analytics")).thenReturn(Optional.of(analytics));
when(clusterBackend.getForAccount("111111111111", "legacy")).thenReturn(Optional.of(legacy));
assertEquals(Optional.of("eu-west-1"), service.clusterRegion("111111111111", "analytics"));
assertEquals(Optional.of("us-east-1"), service.clusterRegion("111111111111", "legacy"));
assertEquals(Optional.empty(), service.clusterRegion("111111111111", "missing"));
}
private static final String ORDERS_TABLE_ARN = "arn:aws:dynamodb:us-east-1:111111111111:table/orders";
private static final String NAMESPACE_ARN = "arn:aws:redshift-serverless:us-east-1:111111111111:namespace/"
+ "8f3e0b52-6c1a-4f0e-9d7b-2a4c5e6f7a8b";
@@ -0,0 +1,60 @@
package io.floci.aws.services.redshift.spectrum;
import io.floci.aws.core.common.AwsException;
import io.floci.aws.core.common.RegionResolver;
import io.floci.aws.services.glue.GlueService;
import io.quarkus.test.junit.QuarkusTest;
import jakarta.inject.Inject;
import org.junit.jupiter.api.Test;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.BiFunction;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
* Redshift Spectrum reads the Glue catalog of its cluster's Region, as on AWS, whatever Region the call runs
* in: over a JDBC connection that is no request's. Runs under Quarkus, where a scoped call sets the Region.
*/
@QuarkusTest
class SpectrumCatalogRegionTest {
private static final String ROLE = "arn:aws:iam::000000000000:role/spectrum";
private static final SpectrumSession SESSION = new SpectrumSession("000000000000", "000000000000:analytics",
"dev", List.of(ROLE), false);
@Inject
RegionResolver regionResolver;
@Test
void anExternalSchemaReadsTheCatalogOfTheClustersRegion() {
assertEquals("eu-west-1", regionOfTheCatalogRead(
(accountId, cluster) -> "analytics".equals(cluster) ? "eu-west-1" : null));
}
@Test
void aClusterFlociDoesNotKnowKeepsTheRegionTheCallRunsIn() {
assertEquals(regionResolver.getDefaultRegion(), regionOfTheCatalogRead((accountId, cluster) -> null));
}
/** The Region current when Spectrum looked the external schema's Glue database up. */
private String regionOfTheCatalogRead(BiFunction<String, String, String> clusterRegion) {
GlueService glue = mock(GlueService.class);
AtomicReference<String> region = new AtomicReference<>();
when(glue.getDatabase("sales")).thenAnswer(invocation -> {
region.set(regionResolver.getRegion());
throw new AwsException("EntityNotFoundException", "Database not found: sales", 400);
});
SpectrumQueryPreparation preparation = new SpectrumQueryPreparation(mock(ExternalCatalogRegistry.class),
mock(ExternalTableMaterializer.class), new ExternalStatementParser(), glue,
mock(ExternalMetadataWriter.class), new ExternalCatalogLocks(), clusterRegion);
preparation.prepare("CREATE EXTERNAL SCHEMA lake FROM DATA CATALOG DATABASE 'sales' IAM_ROLE '" + ROLE + "'",
SESSION, mock(BackendSql.class));
return region.get();
}
}
@@ -125,6 +125,14 @@ class S3GlobalLegacyListingTest {
invocation.<Runnable>getArgument(1).run();
return null;
}));
// A Firehose flush runs as the stream's account and in its Region.
scopes.when(() -> RequestScopes.callAs(anyString(), anyString(), any(Supplier.class))).thenAnswer(invocation ->
inScope(invocation.getArgument(0), invocation.getArgument(1), invocation.getArgument(2)));
scopes.when(() -> RequestScopes.runAs(anyString(), anyString(), any(Runnable.class))).thenAnswer(invocation ->
inScope(invocation.getArgument(0), invocation.getArgument(1), () -> {
invocation.<Runnable>getArgument(2).run();
return null;
}));
s3.createBucket(BUCKET, "us-east-1");
s3.putObject(BUCKET, "object.txt", "owner-data".getBytes(UTF_8), "text/plain", Map.of());
}
@@ -246,4 +254,14 @@ class S3GlobalLegacyListingTest {
request.setAccountId(previous);
}
}
private <T> T inScope(String account, String regionName, Supplier<T> action) {
String previous = request.getRegion();
request.setRegion(regionName);
try {
return inAccount(account, action);
} finally {
request.setRegion(previous);
}
}
}
@@ -0,0 +1,26 @@
package io.floci.aws.testing;
import io.restassured.response.ValidatableResponse;
import static io.restassured.RestAssured.given;
/**
* Glue JSON calls signed for an account and a Region, over the test's RestAssured port. The caller
* registers the AWS JSON content types first ({@link RestAssuredJsonUtils#configureAwsContentTypes}).
*/
public final class GlueRequests {
private static final String CONTENT_TYPE = "application/x-amz-json-1.1";
private GlueRequests() {}
/** {@code AWSGlue.<action>} with {@code body}, signed for {@code account} in {@code region}. */
public static ValidatableResponse call(String action, String account, String region, String body) {
return given().contentType(CONTENT_TYPE)
.header("X-Amz-Target", "AWSGlue." + action)
.header("Authorization", EnforcementFixtures.auth(account, "20260918", region, "glue"))
.body(body)
.when().post("/")
.then();
}
}