This is an automated email from the ASF dual-hosted git repository. snazy pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/polaris.git
The following commit(s) were added to refs/heads/main by this push: new 82ae2cf34 Abstract polaris-runtime-service tests for all persistence implementations (#2106) 82ae2cf34 is described below commit 82ae2cf345cdbb6e495ba2b7dc123892e702d35f Author: Robert Stupp <sn...@snazy.de> AuthorDate: Thu Jul 17 13:53:34 2025 +0200 Abstract polaris-runtime-service tests for all persistence implementations (#2106) The NoSQL persistence implementation has to run the Iceberg table & view catalog plus the Polaris specific tests as well. Reusing existing tests is beneficial to avoid a lot of code duplcation. This change moves the actual tests to `Abstract*` classes and refactors the existing tests to extend those. The NoSQL persistence work extends the same `Abstract*` classes but runs with different Quarkus test profiles. --- .../quarkus/admin/PolarisAuthzTestBase.java | 30 ++++++---------- ...ogTest.java => AbstractIcebergCatalogTest.java} | 42 +++++++++------------- ...st.java => AbstractIcebergCatalogViewTest.java} | 38 +++++++------------- ...=> AbstractPolarisGenericTableCatalogTest.java} | 31 ++++------------ ...logTest.java => AbstractPolicyCatalogTest.java} | 31 ++++------------ ...IcebergCatalogRelationalNoEntityCacheTest.java} | 4 +-- ...ebergCatalogRelationalWithEntityCacheTest.java} | 4 +-- ....java => IcebergViewCatalogRelationalTest.java} | 16 ++------- ... PolarisGenericTableCatalogRelationalTest.java} | 17 ++------- ...eTest.java => PolicyCatalogRelationalTest.java} | 16 ++------- ...talogWithEntityCacheTest.java => Profiles.java} | 34 ++++++++++-------- 11 files changed, 86 insertions(+), 177 deletions(-) diff --git a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/admin/PolarisAuthzTestBase.java b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/admin/PolarisAuthzTestBase.java index 536e994b9..1944a5aa3 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/admin/PolarisAuthzTestBase.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/admin/PolarisAuthzTestBase.java @@ -24,7 +24,6 @@ import com.google.auth.oauth2.AccessToken; import com.google.auth.oauth2.GoogleCredentials; import com.google.common.collect.ImmutableMap; import io.quarkus.test.junit.QuarkusMock; -import io.quarkus.test.junit.QuarkusTestProfile; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.RequestScoped; import jakarta.enterprise.inject.Alternative; @@ -89,6 +88,7 @@ import org.apache.polaris.service.config.ReservedProperties; import org.apache.polaris.service.context.catalog.CallContextCatalogFactory; import org.apache.polaris.service.context.catalog.PolarisCallContextCatalogFactory; import org.apache.polaris.service.events.PolarisEventListener; +import org.apache.polaris.service.quarkus.catalog.Profiles; import org.apache.polaris.service.storage.PolarisStorageIntegrationProviderImpl; import org.apache.polaris.service.task.TaskExecutor; import org.apache.polaris.service.types.PolicyIdentifier; @@ -103,7 +103,7 @@ import software.amazon.awssdk.services.sts.StsClient; /** Base class for shared test setup logic used by various Polaris authz-related tests. */ public abstract class PolarisAuthzTestBase { - public static class Profile implements QuarkusTestProfile { + public static class Profile extends Profiles.DefaultProfile { @Override public Set<Class<?>> getEnabledAlternatives() { @@ -112,23 +112,15 @@ public abstract class PolarisAuthzTestBase { @Override public Map<String, String> getConfigOverrides() { - return Map.of( - "polaris.features.\"ALLOW_SPECIFYING_FILE_IO_IMPL\"", - "true", - "polaris.features.\"ALLOW_INSECURE_STORAGE_TYPES\"", - "true", - "polaris.features.\"ALLOW_EXTERNAL_METADATA_FILE_LOCATION\"", - "true", - "polaris.features.\"SUPPORTED_CATALOG_STORAGE_TYPES\"", - "[\"FILE\",\"S3\"]", - "polaris.readiness.ignore-severe-issues", - "true", - "polaris.features.\"ENABLE_GENERIC_TABLES\"", - "true", - "polaris.features.\"ENFORCE_PRINCIPAL_CREDENTIAL_ROTATION_REQUIRED_CHECKING\"", - "true", - "polaris.features.\"DROP_WITH_PURGE_ENABLED\"", - "true"); + return ImmutableMap.<String, String>builder() + .putAll(super.getConfigOverrides()) + .put("polaris.features.\"ALLOW_EXTERNAL_METADATA_FILE_LOCATION\"", "true") + .put("polaris.features.\"ENABLE_GENERIC_TABLES\"", "true") + .put( + "polaris.features.\"ENFORCE_PRINCIPAL_CREDENTIAL_ROTATION_REQUIRED_CHECKING\"", + "true") + .put("polaris.features.\"DROP_WITH_PURGE_ENABLED\"", "true") + .build(); } } diff --git a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogTest.java b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractIcebergCatalogTest.java similarity index 99% rename from runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogTest.java rename to runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractIcebergCatalogTest.java index 905934e67..b4df56e8e 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogTest.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractIcebergCatalogTest.java @@ -34,8 +34,6 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.google.common.collect.Streams; import io.quarkus.test.junit.QuarkusMock; -import io.quarkus.test.junit.QuarkusTestProfile; -import io.quarkus.test.junit.TestProfile; import jakarta.annotation.Nonnull; import jakarta.annotation.Nullable; import jakarta.inject.Inject; @@ -113,7 +111,7 @@ import org.apache.polaris.core.persistence.MetaStoreManagerFactory; import org.apache.polaris.core.persistence.PolarisEntityManager; import org.apache.polaris.core.persistence.PolarisMetaStoreManager; import org.apache.polaris.core.persistence.PolarisResolvedPathWrapper; -import org.apache.polaris.core.persistence.cache.InMemoryEntityCache; +import org.apache.polaris.core.persistence.cache.EntityCache; import org.apache.polaris.core.persistence.dao.entity.BaseResult; import org.apache.polaris.core.persistence.dao.entity.EntityResult; import org.apache.polaris.core.persistence.pagination.Page; @@ -179,8 +177,7 @@ import software.amazon.awssdk.services.sts.model.AssumeRoleRequest; import software.amazon.awssdk.services.sts.model.AssumeRoleResponse; import software.amazon.awssdk.services.sts.model.Credentials; -@TestProfile(IcebergCatalogTest.Profile.class) -public abstract class IcebergCatalogTest extends CatalogTests<IcebergCatalog> { +public abstract class AbstractIcebergCatalogTest extends CatalogTests<IcebergCatalog> { static { org.assertj.core.api.Assumptions.setPreferredAssumptionException( PreferredAssumptionException.JUNIT5); @@ -195,27 +192,14 @@ public abstract class IcebergCatalogTest extends CatalogTests<IcebergCatalog> { .withRecordCount(1) .build(); - public static class Profile implements QuarkusTestProfile { - + public static class Profile extends Profiles.DefaultProfile { @Override public Map<String, String> getConfigOverrides() { - return Map.of( - "polaris.features.\"ALLOW_SPECIFYING_FILE_IO_IMPL\"", - "true", - "polaris.features.\"ALLOW_INSECURE_STORAGE_TYPES\"", - "true", - "polaris.features.\"SUPPORTED_CATALOG_STORAGE_TYPES\"", - "[\"FILE\",\"S3\"]", - "polaris.features.\"LIST_PAGINATION_ENABLED\"", - "true", - "polaris.event-listener.type", - "test", - "polaris.readiness.ignore-severe-issues", - "true", - "LIST_PAGINATION_ENABLED", - "true", - "polaris.features.\"ALLOW_TABLE_LOCATION_OVERLAP\"", - "true"); + return ImmutableMap.<String, String>builder() + .putAll(super.getConfigOverrides()) + .put("polaris.features.\"ALLOW_TABLE_LOCATION_OVERLAP\"", "true") + .put("polaris.features.\"LIST_PAGINATION_ENABLED\"", "true") + .build(); } } @@ -271,9 +255,11 @@ public abstract class IcebergCatalogTest extends CatalogTests<IcebergCatalog> { } @Nullable - protected abstract InMemoryEntityCache createEntityCache( + protected abstract EntityCache createEntityCache( RealmConfig realmConfig, PolarisMetaStoreManager metaStoreManager); + protected void bootstrapRealm(String realmName) {} + @BeforeEach @SuppressWarnings("unchecked") public void before(TestInfo testInfo) { @@ -281,6 +267,8 @@ public abstract class IcebergCatalogTest extends CatalogTests<IcebergCatalog> { "realm_%s_%s" .formatted( testInfo.getTestMethod().map(Method::getName).orElse("test"), System.nanoTime()); + bootstrapRealm(realmName); + RealmContext realmContext = () -> realmName; QuarkusMock.installMockForType(realmContext, RealmContext.class); metaStoreManager = metaStoreManagerFactory.getOrCreateMetaStoreManager(realmContext); @@ -301,6 +289,10 @@ public abstract class IcebergCatalogTest extends CatalogTests<IcebergCatalog> { storageCredentialCache, createEntityCache(polarisContext.getRealmConfig(), metaStoreManager)); + // LocalPolarisMetaStoreManagerFactory.bootstrapServiceAndCreatePolarisPrincipalForRealm sets + // the CallContext.setCurrentContext() but never clears it, whereas the NoSQL one resets it. + CallContext.setCurrentContext(polarisContext); + PrincipalEntity rootEntity = new PrincipalEntity( PolarisEntity.of( diff --git a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogViewTest.java b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractIcebergCatalogViewTest.java similarity index 92% rename from runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogViewTest.java rename to runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractIcebergCatalogViewTest.java index ebb907583..8d55d288a 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogViewTest.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractIcebergCatalogViewTest.java @@ -22,9 +22,6 @@ import static org.mockito.Mockito.when; import com.google.common.collect.ImmutableMap; import io.quarkus.test.junit.QuarkusMock; -import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.junit.QuarkusTestProfile; -import io.quarkus.test.junit.TestProfile; import jakarta.inject.Inject; import jakarta.ws.rs.core.SecurityContext; import java.io.IOException; @@ -58,7 +55,6 @@ import org.apache.polaris.core.entity.PrincipalEntity; import org.apache.polaris.core.persistence.MetaStoreManagerFactory; import org.apache.polaris.core.persistence.PolarisEntityManager; import org.apache.polaris.core.persistence.PolarisMetaStoreManager; -import org.apache.polaris.core.persistence.cache.InMemoryEntityCache; import org.apache.polaris.core.secrets.UserSecretsManager; import org.apache.polaris.core.secrets.UserSecretsManagerFactory; import org.apache.polaris.core.storage.cache.StorageCredentialCache; @@ -89,32 +85,20 @@ import org.junit.jupiter.api.TestInfo; import org.junit.jupiter.api.io.TempDir; import org.mockito.Mockito; -@QuarkusTest -@TestProfile(IcebergCatalogViewTest.Profile.class) -public class IcebergCatalogViewTest extends ViewCatalogTests<IcebergCatalog> { +public abstract class AbstractIcebergCatalogViewTest extends ViewCatalogTests<IcebergCatalog> { static { Assumptions.setPreferredAssumptionException(PreferredAssumptionException.JUNIT5); } - public static class Profile implements QuarkusTestProfile { - + public static class Profile extends Profiles.DefaultProfile { @Override public Map<String, String> getConfigOverrides() { - return Map.of( - "polaris.features.\"ALLOW_WILDCARD_LOCATION\"", - "true", - "polaris.features.\"SKIP_CREDENTIAL_SUBSCOPING_INDIRECTION\"", - "true", - "polaris.features.\"ALLOW_SPECIFYING_FILE_IO_IMPL\"", - "true", - "polaris.features.\"ALLOW_INSECURE_STORAGE_TYPES\"", - "true", - "polaris.features.\"SUPPORTED_CATALOG_STORAGE_TYPES\"", - "[\"FILE\",\"S3\"]", - "polaris.event-listener.type", - "test", - "polaris.readiness.ignore-severe-issues", - "true"); + return ImmutableMap.<String, String>builder() + .putAll(super.getConfigOverrides()) + .put("polaris.features.\"ALLOW_WILDCARD_LOCATION\"", "true") + .put("polaris.features.\"SKIP_CREDENTIAL_SUBSCOPING_INDIRECTION\"", "true") + .put("polaris.features.\"LIST_PAGINATION_ENABLED\"", "true") + .build(); } } @@ -159,12 +143,15 @@ public class IcebergCatalogViewTest extends ViewCatalogTests<IcebergCatalog> { field.set(this, tempDir); } + protected void bootstrapRealm(String realmName) {} + @BeforeEach public void before(TestInfo testInfo) { realmName = "realm_%s_%s" .formatted( testInfo.getTestMethod().map(Method::getName).orElse("test"), System.nanoTime()); + bootstrapRealm(realmName); RealmContext realmContext = () -> realmName; QuarkusMock.installMockForType(realmContext, RealmContext.class); @@ -184,7 +171,8 @@ public class IcebergCatalogViewTest extends ViewCatalogTests<IcebergCatalog> { new PolarisEntityManager( metaStoreManager, storageCredentialCache, - new InMemoryEntityCache(polarisContext.getRealmConfig(), metaStoreManager)); + metaStoreManagerFactory.getOrCreateEntityCache( + polarisContext.getRealmContext(), polarisContext.getRealmConfig())); CallContext.setCurrentContext(polarisContext); diff --git a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolarisGenericTableCatalogTest.java b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractPolarisGenericTableCatalogTest.java similarity index 95% rename from runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolarisGenericTableCatalogTest.java rename to runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractPolarisGenericTableCatalogTest.java index 002ddc8d2..ea044fbab 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolarisGenericTableCatalogTest.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractPolarisGenericTableCatalogTest.java @@ -24,9 +24,6 @@ import static org.mockito.Mockito.when; import com.google.common.collect.ImmutableMap; import io.quarkus.test.junit.QuarkusMock; -import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.junit.QuarkusTestProfile; -import io.quarkus.test.junit.TestProfile; import jakarta.inject.Inject; import jakarta.ws.rs.core.SecurityContext; import java.io.IOException; @@ -59,7 +56,6 @@ import org.apache.polaris.core.entity.table.GenericTableEntity; import org.apache.polaris.core.persistence.MetaStoreManagerFactory; import org.apache.polaris.core.persistence.PolarisEntityManager; import org.apache.polaris.core.persistence.PolarisMetaStoreManager; -import org.apache.polaris.core.persistence.cache.InMemoryEntityCache; import org.apache.polaris.core.secrets.UserSecretsManager; import org.apache.polaris.core.secrets.UserSecretsManagerFactory; import org.apache.polaris.core.storage.PolarisStorageIntegration; @@ -91,25 +87,7 @@ import software.amazon.awssdk.services.sts.model.AssumeRoleRequest; import software.amazon.awssdk.services.sts.model.AssumeRoleResponse; import software.amazon.awssdk.services.sts.model.Credentials; -@QuarkusTest -@TestProfile(PolarisGenericTableCatalogTest.Profile.class) -public class PolarisGenericTableCatalogTest { - - public static class Profile implements QuarkusTestProfile { - - @Override - public Map<String, String> getConfigOverrides() { - return Map.of( - "polaris.features.\"ALLOW_SPECIFYING_FILE_IO_IMPL\"", - "true", - "polaris.features.\"ALLOW_INSECURE_STORAGE_TYPES\"", - "true", - "polaris.features.\"SUPPORTED_CATALOG_STORAGE_TYPES\"", - "[\"FILE\"]", - "polaris.readiness.ignore-severe-issues", - "true"); - } - } +public abstract class AbstractPolarisGenericTableCatalogTest { protected static final Namespace NS = Namespace.of("newdb"); protected static final TableIdentifier TABLE = TableIdentifier.of(NS, "table"); @@ -152,6 +130,8 @@ public class PolarisGenericTableCatalogTest { QuarkusMock.installMockForType(mock, PolarisStorageIntegrationProviderImpl.class); } + protected void bootstrapRealm(String realmName) {} + @BeforeEach @SuppressWarnings("unchecked") public void before(TestInfo testInfo) { @@ -159,6 +139,8 @@ public class PolarisGenericTableCatalogTest { "realm_%s_%s" .formatted( testInfo.getTestMethod().map(Method::getName).orElse("test"), System.nanoTime()); + bootstrapRealm(realmName); + RealmContext realmContext = () -> realmName; QuarkusMock.installMockForType(realmContext, RealmContext.class); metaStoreManager = metaStoreManagerFactory.getOrCreateMetaStoreManager(realmContext); @@ -176,7 +158,8 @@ public class PolarisGenericTableCatalogTest { new PolarisEntityManager( metaStoreManager, storageCredentialCache, - new InMemoryEntityCache(polarisContext.getRealmConfig(), metaStoreManager)); + metaStoreManagerFactory.getOrCreateEntityCache( + realmContext, polarisContext.getRealmConfig())); PrincipalEntity rootEntity = new PrincipalEntity( diff --git a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolicyCatalogTest.java b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractPolicyCatalogTest.java similarity index 96% rename from runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolicyCatalogTest.java rename to runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractPolicyCatalogTest.java index 3938bc112..42c91225f 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolicyCatalogTest.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractPolicyCatalogTest.java @@ -30,9 +30,6 @@ import static org.mockito.Mockito.when; import com.google.common.collect.ImmutableMap; import io.quarkus.test.junit.QuarkusMock; -import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.junit.QuarkusTestProfile; -import io.quarkus.test.junit.TestProfile; import jakarta.inject.Inject; import jakarta.ws.rs.core.SecurityContext; import java.io.IOException; @@ -40,7 +37,6 @@ import java.lang.reflect.Method; import java.time.Clock; import java.util.Arrays; import java.util.List; -import java.util.Map; import java.util.Set; import org.apache.iceberg.CatalogProperties; import org.apache.iceberg.Schema; @@ -68,7 +64,6 @@ import org.apache.polaris.core.persistence.MetaStoreManagerFactory; import org.apache.polaris.core.persistence.PolarisEntityManager; import org.apache.polaris.core.persistence.PolarisMetaStoreManager; import org.apache.polaris.core.persistence.PolicyMappingAlreadyExistsException; -import org.apache.polaris.core.persistence.cache.InMemoryEntityCache; import org.apache.polaris.core.policy.PredefinedPolicyTypes; import org.apache.polaris.core.policy.exceptions.NoSuchPolicyException; import org.apache.polaris.core.policy.exceptions.PolicyInUseException; @@ -108,24 +103,7 @@ import software.amazon.awssdk.services.sts.model.AssumeRoleRequest; import software.amazon.awssdk.services.sts.model.AssumeRoleResponse; import software.amazon.awssdk.services.sts.model.Credentials; -@QuarkusTest -@TestProfile(PolicyCatalogTest.Profile.class) -public class PolicyCatalogTest { - public static class Profile implements QuarkusTestProfile { - - @Override - public Map<String, String> getConfigOverrides() { - return Map.of( - "polaris.features.\"ALLOW_SPECIFYING_FILE_IO_IMPL\"", - "true", - "polaris.features.\"SUPPORTED_CATALOG_STORAGE_TYPES\"", - "[\"FILE\"]", - "polaris.features.\"ALLOW_INSECURE_STORAGE_TYPES\"", - "true", - "polaris.readiness.ignore-severe-issues", - "true"); - } - } +public abstract class AbstractPolicyCatalogTest { private static final Namespace NS = Namespace.of("ns1"); private static final TableIdentifier TABLE = TableIdentifier.of(NS, "table"); @@ -178,6 +156,8 @@ public class PolicyCatalogTest { QuarkusMock.installMockForType(mock, PolarisStorageIntegrationProviderImpl.class); } + protected void bootstrapRealm(String realmName) {} + @BeforeEach @SuppressWarnings("unchecked") public void before(TestInfo testInfo) { @@ -185,6 +165,8 @@ public class PolicyCatalogTest { "realm_%s_%s" .formatted( testInfo.getTestMethod().map(Method::getName).orElse("test"), System.nanoTime()); + bootstrapRealm(realmName); + RealmContext realmContext = () -> realmName; QuarkusMock.installMockForType(realmContext, RealmContext.class); metaStoreManager = metaStoreManagerFactory.getOrCreateMetaStoreManager(realmContext); @@ -202,7 +184,8 @@ public class PolicyCatalogTest { new PolarisEntityManager( metaStoreManager, storageCredentialCache, - new InMemoryEntityCache(polarisContext.getRealmConfig(), metaStoreManager)); + metaStoreManagerFactory.getOrCreateEntityCache( + realmContext, polarisContext.getRealmConfig())); callContext = polarisContext; diff --git a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/CatalogNoEntityCacheTest.java b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogRelationalNoEntityCacheTest.java similarity index 90% copy from runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/CatalogNoEntityCacheTest.java copy to runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogRelationalNoEntityCacheTest.java index f2e0bb662..4cf6f68ee 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/CatalogNoEntityCacheTest.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogRelationalNoEntityCacheTest.java @@ -26,8 +26,8 @@ import org.apache.polaris.core.persistence.PolarisMetaStoreManager; import org.apache.polaris.core.persistence.cache.InMemoryEntityCache; @QuarkusTest -@TestProfile(IcebergCatalogTest.Profile.class) -public class CatalogNoEntityCacheTest extends IcebergCatalogTest { +@TestProfile(AbstractIcebergCatalogTest.Profile.class) +public class IcebergCatalogRelationalNoEntityCacheTest extends AbstractIcebergCatalogTest { @Nullable @Override diff --git a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolarisCatalogWithEntityCacheTest.java b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogRelationalWithEntityCacheTest.java similarity index 90% copy from runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolarisCatalogWithEntityCacheTest.java copy to runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogRelationalWithEntityCacheTest.java index 40fddc197..a3604aeae 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolarisCatalogWithEntityCacheTest.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogRelationalWithEntityCacheTest.java @@ -26,8 +26,8 @@ import org.apache.polaris.core.persistence.PolarisMetaStoreManager; import org.apache.polaris.core.persistence.cache.InMemoryEntityCache; @QuarkusTest -@TestProfile(IcebergCatalogTest.Profile.class) -public class PolarisCatalogWithEntityCacheTest extends IcebergCatalogTest { +@TestProfile(AbstractIcebergCatalogTest.Profile.class) +public class IcebergCatalogRelationalWithEntityCacheTest extends AbstractIcebergCatalogTest { @Nullable @Override diff --git a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/CatalogNoEntityCacheTest.java b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergViewCatalogRelationalTest.java similarity index 65% copy from runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/CatalogNoEntityCacheTest.java copy to runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergViewCatalogRelationalTest.java index f2e0bb662..18f2c7512 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/CatalogNoEntityCacheTest.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergViewCatalogRelationalTest.java @@ -20,19 +20,7 @@ package org.apache.polaris.service.quarkus.catalog; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; -import jakarta.annotation.Nullable; -import org.apache.polaris.core.config.RealmConfig; -import org.apache.polaris.core.persistence.PolarisMetaStoreManager; -import org.apache.polaris.core.persistence.cache.InMemoryEntityCache; @QuarkusTest -@TestProfile(IcebergCatalogTest.Profile.class) -public class CatalogNoEntityCacheTest extends IcebergCatalogTest { - - @Nullable - @Override - protected InMemoryEntityCache createEntityCache( - RealmConfig realmConfig, PolarisMetaStoreManager metaStoreManager) { - return null; - } -} +@TestProfile(AbstractIcebergCatalogViewTest.Profile.class) +public class IcebergViewCatalogRelationalTest extends AbstractIcebergCatalogViewTest {} diff --git a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/CatalogNoEntityCacheTest.java b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolarisGenericTableCatalogRelationalTest.java similarity index 65% copy from runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/CatalogNoEntityCacheTest.java copy to runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolarisGenericTableCatalogRelationalTest.java index f2e0bb662..ae5034414 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/CatalogNoEntityCacheTest.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolarisGenericTableCatalogRelationalTest.java @@ -20,19 +20,8 @@ package org.apache.polaris.service.quarkus.catalog; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; -import jakarta.annotation.Nullable; -import org.apache.polaris.core.config.RealmConfig; -import org.apache.polaris.core.persistence.PolarisMetaStoreManager; -import org.apache.polaris.core.persistence.cache.InMemoryEntityCache; @QuarkusTest -@TestProfile(IcebergCatalogTest.Profile.class) -public class CatalogNoEntityCacheTest extends IcebergCatalogTest { - - @Nullable - @Override - protected InMemoryEntityCache createEntityCache( - RealmConfig realmConfig, PolarisMetaStoreManager metaStoreManager) { - return null; - } -} +@TestProfile(Profiles.DefaultProfile.class) +public class PolarisGenericTableCatalogRelationalTest + extends AbstractPolarisGenericTableCatalogTest {} diff --git a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/CatalogNoEntityCacheTest.java b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolicyCatalogRelationalTest.java similarity index 65% rename from runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/CatalogNoEntityCacheTest.java rename to runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolicyCatalogRelationalTest.java index f2e0bb662..3c8b30b5f 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/CatalogNoEntityCacheTest.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolicyCatalogRelationalTest.java @@ -20,19 +20,7 @@ package org.apache.polaris.service.quarkus.catalog; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; -import jakarta.annotation.Nullable; -import org.apache.polaris.core.config.RealmConfig; -import org.apache.polaris.core.persistence.PolarisMetaStoreManager; -import org.apache.polaris.core.persistence.cache.InMemoryEntityCache; @QuarkusTest -@TestProfile(IcebergCatalogTest.Profile.class) -public class CatalogNoEntityCacheTest extends IcebergCatalogTest { - - @Nullable - @Override - protected InMemoryEntityCache createEntityCache( - RealmConfig realmConfig, PolarisMetaStoreManager metaStoreManager) { - return null; - } -} +@TestProfile(Profiles.DefaultProfile.class) +public class PolicyCatalogRelationalTest extends AbstractPolicyCatalogTest {} diff --git a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolarisCatalogWithEntityCacheTest.java b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/Profiles.java similarity index 56% rename from runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolarisCatalogWithEntityCacheTest.java rename to runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/Profiles.java index 40fddc197..117177b35 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolarisCatalogWithEntityCacheTest.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/Profiles.java @@ -16,23 +16,29 @@ * specific language governing permissions and limitations * under the License. */ + package org.apache.polaris.service.quarkus.catalog; -import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.junit.TestProfile; -import jakarta.annotation.Nullable; -import org.apache.polaris.core.config.RealmConfig; -import org.apache.polaris.core.persistence.PolarisMetaStoreManager; -import org.apache.polaris.core.persistence.cache.InMemoryEntityCache; +import io.quarkus.test.junit.QuarkusTestProfile; +import java.util.Map; -@QuarkusTest -@TestProfile(IcebergCatalogTest.Profile.class) -public class PolarisCatalogWithEntityCacheTest extends IcebergCatalogTest { +public final class Profiles { + private Profiles() {} - @Nullable - @Override - protected InMemoryEntityCache createEntityCache( - RealmConfig realmConfig, PolarisMetaStoreManager metaStoreManager) { - return new InMemoryEntityCache(realmConfig, metaStoreManager); + public static class DefaultProfile implements QuarkusTestProfile { + @Override + public Map<String, String> getConfigOverrides() { + return Map.of( + "polaris.features.\"ALLOW_SPECIFYING_FILE_IO_IMPL\"", + "true", + "polaris.features.\"ALLOW_INSECURE_STORAGE_TYPES\"", + "true", + "polaris.features.\"SUPPORTED_CATALOG_STORAGE_TYPES\"", + "[\"FILE\",\"S3\"]", + "polaris.event-listener.type", + "test", + "polaris.readiness.ignore-severe-issues", + "true"); + } } }