diff --git a/quarkus/service/build.gradle.kts b/quarkus/service/build.gradle.kts index 61d96ec894..f08d25d967 100644 --- a/quarkus/service/build.gradle.kts +++ b/quarkus/service/build.gradle.kts @@ -147,7 +147,11 @@ tasks.withType(Test::class.java).configureEach { systemProperty("java.security.manager", "allow") } -tasks.named("test").configure { maxParallelForks = 4 } +tasks.named("test").configure { + maxParallelForks = 4 + // enlarge the max heap size to avoid out of memory error + maxHeapSize = "4g" +} tasks.named("intTest").configure { maxParallelForks = 1 diff --git a/quarkus/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogTest.java b/quarkus/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogTest.java index fbafd37c9a..05ad0b54b7 100644 --- a/quarkus/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogTest.java +++ b/quarkus/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogTest.java @@ -769,9 +769,12 @@ public void testCreateNotificationCreateTableInExternalLocation() { // The location of the metadata JSON file specified is outside of the table's base location // according to the // metadata. We assume this is fraudulent and disallowed - final String tableLocation = "s3://my-bucket/path/to/data/my_table/"; + final String tableSuffix = UUID.randomUUID().toString(); + final String tableLocation = + String.format("s3://my-bucket/path/to/data/my_table_%s/", tableSuffix); final String tableMetadataLocation = tableLocation + "metadata/v1.metadata.json"; - final String anotherTableLocation = "s3://my-bucket/path/to/data/another_table/"; + final String anotherTableLocation = + String.format("s3://my-bucket/path/to/data/another_table_%s/", tableSuffix); metaStoreManager.updateEntityPropertiesIfNotChanged( polarisContext, @@ -820,15 +823,18 @@ public void testCreateNotificationCreateTableOutsideOfMetadataLocation() { Assumptions.assumeTrue( supportsNotifications(), "Only applicable if notifications are supported"); + final String tableSuffix = UUID.randomUUID().toString(); // The location of the metadata JSON file specified is outside of the table's metadata directory // according to the // metadata. We assume this is fraudulent and disallowed - final String tableLocation = "s3://my-bucket/path/to/data/my_table/"; + final String tableLocation = + String.format("s3://my-bucket/path/to/data/my_table_%s/", tableSuffix); final String tableMetadataLocation = tableLocation + "metadata/v3.metadata.json"; // this passes the first validation, since it's within the namespace subdirectory, but // the location is in another table's subdirectory - final String anotherTableLocation = "s3://my-bucket/path/to/data/another_table"; + final String anotherTableLocation = + String.format("s3://my-bucket/path/to/data/another_table_%s", tableSuffix); metaStoreManager.updateEntityPropertiesIfNotChanged( polarisContext, @@ -880,9 +886,12 @@ public void testUpdateNotificationCreateTableInExternalLocation() { // The location of the metadata JSON file specified is outside of the table's base location // according to the // metadata. We assume this is fraudulent and disallowed - final String tableLocation = "s3://my-bucket/path/to/data/my_table/"; + final String tableSuffix = UUID.randomUUID().toString(); + final String tableLocation = + String.format("s3://my-bucket/path/to/data/my_table_%s/", tableSuffix); final String tableMetadataLocation = tableLocation + "metadata/v1.metadata.json"; - final String anotherTableLocation = "s3://my-bucket/path/to/data/another_table/"; + final String anotherTableLocation = + String.format("s3://my-bucket/path/to/data/another_table_%s/", tableSuffix); metaStoreManager.updateEntityPropertiesIfNotChanged( polarisContext, diff --git a/quarkus/service/src/test/java/org/apache/polaris/service/quarkus/task/TableCleanupTaskHandlerTest.java b/quarkus/service/src/test/java/org/apache/polaris/service/quarkus/task/TableCleanupTaskHandlerTest.java index 33e96e2a16..1c1f1441e8 100644 --- a/quarkus/service/src/test/java/org/apache/polaris/service/quarkus/task/TableCleanupTaskHandlerTest.java +++ b/quarkus/service/src/test/java/org/apache/polaris/service/quarkus/task/TableCleanupTaskHandlerTest.java @@ -24,6 +24,7 @@ import jakarta.annotation.Nonnull; import jakarta.inject.Inject; import java.io.IOException; +import java.time.Clock; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -40,6 +41,8 @@ import org.apache.iceberg.inmemory.InMemoryFileIO; import org.apache.iceberg.io.FileIO; import org.apache.polaris.core.PolarisCallContext; +import org.apache.polaris.core.PolarisDiagnostics; +import org.apache.polaris.core.config.PolarisConfigurationStore; import org.apache.polaris.core.context.CallContext; import org.apache.polaris.core.context.RealmContext; import org.apache.polaris.core.entity.AsyncTaskType; @@ -66,7 +69,10 @@ @QuarkusTest class TableCleanupTaskHandlerTest { - @Inject private MetaStoreManagerFactory metaStoreManagerFactory; + @Inject MetaStoreManagerFactory metaStoreManagerFactory; + @Inject PolarisConfigurationStore configurationStore; + @Inject PolarisDiagnostics diagServices; + private CallContext callContext; private final RealmContext realmContext = () -> "realmName"; @@ -90,7 +96,13 @@ public FileIO loadFileIO( @BeforeEach void setup() { - PolarisCallContext polarisCallContext = CallContext.getCurrentContext().getPolarisCallContext(); + PolarisCallContext polarisCallContext = + new PolarisCallContext( + metaStoreManagerFactory.getOrCreateSessionSupplier(realmContext).get(), + diagServices, + configurationStore, + Clock.systemDefaultZone()); + callContext = CallContext.of(realmContext, polarisCallContext); }