Class PolarisRestCatalogIntegrationBase

java.lang.Object
org.apache.iceberg.catalog.CatalogTests<org.apache.iceberg.rest.RESTCatalog>
org.apache.polaris.service.it.test.PolarisRestCatalogIntegrationBase
Direct Known Subclasses:
PolarisRestCatalogAdlsIntegrationTestBase, PolarisRestCatalogFileIntegrationTest, PolarisRestCatalogGcsIntegrationTestBase, PolarisRestCatalogS3IntegrationTestBase

@ExtendWith(PolarisIntegrationTestExtension.class) public abstract class PolarisRestCatalogIntegrationBase extends org.apache.iceberg.catalog.CatalogTests<org.apache.iceberg.rest.RESTCatalog>
Import the full core Iceberg catalog tests by hitting the REST service via the RESTCatalog client.
  • Field Details

  • Constructor Details

    • PolarisRestCatalogIntegrationBase

      public PolarisRestCatalogIntegrationBase()
  • Method Details

    • getStorageConfigInfo

      protected abstract org.apache.polaris.core.admin.model.StorageConfigInfo getStorageConfigInfo()
      Get the storage configuration information for the catalog.
      Returns:
      StorageConfigInfo instance containing the storage configuration
    • initializeClientFileIO

      protected <T extends org.apache.iceberg.io.FileIO> T initializeClientFileIO(T fileIO)
      A hook for test subclasses to initialize FileIO objects used by test cases themselves for accessing test storage.

      Important: this FileIO instance is not tied to a REST Catalog; it is created by test code performing adhoc, direct access to the storage; thus, it may not be configured with the same properties as the ones used by catalog()!

    • clientFileIOProperties

      protected com.google.common.collect.ImmutableMap.Builder<String,String> clientFileIOProperties()
      Get the properties to be used for initializing the FileIO instance used by test code for accessing test storage.
    • baseTableLocation

      protected String baseTableLocation(org.apache.iceberg.catalog.TableIdentifier identifier)
      The expected location for a table. Some tests rely on this location, but the default implementation uses file:// locations.
      Overrides:
      baseTableLocation in class org.apache.iceberg.catalog.CatalogTests<org.apache.iceberg.rest.RESTCatalog>
    • externalCatalogBaseLocation

      protected URI externalCatalogBaseLocation()
      Get the base URI for the external catalog.
    • before

      @BeforeEach public void before(org.junit.jupiter.api.TestInfo testInfo)
    • createTestPrincipal

      protected ClientPrincipal createTestPrincipal(PolarisClient client, String principalName, String principalRoleName)
      Creates a test principal with the specified name and role. Subclasses can override this method to customize the principal creation process, e.g. when using federated principals.
    • obtainToken

      protected String obtainToken(PolarisClient client, ClientPrincipal principal)
      Obtain an access token for the given principal credentials.

      By default, this method uses the PolarisClient to obtain the token from the Polaris internal OAuth2 token endpoint.

      Subclasses can override this method to customize the token acquisition process, e.g. when using external identity providers.

    • cleanUp

      @AfterEach public void cleanUp() throws IOException
      Throws:
      IOException
    • cleanUp

      protected void cleanUp(PolarisClient client, String adminToken)
      Cleans up the Polaris environment after each test.

      Subclasses can override this method to perform additional cleanup actions.

    • catalog

      protected org.apache.iceberg.rest.RESTCatalog catalog()
      Specified by:
      catalog in class org.apache.iceberg.catalog.CatalogTests<org.apache.iceberg.rest.RESTCatalog>
    • createPolarisCatalog

      protected void createPolarisCatalog(org.apache.polaris.core.admin.model.Catalog catalog)
      Overridable methods to allow subclasses to execute additional logic on catalog creation.
    • initCatalog

      protected org.apache.iceberg.rest.RESTCatalog initCatalog(String catalogName, Map<String,String> additionalProperties)
      Initialize a RESTCatalog for testing.
      Specified by:
      initCatalog in class org.apache.iceberg.catalog.CatalogTests<org.apache.iceberg.rest.RESTCatalog>
      Parameters:
      catalogName - this parameter is currently unused. All RESTCatalog instances created by tests have the name "polaris".
      additionalProperties - additional properties to apply on top of the configured defaults. Some tests in the parent class use this to inject test-specific properties e.g. CatalogTests.testCatalogWithCustomMetricsReporter().
      Returns:
      a configured instance of RESTCatalog
    • extraCatalogProperties

      protected Map<String,String> extraCatalogProperties(org.junit.jupiter.api.TestInfo testInfo)
      Additional properties to apply when creating the RESTCatalog, on top of the default test settings and any properties specified via RestCatalogConfig annotations.

      This is useful when subclasses need to override some of the default settings with a value that cannot be expressed via annotations (e.g. because it needs to refer to some other test-local state).

    • restCatalogFileIOImplementation

      protected Class<? extends org.apache.iceberg.io.FileIO> restCatalogFileIOImplementation()
      The FileIO implementation class name to be used for the RESTCatalog instance.
    • requiresNamespaceCreate

      protected boolean requiresNamespaceCreate()
      Overrides:
      requiresNamespaceCreate in class org.apache.iceberg.catalog.CatalogTests<org.apache.iceberg.rest.RESTCatalog>
    • supportsNestedNamespaces

      protected boolean supportsNestedNamespaces()
      Overrides:
      supportsNestedNamespaces in class org.apache.iceberg.catalog.CatalogTests<org.apache.iceberg.rest.RESTCatalog>
    • supportsServerSideRetry

      protected boolean supportsServerSideRetry()
      Overrides:
      supportsServerSideRetry in class org.apache.iceberg.catalog.CatalogTests<org.apache.iceberg.rest.RESTCatalog>
    • supportsNamesWithSlashes

      protected boolean supportsNamesWithSlashes()
      Overrides:
      supportsNamesWithSlashes in class org.apache.iceberg.catalog.CatalogTests<org.apache.iceberg.rest.RESTCatalog>
    • overridesRequestedLocation

      protected boolean overridesRequestedLocation()
      Overrides:
      overridesRequestedLocation in class org.apache.iceberg.catalog.CatalogTests<org.apache.iceberg.rest.RESTCatalog>
    • testListGrantsOnCatalogObjectsToCatalogRoles

      @Test public void testListGrantsOnCatalogObjectsToCatalogRoles()
    • testListGrantsAfterRename

      @Test public void testListGrantsAfterRename()
    • testRenameTableReturns204

      @Test public void testRenameTableReturns204()
    • testCreateTableWithOverriddenBaseLocation

      @Test public void testCreateTableWithOverriddenBaseLocation()
    • testCreateTableWithOverriddenBaseLocationCannotOverlapSibling

      @Test public void testCreateTableWithOverriddenBaseLocationCannotOverlapSibling()
    • testCreateTableWithOverriddenBaseLocationMustResideInNsDirectory

      @Test public void testCreateTableWithOverriddenBaseLocationMustResideInNsDirectory()
    • testLoadTableWithAccessDelegationForExternalCatalogWithConfigDisabled

      @Test public void testLoadTableWithAccessDelegationForExternalCatalogWithConfigDisabled()
      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 an IllegalArgumentException (HTTP 400 Bad Request).
    • testLoadTableWithoutAccessDelegationForExternalCatalogWithConfigDisabled

      @Test public void testLoadTableWithoutAccessDelegationForExternalCatalogWithConfigDisabled()
      Create an EXTERNAL catalog. The test configuration, by default, disables access delegation for EXTERNAL catalogs. Register a table and attempt to load it WITHOUT access delegation. This should succeed.
    • testLoadTableWithAccessDelegationForExternalCatalogWithConfigEnabledForCatalog

      @Test public void testLoadTableWithAccessDelegationForExternalCatalogWithConfigEnabledForCatalog()
      Create an EXTERNAL catalog. The test configuration, by default, disables access delegation for EXTERNAL catalogs. However, we set enable.credential.vending to true for this catalog, enabling it. Register a table and attempt to load it WITH access delegation. This should succeed.
    • testLoadCredentialsEndpoint

      @Test public void testLoadCredentialsEndpoint()
    • testLoadTableTwiceWithETag

      @Test public void testLoadTableTwiceWithETag()
      Register a table. Then, invoke an initial loadTable request to fetch and ensure ETag is present. Then, invoke a second loadTable to ensure that ETag is matched.
    • testRegisterAndLoadTableWithReturnedETag

      @Test public void testRegisterAndLoadTableWithReturnedETag()
      Invoke an initial registerTable request to fetch and ensure ETag is present. Then, invoke a second loadTable to ensure that ETag is matched.
    • testRegisterTableOverwrite

      @Test public void testRegisterTableOverwrite()
      Build an Iceberg table, then invoke a subsequent register table call that overwrites the existing table metadata. Verifies that the overwrite is applied and the catalog reflects the updated metadata.
    • testRegisterTableOverwriteRejectedForExternalCatalog

      @Test public void testRegisterTableOverwriteRejectedForExternalCatalog()
      Attempt to invoke registerTable with overwrite=true against an EXTERNAL (federated) catalog. Polaris only supports the overwrite path for its internal IcebergCatalog; EXTERNAL catalogs must receive a 400 Bad Request.
    • testRegisterTableWithAccessDelegation

      @Test public void testRegisterTableWithAccessDelegation()
      Create an INTERNAL catalog. Register a table WITH access delegation and verify that the registerTable response contains vended credentials (when supported by the storage type).
    • testRegisterTableWithAccessDelegationForExternalCatalog

      @Test public void testRegisterTableWithAccessDelegationForExternalCatalog()
      Create an EXTERNAL catalog with credential vending enabled. Register a table WITH access delegation and verify that the registerTable response contains vended credentials (when supported by the storage type).
    • testRegisterTableWithAccessDelegationForExternalCatalogWithConfigDisabled

      @Test public void testRegisterTableWithAccessDelegationForExternalCatalogWithConfigDisabled()
      Create an EXTERNAL catalog. The test configuration, by default, disables access delegation for EXTERNAL catalogs, so try to register a table with the REST client configured to try to fetch vended credentials. Expect an IllegalArgumentException (HTTP 400 Bad Request).
    • testRegisterTableOverwriteWithAccessDelegation

      @Test public void testRegisterTableOverwriteWithAccessDelegation()
      Create an INTERNAL catalog. Register a table WITH access delegation + overwrite and verify that the registerTable response contains vended credentials (when supported by the storage type).
    • testRegisterTableOverwriteWithAccessDelegationForExternalCatalogForbidden

      @Test public void testRegisterTableOverwriteWithAccessDelegationForExternalCatalogForbidden()
      Create an EXTERNAL catalog. Try to register with overwrite a table and request fetch vended credentials. Expect an IllegalArgumentException (HTTP 400 Bad Request) because overwrite is not enabled for external catalogs.
    • testCreateAndLoadTableWithReturnedEtag

      @Test public void testCreateAndLoadTableWithReturnedEtag()
    • testSendMetricsReport

      @Test public void testSendMetricsReport()
    • testSendNotificationInternalCatalog

      @Test public void testSendNotificationInternalCatalog()
    • diffAgainstSingleTable

      @Test public void diffAgainstSingleTable()
    • multipleDiffsAgainstMultipleTables

      @Test public void multipleDiffsAgainstMultipleTables()
    • multipleDiffsAgainstMultipleTablesLastFails

      @Test public void multipleDiffsAgainstMultipleTablesLastFails()
    • testCommitTransactionDoesNotDeleteOldMetadataFilesOnFailure

      @Test public void testCommitTransactionDoesNotDeleteOldMetadataFilesOnFailure()
      With write.metadata.delete-after-commit.enabled=true, old metadata files evicted from the metadata log must NOT be deleted while a multi-table transaction is in flight: if a later table in the transaction fails, the catalog rolls back to metadata pointers that must still resolve to existing files.
    • testCommitTransactionDeletesOldMetadataFilesAfterSuccess

      @Test public void testCommitTransactionDeletesOldMetadataFilesAfterSuccess()
      Positive counterpart of testCommitTransactionDoesNotDeleteOldMetadataFilesOnFailure(): once a multi-table transaction commits successfully, metadata files evicted from the metadata log are deleted (deferred until after the atomic commit).
    • testMultipleConflictingCommitsToSingleTableInTransaction

      @Test public void testMultipleConflictingCommitsToSingleTableInTransaction()
    • testCoalescedConflictOnOneTableRollsBackEntireTransaction

      @Test public void testCoalescedConflictOnOneTableRollsBackEntireTransaction()
    • testMultipleNonConflictingUpdatesToSameTableWithSchemaAndProperties

      @Test public void testMultipleNonConflictingUpdatesToSameTableWithSchemaAndProperties()
    • testTableExistsStatus

      @Test public void testTableExistsStatus()
    • testDropTableStatus

      @Test public void testDropTableStatus()
    • testViewExistsStatus

      @Test public void testViewExistsStatus()
    • testDropViewStatus

      @Test public void testDropViewStatus()
    • testDropViewWithPurge

      @Test public void testDropViewWithPurge()
    • testRenameViewStatus

      @Test public void testRenameViewStatus()
    • testLoadCredentials

      @Test public void testLoadCredentials()
    • testCreateGenericTable

      @Test public void testCreateGenericTable()
    • testLoadGenericTable

      @Test public void testLoadGenericTable()
    • testListGenericTables

      @Test public void testListGenericTables()
    • testDropGenericTable

      @Test public void testDropGenericTable()
    • testGrantsOnGenericTable

      @Test public void testGrantsOnGenericTable()
    • testGrantsOnNonExistingGenericTable

      @Test public void testGrantsOnNonExistingGenericTable()
    • testDropNonExistingGenericTable

      @Test public void testDropNonExistingGenericTable()
    • testLoadTableWithSnapshots

      @Test public void testLoadTableWithSnapshots()
    • testLoadTableWithRefFiltering

      @Test public void testLoadTableWithRefFiltering()
    • testCreateGenericTableWithReservedProperty

      @Test public void testCreateGenericTableWithReservedProperty()
    • testCreateNamespaceWithReservedProperty

      @Test public void testCreateNamespaceWithReservedProperty()
    • testUpdateNamespaceWithReservedProperty

      @Test public void testUpdateNamespaceWithReservedProperty()
    • testRemoveReservedPropertyFromNamespace

      @Test public void testRemoveReservedPropertyFromNamespace()
    • testCreateTableWithReservedProperty

      @Test public void testCreateTableWithReservedProperty()
    • testUpdateTableWithReservedProperty

      @Test public void testUpdateTableWithReservedProperty()
    • testLoadTableWithNonMatchingIfNoneMatchHeader

      @Test public void testLoadTableWithNonMatchingIfNoneMatchHeader()
    • testLoadTableWithMultipleIfNoneMatchETags

      @Test public void testLoadTableWithMultipleIfNoneMatchETags()
    • testLoadTableWithWildcardIfNoneMatchReturns400

      @Test public void testLoadTableWithWildcardIfNoneMatchReturns400()
    • testLoadNonExistentTableWithIfNoneMatch

      @Test public void testLoadNonExistentTableWithIfNoneMatch()
    • testETagBehaviorForTableSchemaChanges

      @Test public void testETagBehaviorForTableSchemaChanges()
    • testETagBehaviorForTableDropAndRecreateIntegration

      @Test public void testETagBehaviorForTableDropAndRecreateIntegration()
    • testETagChangeAfterDMLOperations

      @Test public void testETagChangeAfterDMLOperations()
    • testPaginatedListNamespaces

      @Test public void testPaginatedListNamespaces()
    • testPaginatedListTables

      @Test public void testPaginatedListTables()
    • testNonPaginatedListTablesViewNamespaces

      @Test public void testNonPaginatedListTablesViewNamespaces()
    • testCreateNamespaceRejectsInvalidName

      @ParameterizedTest @MethodSource("invalidEntityNames") public void testCreateNamespaceRejectsInvalidName(String badName)
    • testCreateTableRejectsInvalidName

      @ParameterizedTest @MethodSource("invalidEntityNames") public void testCreateTableRejectsInvalidName(String badName)
    • testRegisterTableRejectsInvalidName

      @ParameterizedTest @MethodSource("invalidEntityNames") public void testRegisterTableRejectsInvalidName(String badName)
    • testCreateViewRejectsInvalidName

      @ParameterizedTest @MethodSource("invalidEntityNames") public void testCreateViewRejectsInvalidName(String badName)
    • testRenameTableRejectsInvalidDestinationName

      @ParameterizedTest @MethodSource("invalidEntityNames") public void testRenameTableRejectsInvalidDestinationName(String badName)
    • testRenameViewRejectsInvalidDestinationName

      @ParameterizedTest @MethodSource("invalidEntityNames") public void testRenameViewRejectsInvalidDestinationName(String badName)
    • testCreateGenericTableRejectsInvalidName

      @ParameterizedTest @MethodSource("invalidEntityNames") public void testCreateGenericTableRejectsInvalidName(String badName)
    • testLoadTableWithMissingMetadataFile

      @Test @Disabled("Test is not compatible with REST catalogs") public void testLoadTableWithMissingMetadataFile(@TempDir Path tempDir)
      Overrides:
      testLoadTableWithMissingMetadataFile in class org.apache.iceberg.catalog.CatalogTests<org.apache.iceberg.rest.RESTCatalog>
    • createTableInUniqueLocation

      @Test @Disabled("Feature is not implemented yet") public void createTableInUniqueLocation()
      Overrides:
      createTableInUniqueLocation in class org.apache.iceberg.catalog.CatalogTests<org.apache.iceberg.rest.RESTCatalog>
    • dropAfterRenameDoesntCorruptTable

      @Test @Disabled("Test is not compatible with Polaris: rename-table op does not change the table location") public void dropAfterRenameDoesntCorruptTable()
      Overrides:
      dropAfterRenameDoesntCorruptTable in class org.apache.iceberg.catalog.CatalogTests<org.apache.iceberg.rest.RESTCatalog>