dimas-b commented on code in PR #4136:
URL: https://github.com/apache/polaris/pull/4136#discussion_r3300841115
##########
runtime/service/src/test/java/org/apache/polaris/service/catalog/iceberg/AbstractIcebergCatalogHandlerAuthzTest.java:
##########
@@ -624,38 +649,44 @@ void testLoadCredentialsFromEntityPropertiesSkipsFileIO()
throws Exception {
CATALOG_NAME, CATALOG_ROLE1, PolarisPrivilege.TABLE_WRITE_DATA));
// Wrap the real factory to spy on the catalog it creates
+ AtomicReference<IcebergCatalog> spiedCatalog = new AtomicReference<>();
LocalCatalogFactory spyFactory =
- manifest -> Mockito.spy(localCatalogFactory.createCatalog(manifest));
+ manifest -> {
+ IcebergCatalog spy =
Mockito.spy(localCatalogFactory.createCatalog(manifest));
+ spiedCatalog.set(spy);
+ return spy;
+ };
IcebergCatalogHandler handler = newHandler(Set.of(), CATALOG_NAME,
spyFactory);
// Call the optimized credential vending path — authorizeLoadTable inside
// will trigger initializeCatalog() which sets baseCatalog via our spy
factory
handler.loadCredentials(TABLE_NS1A_2, Optional.empty());
- // Retrieve the spied baseCatalog and verify loadTable was never called
- Field baseCatalogField =
IcebergCatalogHandler.class.getDeclaredField("baseCatalog");
- baseCatalogField.setAccessible(true);
- Catalog spiedCatalog = (Catalog) baseCatalogField.get(handler);
- Mockito.verify(spiedCatalog, Mockito.never()).loadTable(Mockito.any());
+ Assertions.assertThat(spiedCatalog).doesNotHaveNullValue();
+ Mockito.verify(spiedCatalog.get(), Mockito.never()).loadTable(any());
}
@Test
void testLoadCredentialsFromEntityPropertiesFallsBackForExternalCatalog() {
Review Comment:
Cf. #4540
--
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]