RussellSpitzer commented on code in PR #395:
URL: https://github.com/apache/polaris/pull/395#discussion_r1813501253
##########
polaris-service/src/test/java/org/apache/polaris/service/catalog/PolarisRestCatalogIntegrationTest.java:
##########
@@ -747,6 +789,107 @@ public void
testCreateTableWithOverriddenBaseLocationMustResideInNsDirectory(
.isInstanceOf(ForbiddenException.class);
}
+ /**
+ * Create an EXTERNAL catalog. The test configuration, by default, disables
access delegation for
+ * EXTERNAL catalogs, so register a table and try to load it with the REST
client configured to
+ * try to fetch vended credentials. Expect a ForbiddenException.
+ */
+ @CatalogConfig(Catalog.TypeEnum.EXTERNAL)
+ @RestCatalogConfig({"header.X-Iceberg-Access-Delegation",
"vended-credentials"})
+ @Test
+ public void
testLoadTableWithAccessDelegationForExternalCatalogWithConfigDisabled() {
+ Namespace ns1 = Namespace.of("ns1");
+ restCatalog.createNamespace(ns1);
+ TableMetadata tableMetadata =
+ TableMetadata.newTableMetadata(
+ new Schema(List.of(Types.NestedField.of(1, false, "col1", new
Types.StringType()))),
+ PartitionSpec.unpartitioned(),
+ "file:///tmp/ns1/my_table",
+ Map.of());
+ try (ResolvingFileIO resolvingFileIO = new ResolvingFileIO()) {
+ resolvingFileIO.initialize(Map.of());
+ resolvingFileIO.setConf(new Configuration());
+ String fileLocation =
"file:///tmp/ns1/my_table/metadata/v1.metadata.json";
+ TableMetadataParser.write(tableMetadata,
resolvingFileIO.newOutputFile(fileLocation));
+ restCatalog.registerTable(TableIdentifier.of(ns1, "my_table"),
fileLocation);
+ try {
+ try {
Review Comment:
Should be some flavor of assertThrows
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]