Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ protected String defaultWarehouseLocation(TableIdentifier tableIdentifier) {
GetDatabaseResponse response =
glue.getDatabase(
GetDatabaseRequest.builder()
.catalogId(awsProperties.glueCatalogId())
.name(
IcebergToGlueConverter.getDatabaseName(
tableIdentifier, awsProperties.glueCatalogSkipNameValidation()))
Expand Down
27 changes: 27 additions & 0 deletions aws/src/test/java/org/apache/iceberg/aws/glue/TestGlueCatalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,33 @@ public void testDefaultWarehouseLocationDbUri() {
Assert.assertEquals("s3://bucket2/db/table", location);
}

@Test
public void testDefaultWarehouseLocationCustomCatalogId() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The integration tests in TestGlueCatalogNamespace also don't set the catalogId, do we need to set it in those files also?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there multiple AWS accounts available for integration tests?
I could not find that setup either in AwsIntegTestUtil or TestAssumeRoleAwsClientFactory (as and obvious potential cross account example).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume it is a single account.
The Integration testcase can be executed by exporting the mentioned environment variables (#4855)

Thanks for the clarification. may be no need of catalog id for these tests.

GlueCatalog catalogWithCustomCatalogId = new GlueCatalog();
String catalogId = "myCatalogId";
AwsProperties awsProperties = new AwsProperties();
awsProperties.setGlueCatalogId(catalogId);
catalogWithCustomCatalogId.initialize(
CATALOG_NAME,
WAREHOUSE_PATH + "/",
awsProperties,
glue,
LockManagers.defaultLockManager(),
null,
ImmutableMap.of());

Mockito.doReturn(
GetDatabaseResponse.builder()
.database(Database.builder().name("db").locationUri("s3://bucket2/db").build())
.build())
.when(glue)
.getDatabase(Mockito.any(GetDatabaseRequest.class));
catalogWithCustomCatalogId.defaultWarehouseLocation(TableIdentifier.of("db", "table"));
Mockito.verify(glue)
.getDatabase(
Mockito.argThat((GetDatabaseRequest req) -> req.catalogId().equals(catalogId)));
}

@Test
public void testListTables() {
Mockito.doReturn(
Expand Down