Skip to content

Commit ddf4892

Browse files
authored
Fix test failure (#1541)
1 parent e708424 commit ddf4892

File tree

3 files changed

+34
-9
lines changed

3 files changed

+34
-9
lines changed

quarkus/service/build.gradle.kts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,11 @@ tasks.withType(Test::class.java).configureEach {
147147
systemProperty("java.security.manager", "allow")
148148
}
149149

150-
tasks.named<Test>("test").configure { maxParallelForks = 4 }
150+
tasks.named<Test>("test").configure {
151+
maxParallelForks = 4
152+
// enlarge the max heap size to avoid out of memory error
153+
maxHeapSize = "4g"
154+
}
151155

152156
tasks.named<Test>("intTest").configure {
153157
maxParallelForks = 1

quarkus/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogTest.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -769,9 +769,12 @@ public void testCreateNotificationCreateTableInExternalLocation() {
769769
// The location of the metadata JSON file specified is outside of the table's base location
770770
// according to the
771771
// metadata. We assume this is fraudulent and disallowed
772-
final String tableLocation = "s3://my-bucket/path/to/data/my_table/";
772+
final String tableSuffix = UUID.randomUUID().toString();
773+
final String tableLocation =
774+
String.format("s3://my-bucket/path/to/data/my_table_%s/", tableSuffix);
773775
final String tableMetadataLocation = tableLocation + "metadata/v1.metadata.json";
774-
final String anotherTableLocation = "s3://my-bucket/path/to/data/another_table/";
776+
final String anotherTableLocation =
777+
String.format("s3://my-bucket/path/to/data/another_table_%s/", tableSuffix);
775778

776779
metaStoreManager.updateEntityPropertiesIfNotChanged(
777780
polarisContext,
@@ -820,15 +823,18 @@ public void testCreateNotificationCreateTableOutsideOfMetadataLocation() {
820823
Assumptions.assumeTrue(
821824
supportsNotifications(), "Only applicable if notifications are supported");
822825

826+
final String tableSuffix = UUID.randomUUID().toString();
823827
// The location of the metadata JSON file specified is outside of the table's metadata directory
824828
// according to the
825829
// metadata. We assume this is fraudulent and disallowed
826-
final String tableLocation = "s3://my-bucket/path/to/data/my_table/";
830+
final String tableLocation =
831+
String.format("s3://my-bucket/path/to/data/my_table_%s/", tableSuffix);
827832
final String tableMetadataLocation = tableLocation + "metadata/v3.metadata.json";
828833

829834
// this passes the first validation, since it's within the namespace subdirectory, but
830835
// the location is in another table's subdirectory
831-
final String anotherTableLocation = "s3://my-bucket/path/to/data/another_table";
836+
final String anotherTableLocation =
837+
String.format("s3://my-bucket/path/to/data/another_table_%s", tableSuffix);
832838

833839
metaStoreManager.updateEntityPropertiesIfNotChanged(
834840
polarisContext,
@@ -880,9 +886,12 @@ public void testUpdateNotificationCreateTableInExternalLocation() {
880886
// The location of the metadata JSON file specified is outside of the table's base location
881887
// according to the
882888
// metadata. We assume this is fraudulent and disallowed
883-
final String tableLocation = "s3://my-bucket/path/to/data/my_table/";
889+
final String tableSuffix = UUID.randomUUID().toString();
890+
final String tableLocation =
891+
String.format("s3://my-bucket/path/to/data/my_table_%s/", tableSuffix);
884892
final String tableMetadataLocation = tableLocation + "metadata/v1.metadata.json";
885-
final String anotherTableLocation = "s3://my-bucket/path/to/data/another_table/";
893+
final String anotherTableLocation =
894+
String.format("s3://my-bucket/path/to/data/another_table_%s/", tableSuffix);
886895

887896
metaStoreManager.updateEntityPropertiesIfNotChanged(
888897
polarisContext,

quarkus/service/src/test/java/org/apache/polaris/service/quarkus/task/TableCleanupTaskHandlerTest.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import jakarta.annotation.Nonnull;
2525
import jakarta.inject.Inject;
2626
import java.io.IOException;
27+
import java.time.Clock;
2728
import java.util.HashMap;
2829
import java.util.List;
2930
import java.util.Map;
@@ -40,6 +41,8 @@
4041
import org.apache.iceberg.inmemory.InMemoryFileIO;
4142
import org.apache.iceberg.io.FileIO;
4243
import org.apache.polaris.core.PolarisCallContext;
44+
import org.apache.polaris.core.PolarisDiagnostics;
45+
import org.apache.polaris.core.config.PolarisConfigurationStore;
4346
import org.apache.polaris.core.context.CallContext;
4447
import org.apache.polaris.core.context.RealmContext;
4548
import org.apache.polaris.core.entity.AsyncTaskType;
@@ -66,7 +69,10 @@
6669

6770
@QuarkusTest
6871
class TableCleanupTaskHandlerTest {
69-
@Inject private MetaStoreManagerFactory metaStoreManagerFactory;
72+
@Inject MetaStoreManagerFactory metaStoreManagerFactory;
73+
@Inject PolarisConfigurationStore configurationStore;
74+
@Inject PolarisDiagnostics diagServices;
75+
7076
private CallContext callContext;
7177

7278
private final RealmContext realmContext = () -> "realmName";
@@ -90,7 +96,13 @@ public FileIO loadFileIO(
9096

9197
@BeforeEach
9298
void setup() {
93-
PolarisCallContext polarisCallContext = CallContext.getCurrentContext().getPolarisCallContext();
99+
PolarisCallContext polarisCallContext =
100+
new PolarisCallContext(
101+
metaStoreManagerFactory.getOrCreateSessionSupplier(realmContext).get(),
102+
diagServices,
103+
configurationStore,
104+
Clock.systemDefaultZone());
105+
94106
callContext = CallContext.of(realmContext, polarisCallContext);
95107
}
96108

0 commit comments

Comments
 (0)