diff --git a/polaris-core/src/test/java/io/polaris/core/storage/cache/StorageCredentialCacheTest.java b/polaris-core/src/test/java/io/polaris/core/storage/cache/StorageCredentialCacheTest.java index 0e39857ef..88f818c57 100644 --- a/polaris-core/src/test/java/io/polaris/core/storage/cache/StorageCredentialCacheTest.java +++ b/polaris-core/src/test/java/io/polaris/core/storage/cache/StorageCredentialCacheTest.java @@ -37,6 +37,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; +import org.apache.iceberg.exceptions.UnprocessableEntityException; import org.assertj.core.api.Assertions; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.RepeatedTest; @@ -94,7 +95,8 @@ public void testBadResult() { true, new HashSet<>(Arrays.asList("s3://bucket1/path")), new HashSet<>(Arrays.asList("s3://bucket3/path")))) - .isInstanceOf(RuntimeException.class); + .isInstanceOf(UnprocessableEntityException.class) + .hasMessage("Failed to get subscoped credentials: extra_error_info"); } @Test diff --git a/polaris-service/src/test/java/io/polaris/service/PolarisApplicationIntegrationTest.java b/polaris-service/src/test/java/io/polaris/service/PolarisApplicationIntegrationTest.java index c41f318d6..1cd2edd7e 100644 --- a/polaris-service/src/test/java/io/polaris/service/PolarisApplicationIntegrationTest.java +++ b/polaris-service/src/test/java/io/polaris/service/PolarisApplicationIntegrationTest.java @@ -308,7 +308,9 @@ public void testIcebergListNamespaces() throws IOException { @Test public void testConfigureCatalogCaseSensitive() throws IOException { assertThatThrownBy(() -> newSessionCatalog("TESTCONFIGURECATALOGCASESENSITIVE")) - .isInstanceOf(RESTException.class); + .isInstanceOf(RESTException.class) + .hasMessage( + "Unable to process: Unable to find warehouse TESTCONFIGURECATALOGCASESENSITIVE"); } @Test @@ -318,7 +320,8 @@ public void testIcebergListNamespacesNotFound() throws IOException { SessionCatalog.SessionContext sessionContext = SessionCatalog.SessionContext.createEmpty(); assertThatThrownBy( () -> sessionCatalog.listNamespaces(sessionContext, Namespace.of("whoops"))) - .isInstanceOf(NoSuchNamespaceException.class); + .isInstanceOf(NoSuchNamespaceException.class) + .hasMessage("Namespace does not exist: whoops"); } } @@ -334,7 +337,8 @@ public void testIcebergListNamespacesNestedNotFound() throws IOException { () -> sessionCatalog.listNamespaces( sessionContext, Namespace.of("top_level", "whoops"))) - .isInstanceOf(NoSuchNamespaceException.class); + .isInstanceOf(NoSuchNamespaceException.class) + .hasMessage("Namespace does not exist: top_level.whoops"); } } @@ -344,7 +348,8 @@ public void testIcebergListTablesNamespaceNotFound() throws IOException { newSessionCatalog("testIcebergListTablesNamespaceNotFound")) { SessionCatalog.SessionContext sessionContext = SessionCatalog.SessionContext.createEmpty(); assertThatThrownBy(() -> sessionCatalog.listTables(sessionContext, Namespace.of("whoops"))) - .isInstanceOf(NoSuchNamespaceException.class); + .isInstanceOf(NoSuchNamespaceException.class) + .hasMessage("Namespace does not exist: whoops"); } } @@ -394,7 +399,8 @@ public void testIcebergDropNamespaceInExternalCatalog(TestInfo testInfo) throws assertThat(namespaces).isNotNull().hasSize(1).containsExactly(ns); sessionCatalog.dropNamespace(sessionContext, ns); assertThatThrownBy(() -> sessionCatalog.loadNamespaceMetadata(sessionContext, ns)) - .isInstanceOf(NoSuchNamespaceException.class); + .isInstanceOf(NoSuchNamespaceException.class) + .hasMessage("Namespace does not exist: db1"); } } @@ -420,7 +426,8 @@ public void testIcebergCreateTablesInExternalCatalog(TestInfo testInfo) throws I .withSortOrder(SortOrder.unsorted()) .withPartitionSpec(PartitionSpec.unpartitioned()) .create()) - .isInstanceOf(BadRequestException.class); + .isInstanceOf(BadRequestException.class) + .hasMessage("Malformed request: Cannot create table on external catalogs."); } } @@ -570,7 +577,8 @@ public void testIcebergUpdateTableInExternalCatalog(TestInfo testInfo) throws IO new PartitionData(PartitionSpec.unpartitioned().partitionType()), 10L)) .commit()) - .isInstanceOf(BadRequestException.class); + .isInstanceOf(BadRequestException.class) + .hasMessage("Malformed request: Cannot update table on external catalogs."); } } @@ -614,7 +622,8 @@ public void testIcebergDropTableInExternalCatalog(TestInfo testInfo) throws IOEx assertThat(table).isNotNull(); sessionCatalog.dropTable(sessionContext, tableIdentifier); assertThatThrownBy(() -> sessionCatalog.loadTable(sessionContext, tableIdentifier)) - .isInstanceOf(NoSuchTableException.class); + .isInstanceOf(NoSuchTableException.class) + .hasMessage("Table does not exist: db1.the_table"); } } @@ -638,7 +647,8 @@ public void testWarehouseNotSpecified() throws IOException { emptyEnvironmentVariable, "header." + REALM_PROPERTY_KEY, realm))) - .isInstanceOf(BadRequestException.class); + .isInstanceOf(BadRequestException.class) + .hasMessage("Malformed request: Please specify a warehouse"); } } }