From bbb53eaef24164235116ef9863c5f2dabc1147b6 Mon Sep 17 00:00:00 2001 From: Rafael Bey <24432403+rafaelbey@users.noreply.github.com> Date: Thu, 22 Aug 2024 19:31:31 -0400 Subject: [PATCH] Persistence duckdb test to use temp directory (#3033) --- .../engine/persistence/components/e2e/BaseTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/legend-engine-xts-persistence/legend-engine-xt-persistence-component/legend-engine-xt-persistence-component-relational-duckdb/src/test/java/org/finos/legend/engine/persistence/components/e2e/BaseTest.java b/legend-engine-xts-persistence/legend-engine-xt-persistence-component/legend-engine-xt-persistence-component-relational-duckdb/src/test/java/org/finos/legend/engine/persistence/components/e2e/BaseTest.java index 9be4642aef9..203f795576e 100644 --- a/legend-engine-xts-persistence/legend-engine-xt-persistence-component/legend-engine-xt-persistence-component-relational-duckdb/src/test/java/org/finos/legend/engine/persistence/components/e2e/BaseTest.java +++ b/legend-engine-xts-persistence/legend-engine-xt-persistence-component/legend-engine-xt-persistence-component-relational-duckdb/src/test/java/org/finos/legend/engine/persistence/components/e2e/BaseTest.java @@ -14,6 +14,7 @@ package org.finos.legend.engine.persistence.components.e2e; +import java.nio.file.Files; import org.finos.legend.engine.persistence.components.common.DatasetFilter; import org.finos.legend.engine.persistence.components.common.Datasets; import org.finos.legend.engine.persistence.components.common.StatisticName; @@ -60,7 +61,6 @@ public class BaseTest { public static final String TEST_SCHEMA = "TEST"; public static final String TEST_DATABASE = "TEST_DB"; - protected static final String JDBC_URL = "jdbc:duckdb:" + TEST_DATABASE; protected static final String USER_NAME = "sa"; protected static final String PASSWORD = ""; public static JdbcHelper duckDBSink; @@ -77,12 +77,13 @@ public class BaseTest protected RelationalExecutor executor = new RelationalExecutor(DuckDBSink.get(), duckDBSink); @BeforeAll - public static void initialize() + public static void initialize() throws Exception { - duckDBSink = JdbcHelper.of(DuckDBSink.createConnection(USER_NAME, PASSWORD, JDBC_URL)); + String jdbc = "jdbc:duckdb:" + Files.createTempDirectory("persistence-duckdb-test").resolve(TEST_DATABASE); + duckDBSink = JdbcHelper.of(DuckDBSink.createConnection(USER_NAME, PASSWORD, jdbc)); // Closing connection pool created by other tests. duckDBSink.close(); - duckDBSink = JdbcHelper.of(DuckDBSink.createConnection(USER_NAME, PASSWORD, JDBC_URL)); + duckDBSink = JdbcHelper.of(DuckDBSink.createConnection(USER_NAME, PASSWORD, jdbc)); } @AfterAll