mirror of
https://github.com/floci-io/floci.git
synced 2026-11-29 00:21:51 -05:00
Feature/issue 1130 glue database tags (#1248)
* fix(glue): register database tags with tagging API (#1130) * test(glue): add database tagging compatibility coverage (#1130) * test(tagging): allow additional tagged resources (#1130) --------- Co-authored-by: nathan <nathan@debian-dev-small.localdomain>
This commit is contained in:
1 parent
3f8e2600b3
commit
92f4ff1ccf
13 files changed
+303
-6
No files matched your search
@@ -16,6 +16,7 @@ import (
|
||||
"github.com/aws/aws-sdk-go-v2/service/pipes"
|
||||
"github.com/aws/aws-sdk-go-v2/service/cloudwatch"
|
||||
"github.com/aws/aws-sdk-go-v2/service/dynamodb"
|
||||
"github.com/aws/aws-sdk-go-v2/service/glue"
|
||||
"github.com/aws/aws-sdk-go-v2/service/iam"
|
||||
"github.com/aws/aws-sdk-go-v2/service/kinesis"
|
||||
"github.com/aws/aws-sdk-go-v2/service/kms"
|
||||
@@ -24,6 +25,7 @@ import (
|
||||
"github.com/aws/aws-sdk-go-v2/service/rds"
|
||||
"github.com/aws/aws-sdk-go-v2/service/s3"
|
||||
"github.com/aws/aws-sdk-go-v2/service/secretsmanager"
|
||||
"github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi"
|
||||
"github.com/aws/aws-sdk-go-v2/service/sns"
|
||||
"github.com/aws/aws-sdk-go-v2/service/sqs"
|
||||
"github.com/aws/aws-sdk-go-v2/service/ssm"
|
||||
@@ -84,6 +86,11 @@ func LambdaClient() *lambda.Client {
|
||||
return lambda.NewFromConfig(Config())
|
||||
}
|
||||
|
||||
// GlueClient returns a new Glue client.
|
||||
func GlueClient() *glue.Client {
|
||||
return glue.NewFromConfig(Config())
|
||||
}
|
||||
|
||||
// IAMClient returns a new IAM client.
|
||||
func IAMClient() *iam.Client {
|
||||
return iam.NewFromConfig(Config())
|
||||
@@ -114,6 +121,11 @@ func CloudWatchClient() *cloudwatch.Client {
|
||||
return cloudwatch.NewFromConfig(Config())
|
||||
}
|
||||
|
||||
// ResourceGroupsTaggingAPIClient returns a new Resource Groups Tagging API client.
|
||||
func ResourceGroupsTaggingAPIClient() *resourcegroupstaggingapi.Client {
|
||||
return resourcegroupstaggingapi.NewFromConfig(Config())
|
||||
}
|
||||
|
||||
// ACMClient returns a new ACM client.
|
||||
func ACMClient() *acm.Client {
|
||||
return acm.NewFromConfig(Config())
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package tests
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"floci-sdk-test-go/internal/testutil"
|
||||
|
||||
"github.com/aws/aws-sdk-go-v2/aws"
|
||||
"github.com/aws/aws-sdk-go-v2/service/glue"
|
||||
gluetypes "github.com/aws/aws-sdk-go-v2/service/glue/types"
|
||||
"github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestGlueCreateDatabaseTagsAreVisibleViaResourceGroupsTaggingAPI(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
glueClient := testutil.GlueClient()
|
||||
taggingClient := testutil.ResourceGroupsTaggingAPIClient()
|
||||
databaseName := fmt.Sprintf("go-glue-db-%d", time.Now().UnixNano())
|
||||
databaseArn := fmt.Sprintf("arn:aws:glue:us-east-1:000000000000:database/%s", databaseName)
|
||||
|
||||
t.Cleanup(func() {
|
||||
_, _ = glueClient.DeleteDatabase(ctx, &glue.DeleteDatabaseInput{Name: aws.String(databaseName)})
|
||||
})
|
||||
|
||||
_, err := glueClient.CreateDatabase(ctx, &glue.CreateDatabaseInput{
|
||||
DatabaseInput: &gluetypes.DatabaseInput{
|
||||
Name: aws.String(databaseName),
|
||||
Description: aws.String("go glue database tags"),
|
||||
},
|
||||
Tags: map[string]string{
|
||||
"Environment": "dev",
|
||||
"Project": "project1",
|
||||
},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
response, err := taggingClient.GetResources(ctx, &resourcegroupstaggingapi.GetResourcesInput{
|
||||
ResourceARNList: []string{databaseArn},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Len(t, response.ResourceTagMappingList, 1)
|
||||
|
||||
mapping := response.ResourceTagMappingList[0]
|
||||
assert.Equal(t, databaseArn, aws.ToString(mapping.ResourceARN))
|
||||
|
||||
tags := map[string]string{}
|
||||
for _, tag := range mapping.Tags {
|
||||
tags[aws.ToString(tag.Key)] = aws.ToString(tag.Value)
|
||||
}
|
||||
assert.Equal(t, "dev", tags["Environment"])
|
||||
assert.Equal(t, "project1", tags["Project"])
|
||||
}
|
||||
@@ -122,6 +122,10 @@
|
||||
<groupId>software.amazon.awssdk</groupId>
|
||||
<artifactId>glue</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>software.amazon.awssdk</groupId>
|
||||
<artifactId>resourcegroupstaggingapi</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>software.amazon.glue</groupId>
|
||||
<artifactId>schema-registry-serde</artifactId>
|
||||
|
||||
@@ -37,6 +37,7 @@ import software.amazon.awssdk.services.kafka.KafkaClient;
|
||||
import software.amazon.awssdk.services.athena.AthenaClient;
|
||||
import software.amazon.awssdk.services.glue.GlueClient;
|
||||
import software.amazon.awssdk.services.firehose.FirehoseClient;
|
||||
import software.amazon.awssdk.services.resourcegroupstaggingapi.ResourceGroupsTaggingApiClient;
|
||||
import software.amazon.awssdk.services.apigateway.ApiGatewayClient;
|
||||
import software.amazon.awssdk.services.apigatewayv2.ApiGatewayV2Client;
|
||||
import software.amazon.awssdk.services.elasticache.ElastiCacheClient;
|
||||
@@ -374,6 +375,14 @@ public final class TestFixtures {
|
||||
.build();
|
||||
}
|
||||
|
||||
public static ResourceGroupsTaggingApiClient resourceGroupsTaggingApiClient() {
|
||||
return ResourceGroupsTaggingApiClient.builder()
|
||||
.endpointOverride(ENDPOINT)
|
||||
.region(REGION)
|
||||
.credentialsProvider(CREDENTIALS)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static FirehoseClient firehoseClient() {
|
||||
return FirehoseClient.builder()
|
||||
.endpointOverride(ENDPOINT)
|
||||
|
||||
@@ -34,8 +34,10 @@ import software.amazon.awssdk.services.glue.model.UpdateTableRequest;
|
||||
import software.amazon.awssdk.services.glue.model.UpdateUserDefinedFunctionRequest;
|
||||
import software.amazon.awssdk.services.glue.model.UserDefinedFunction;
|
||||
import software.amazon.awssdk.services.glue.model.UserDefinedFunctionInput;
|
||||
import software.amazon.awssdk.services.resourcegroupstaggingapi.ResourceGroupsTaggingApiClient;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
@@ -48,12 +50,15 @@ class GlueCatalogTest {
|
||||
private static final String TABLE_NAME = "catalog_table";
|
||||
private static final String SECOND_TABLE_NAME = "catalog_table_second";
|
||||
private static final String FUNCTION_NAME = "catalog_function";
|
||||
private static final String DATABASE_TAGGED_NAME = TestFixtures.uniqueName("catalog_tagged_db");
|
||||
|
||||
private static GlueClient glue;
|
||||
private static ResourceGroupsTaggingApiClient tagging;
|
||||
|
||||
@BeforeAll
|
||||
static void setup() {
|
||||
glue = TestFixtures.glueClient();
|
||||
tagging = TestFixtures.resourceGroupsTaggingApiClient();
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
@@ -82,6 +87,12 @@ class GlueCatalogTest {
|
||||
.build());
|
||||
}
|
||||
catch (Exception ignored) {}
|
||||
try {
|
||||
glue.deleteDatabase(DeleteDatabaseRequest.builder()
|
||||
.name(DATABASE_TAGGED_NAME)
|
||||
.build());
|
||||
}
|
||||
catch (Exception ignored) {}
|
||||
try {
|
||||
glue.deleteDatabase(DeleteDatabaseRequest.builder()
|
||||
.name(BATCH_DELETE_DATABASE_NAME)
|
||||
@@ -95,6 +106,7 @@ class GlueCatalogTest {
|
||||
}
|
||||
catch (Exception ignored) {}
|
||||
glue.close();
|
||||
tagging.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -264,6 +276,27 @@ class GlueCatalogTest {
|
||||
.build());
|
||||
}
|
||||
|
||||
@Test
|
||||
void createDatabaseWithTags_tagsReturnedByResourceGroupsTaggingApi() {
|
||||
glue.createDatabase(CreateDatabaseRequest.builder()
|
||||
.databaseInput(DatabaseInput.builder()
|
||||
.name(DATABASE_TAGGED_NAME)
|
||||
.description("catalog compatibility database with tags")
|
||||
.build())
|
||||
.tags(Map.of("Environment", "dev", "Project", "project1"))
|
||||
.build());
|
||||
|
||||
String databaseArn = "arn:aws:glue:us-east-1:000000000000:database/" + DATABASE_TAGGED_NAME;
|
||||
var response = tagging.getResources(b -> b.resourceARNList(databaseArn));
|
||||
|
||||
assertThat(response.resourceTagMappingList()).singleElement().satisfies(mapping -> {
|
||||
assertThat(mapping.resourceARN()).isEqualTo(databaseArn);
|
||||
assertThat(mapping.tags().stream().collect(Collectors.toMap(t -> t.key(), t -> t.value())))
|
||||
.containsEntry("Environment", "dev")
|
||||
.containsEntry("Project", "project1");
|
||||
});
|
||||
}
|
||||
|
||||
private static TableInput tableInput(String description) {
|
||||
return tableInput(TABLE_NAME, description);
|
||||
}
|
||||
|
||||
@@ -115,6 +115,18 @@ def cloudwatch_client(aws_config, client_config):
|
||||
return boto3.client("cloudwatch", config=client_config, **aws_config)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def glue_client(aws_config, client_config):
|
||||
"""Create Glue client."""
|
||||
return boto3.client("glue", config=client_config, **aws_config)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def resourcegroupstaggingapi_client(aws_config, client_config):
|
||||
"""Create Resource Groups Tagging API client."""
|
||||
return boto3.client("resourcegroupstaggingapi", config=client_config, **aws_config)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def logs_client(aws_config, client_config):
|
||||
"""Create CloudWatch Logs client."""
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
"""Glue integration tests."""
|
||||
|
||||
|
||||
def test_create_database_with_tags_visible_via_resource_groups_tagging_api(
|
||||
glue_client, resourcegroupstaggingapi_client, unique_name
|
||||
):
|
||||
"""Test Glue CreateDatabase tags are discoverable via GetResources."""
|
||||
database_name = f"glue-db-{unique_name}"
|
||||
database_arn = (
|
||||
f"arn:aws:glue:{glue_client.meta.region_name}:000000000000:database/{database_name}"
|
||||
)
|
||||
|
||||
try:
|
||||
glue_client.create_database(
|
||||
DatabaseInput={
|
||||
"Name": database_name,
|
||||
"Description": "python glue database tags",
|
||||
},
|
||||
Tags={"Environment": "dev", "Project": "project1"},
|
||||
)
|
||||
|
||||
response = resourcegroupstaggingapi_client.get_resources(
|
||||
ResourceARNList=[database_arn]
|
||||
)
|
||||
|
||||
mappings = response["ResourceTagMappingList"]
|
||||
assert len(mappings) == 1
|
||||
assert mappings[0]["ResourceARN"] == database_arn
|
||||
tags = {tag["Key"]: tag["Value"] for tag in mappings[0]["Tags"]}
|
||||
assert tags["Environment"] == "dev"
|
||||
assert tags["Project"] == "project1"
|
||||
finally:
|
||||
glue_client.delete_database(Name=database_name)
|
||||
@@ -47,7 +47,11 @@ public class GlueJsonHandler {
|
||||
return switch (action) {
|
||||
case "CreateDatabase" -> {
|
||||
Database db = mapper.treeToValue(request.get("DatabaseInput"), Database.class);
|
||||
glueService.createDatabase(db);
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, String> tags = request.has("Tags")
|
||||
? mapper.convertValue(request.get("Tags"), Map.class)
|
||||
: null;
|
||||
glueService.createDatabase(db, tags, region);
|
||||
yield Response.ok().build();
|
||||
}
|
||||
case "GetDatabase" -> {
|
||||
@@ -60,7 +64,7 @@ public class GlueJsonHandler {
|
||||
}
|
||||
case "DeleteDatabase" -> {
|
||||
String name = request.get("Name").asText();
|
||||
glueService.deleteDatabase(name);
|
||||
glueService.deleteDatabase(name, region);
|
||||
yield Response.ok().build();
|
||||
}
|
||||
case "UpdateDatabase" -> {
|
||||
|
||||
@@ -17,6 +17,7 @@ import io.github.hectorvent.floci.services.glue.schemaregistry.GlueSchemaRegistr
|
||||
import io.github.hectorvent.floci.services.glue.schemaregistry.SchemaToColumnsConverter;
|
||||
import io.github.hectorvent.floci.services.glue.schemaregistry.model.SchemaId;
|
||||
import io.github.hectorvent.floci.services.glue.schemaregistry.model.SchemaVersion;
|
||||
import io.github.hectorvent.floci.services.resourcegroupstagging.ResourceGroupsTaggingService;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import org.jboss.logging.Logger;
|
||||
@@ -46,11 +47,13 @@ public class GlueService {
|
||||
private final StorageBackend<String, UserDefinedFunction> functionStore;
|
||||
private final GlueSchemaRegistryService schemaRegistryService;
|
||||
private final RegionResolver regionResolver;
|
||||
private final ResourceGroupsTaggingService resourceGroupsTaggingService;
|
||||
|
||||
@Inject
|
||||
public GlueService(StorageFactory storageFactory,
|
||||
GlueSchemaRegistryService schemaRegistryService,
|
||||
RegionResolver regionResolver) {
|
||||
RegionResolver regionResolver,
|
||||
ResourceGroupsTaggingService resourceGroupsTaggingService) {
|
||||
this.databaseStore = storageFactory.create("glue", "databases.json", new TypeReference<>() {});
|
||||
this.tableStore = storageFactory.create("glue", "tables.json", new TypeReference<>() {});
|
||||
this.tableVersionStore = storageFactory.create("glue", "table_versions.json", new TypeReference<>() {});
|
||||
@@ -58,6 +61,7 @@ public class GlueService {
|
||||
this.functionStore = storageFactory.create("glue", "functions.json", new TypeReference<>() {});
|
||||
this.schemaRegistryService = schemaRegistryService;
|
||||
this.regionResolver = regionResolver;
|
||||
this.resourceGroupsTaggingService = resourceGroupsTaggingService;
|
||||
}
|
||||
|
||||
GlueService(StorageBackend<String, Database> databaseStore,
|
||||
@@ -66,7 +70,8 @@ public class GlueService {
|
||||
StorageBackend<String, Partition> partitionStore,
|
||||
StorageBackend<String, UserDefinedFunction> functionStore,
|
||||
GlueSchemaRegistryService schemaRegistryService,
|
||||
RegionResolver regionResolver) {
|
||||
RegionResolver regionResolver,
|
||||
ResourceGroupsTaggingService resourceGroupsTaggingService) {
|
||||
this.databaseStore = databaseStore;
|
||||
this.tableStore = tableStore;
|
||||
this.tableVersionStore = tableVersionStore;
|
||||
@@ -74,15 +79,23 @@ public class GlueService {
|
||||
this.functionStore = functionStore;
|
||||
this.schemaRegistryService = schemaRegistryService;
|
||||
this.regionResolver = regionResolver;
|
||||
this.resourceGroupsTaggingService = resourceGroupsTaggingService;
|
||||
}
|
||||
|
||||
public void createDatabase(Database database) {
|
||||
createDatabase(database, null, regionResolver.getDefaultRegion());
|
||||
}
|
||||
|
||||
public void createDatabase(Database database, Map<String, String> tags, String region) {
|
||||
String databaseName = normalizeName(database.getName());
|
||||
if (databaseStore.get(databaseName).isPresent()) {
|
||||
throw new AwsException("AlreadyExistsException", "Database already exists: " + database.getName(), 400);
|
||||
}
|
||||
database.setName(databaseName);
|
||||
databaseStore.put(databaseName, database);
|
||||
if (tags != null && !tags.isEmpty()) {
|
||||
resourceGroupsTaggingService.tagResources(List.of(databaseArn(region, databaseName)), tags, region);
|
||||
}
|
||||
LOG.infov("Created Glue Database: {0}", database.getName());
|
||||
}
|
||||
|
||||
@@ -112,6 +125,10 @@ public class GlueService {
|
||||
}
|
||||
|
||||
public void deleteDatabase(String name) {
|
||||
deleteDatabase(name, regionResolver.getDefaultRegion());
|
||||
}
|
||||
|
||||
public void deleteDatabase(String name, String region) {
|
||||
String databaseName = getDatabase(name).getName();
|
||||
List<String> tableNames = tableStore.scan(k -> true).stream()
|
||||
.filter(table -> databaseName.equals(table.getDatabaseName()))
|
||||
@@ -119,6 +136,7 @@ public class GlueService {
|
||||
.toList();
|
||||
tableNames.forEach(tableName -> deleteTable(name, tableName));
|
||||
databaseStore.delete(databaseName);
|
||||
resourceGroupsTaggingService.deleteResources(List.of(databaseArn(region, databaseName)), region);
|
||||
LOG.infov("Deleted Glue Database: {0}", name);
|
||||
}
|
||||
|
||||
@@ -362,6 +380,10 @@ public class GlueService {
|
||||
return name.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
private String databaseArn(String region, String databaseName) {
|
||||
return regionResolver.buildArn("glue", region, "database/" + databaseName);
|
||||
}
|
||||
|
||||
private static Pattern compileFunctionPattern(String pattern) {
|
||||
if (pattern == null) {
|
||||
return Pattern.compile(".*");
|
||||
|
||||
+6
@@ -38,6 +38,12 @@ public class ResourceGroupsTaggingService {
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteResources(List<String> resourceArns, String region) {
|
||||
for (String arn : resourceArns) {
|
||||
store.remove(key(region, arn));
|
||||
}
|
||||
}
|
||||
|
||||
// ─── GetResources ──────────────────────────────────────────────────────────
|
||||
|
||||
public record TagFilter(String key, List<String> values) {}
|
||||
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
package io.github.hectorvent.floci.services.glue;
|
||||
|
||||
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.hasItems;
|
||||
|
||||
@QuarkusTest
|
||||
class GlueDatabaseTaggingIntegrationTest {
|
||||
|
||||
private static final String CONTENT_TYPE = "application/x-amz-json-1.1";
|
||||
private static final String DATABASE_NAME = "tagged-db-" + UUID.randomUUID().toString().substring(0, 8);
|
||||
private static final String DATABASE_ARN = "arn:aws:glue:us-east-1:000000000000:database/" + DATABASE_NAME;
|
||||
|
||||
@BeforeAll
|
||||
static void configureRestAssured() {
|
||||
RestAssuredJsonUtils.configureAwsContentTypes();
|
||||
}
|
||||
|
||||
@Test
|
||||
void createDatabaseWithTags_tagsReturnedByResourceGroupsTaggingApi() {
|
||||
given().contentType(CONTENT_TYPE)
|
||||
.header("X-Amz-Target", "AWSGlue.CreateDatabase")
|
||||
.body("""
|
||||
{
|
||||
"DatabaseInput": {
|
||||
"Name": "%s",
|
||||
"Description": "catalog db with tags"
|
||||
},
|
||||
"Tags": {
|
||||
"Environment": "dev",
|
||||
"Project": "project1"
|
||||
}
|
||||
}
|
||||
""".formatted(DATABASE_NAME))
|
||||
.when().post("/")
|
||||
.then().statusCode(200);
|
||||
|
||||
given().contentType(CONTENT_TYPE)
|
||||
.header("X-Amz-Target", "ResourceGroupsTaggingAPI_20170126.GetResources")
|
||||
.body("""
|
||||
{
|
||||
"ResourceARNList": ["%s"]
|
||||
}
|
||||
""".formatted(DATABASE_ARN))
|
||||
.when().post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("ResourceTagMappingList.size()", equalTo(1))
|
||||
.body("ResourceTagMappingList[0].ResourceARN", equalTo(DATABASE_ARN))
|
||||
.body("ResourceTagMappingList[0].Tags.size()", equalTo(2))
|
||||
.body("ResourceTagMappingList[0].Tags.Key", hasItems("Environment", "Project"))
|
||||
.body("ResourceTagMappingList[0].Tags.Value", hasItems("dev", "project1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void deleteDatabase_removesTagsFromResourceGroupsTaggingApi() {
|
||||
String databaseName = "tagged-db-delete-" + UUID.randomUUID().toString().substring(0, 8);
|
||||
String databaseArn = "arn:aws:glue:us-east-1:000000000000:database/" + databaseName;
|
||||
|
||||
given().contentType(CONTENT_TYPE)
|
||||
.header("X-Amz-Target", "AWSGlue.CreateDatabase")
|
||||
.body("""
|
||||
{
|
||||
"DatabaseInput": {
|
||||
"Name": "%s"
|
||||
},
|
||||
"Tags": {
|
||||
"Environment": "dev"
|
||||
}
|
||||
}
|
||||
""".formatted(databaseName))
|
||||
.when().post("/")
|
||||
.then().statusCode(200);
|
||||
|
||||
given().contentType(CONTENT_TYPE)
|
||||
.header("X-Amz-Target", "AWSGlue.DeleteDatabase")
|
||||
.body("""
|
||||
{
|
||||
"Name": "%s"
|
||||
}
|
||||
""".formatted(databaseName))
|
||||
.when().post("/")
|
||||
.then().statusCode(200);
|
||||
|
||||
given().contentType(CONTENT_TYPE)
|
||||
.header("X-Amz-Target", "ResourceGroupsTaggingAPI_20170126.GetResources")
|
||||
.body("""
|
||||
{
|
||||
"ResourceARNList": ["%s"]
|
||||
}
|
||||
""".formatted(databaseArn))
|
||||
.when().post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("ResourceTagMappingList.size()", equalTo(0));
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import io.github.hectorvent.floci.services.glue.model.UserDefinedFunction;
|
||||
import io.github.hectorvent.floci.services.glue.schemaregistry.GlueSchemaRegistryService;
|
||||
import io.github.hectorvent.floci.services.glue.schemaregistry.model.RegistryId;
|
||||
import io.github.hectorvent.floci.services.glue.schemaregistry.model.SchemaId;
|
||||
import io.github.hectorvent.floci.services.resourcegroupstagging.ResourceGroupsTaggingService;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -63,7 +64,7 @@ class GlueServiceTest {
|
||||
tableVersionStore,
|
||||
partitionStore,
|
||||
new InMemoryStorage<String, UserDefinedFunction>(),
|
||||
schemaRegistryService, regionResolver);
|
||||
schemaRegistryService, regionResolver, new ResourceGroupsTaggingService());
|
||||
glueService.createDatabase(new Database("db1"));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ class ResourceGroupsTaggingIntegrationTest {
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("ResourceTagMappingList.size()", equalTo(3))
|
||||
.body("ResourceTagMappingList.size()", greaterThanOrEqualTo(3))
|
||||
.body("ResourceTagMappingList.ResourceARN", hasItems(ARN_INSTANCE, ARN_BUCKET, ARN_FUNCTION));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user