gh-yzou commented on code in PR #1126: URL: https://github.com/apache/polaris/pull/1126#discussion_r2009325290
########## quarkus/service/src/intTest/java/org/apache/polaris/service/quarkus/it/QuarkusRestCatalogViewFileIT.java: ########## @@ -20,20 +20,37 @@ import io.quarkus.test.junit.QuarkusIntegrationTest; import java.lang.reflect.Field; +import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.Paths; import org.apache.iceberg.view.ViewCatalogTests; import org.apache.polaris.service.it.test.PolarisRestCatalogViewFileIntegrationTest; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.extension.AnnotatedElementContext; +import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.io.TempDir; +import org.junit.jupiter.api.io.TempDirFactory; @QuarkusIntegrationTest public class QuarkusRestCatalogViewFileIT extends PolarisRestCatalogViewFileIntegrationTest { @BeforeEach - public void setUpTempDir(@TempDir Path tempDir) throws Exception { + public void setUpTempDir(@TempDir(factory = CustomTempDirFactory.class) Path tempDir) + throws Exception { // see https://github.com/quarkusio/quarkus/issues/13261 Field field = ViewCatalogTests.class.getDeclaredField("tempDir"); field.setAccessible(true); field.set(this, tempDir); } + + private static class CustomTempDirFactory implements TempDirFactory { + @Override + public Path createTempDirectory( + AnnotatedElementContext elementContext, ExtensionContext extensionContext) + throws Exception { + Path basePath = Paths.get(BASE_LOCATION.replaceFirst("file://", "")); Review Comment: Sorry, I meant completely overwrite the test to use a valid customLocation and location for it. The test seems using ``` String location = Paths.get(tempDir.toUri().toString()).toString(); String customLocation = Paths.get(tempDir.toUri().toString(), "custom-location").toString(); ``` If BASE_LOCATION is a valid location, then we override the while test as following ``` TableIdentifier identifier = TableIdentifier.of("ns", "view"); if (requiresNamespaceCreate()) { catalog().createNamespace(identifier.namespace()); } assertThat(catalog().viewExists(identifier)).as("View should not exist").isFalse(); String location = BASE_LOCATION; String customLocation = BASE_LOCATION/custom-location View view = catalog() .buildView(identifier) .withSchema(SCHEMA) .withDefaultNamespace(identifier.namespace()) .withDefaultCatalog(catalog().name()) .withQuery("spark", "select * from ns.tbl") .withProperty(ViewProperties.WRITE_METADATA_LOCATION, customLocation) .withLocation(location) .create(); assertThat(view).isNotNull(); assertThat(catalog().viewExists(identifier)).as("View should exist").isTrue(); assertThat(view.properties()).containsEntry("write.metadata.path", customLocation); assertThat(((BaseView) view).operations().current().metadataFileLocation()) .isNotNull() .startsWith(customLocation); ``` In that case, you shouldn't need tempDir anymore. one quick question, is that the only test that is failing? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@polaris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org