Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion quarkus/service/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ tasks.withType(Test::class.java).configureEach {
systemProperty("java.security.manager", "allow")
}

tasks.named<Test>("test").configure { maxParallelForks = 4 }
tasks.named<Test>("test").configure {
maxParallelForks = 4
// enlarge the max heap size to avoid out of memory error
maxHeapSize = "4g"
}

tasks.named<Test>("intTest").configure {
maxParallelForks = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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";
Expand All @@ -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);
}

Expand Down