This is an automated email from the ASF dual-hosted git repository.

shishkovilja pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-extensions.git


The following commit(s) were added to refs/heads/master by this push:
     new 26aad920 IGNITE-26815 CDC: Override embedded PG directory in 
IgniteToPostgreSql tests (#327)
26aad920 is described below

commit 26aad920e2a362d225d7d8372e5162ff87536edc
Author: Ilya Shishkov <[email protected]>
AuthorDate: Tue Oct 28 09:39:17 2025 +0300

    IGNITE-26815 CDC: Override embedded PG directory in IgniteToPostgreSql 
tests (#327)
---
 .../CdcPostgreSqlReplicationAbstractTest.java      | 34 ++++++++++++++++++++++
 .../postgresql/CdcPostgreSqlReplicationTest.java   |  2 +-
 .../cdc/postgresql/JavaToSqlTypeMapperTest.java    |  2 +-
 3 files changed, 36 insertions(+), 2 deletions(-)

diff --git 
a/modules/cdc-ext/src/test/java/org/apache/ignite/cdc/postgresql/CdcPostgreSqlReplicationAbstractTest.java
 
b/modules/cdc-ext/src/test/java/org/apache/ignite/cdc/postgresql/CdcPostgreSqlReplicationAbstractTest.java
index 33d123cf..cc3be50f 100644
--- 
a/modules/cdc-ext/src/test/java/org/apache/ignite/cdc/postgresql/CdcPostgreSqlReplicationAbstractTest.java
+++ 
b/modules/cdc-ext/src/test/java/org/apache/ignite/cdc/postgresql/CdcPostgreSqlReplicationAbstractTest.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.cdc.postgresql;
 
+import java.io.File;
+import java.io.IOException;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -25,6 +27,7 @@ import java.util.List;
 import java.util.Set;
 import javax.sql.DataSource;
 import io.zonky.test.db.postgres.embedded.EmbeddedPostgres;
+import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.cache.query.FieldsQueryCursor;
 import org.apache.ignite.cache.query.SqlFieldsQuery;
@@ -35,6 +38,7 @@ import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.cdc.CdcMain;
 import org.apache.ignite.internal.util.function.ThrowableFunction;
 import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
 import static org.apache.ignite.testframework.GridTestUtils.runAsync;
@@ -47,6 +51,36 @@ public abstract class CdcPostgreSqlReplicationAbstractTest 
extends GridCommonAbs
     /** */
     protected static final int KEYS_CNT = 1024;
 
+    /** Embedded Postgres working directory. */
+    private static File pgDir;
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        super.beforeTestsStarted();
+
+        // Clean up and set PG working directory in order to overcome possible 
inconsistent cleanup of '/tmp'.
+        pgDir = U.resolveWorkDirectory(U.defaultWorkDirectory(), 
"embedded-pg", true, false);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        U.delete(pgDir);
+    }
+
+    /** */
+    protected EmbeddedPostgres initPostgres() throws IgniteCheckedException, 
IOException {
+        // Clean up and set PG data directory in order to overcome possible 
inconsistent cleanup of '/tmp'.
+        File pgDataDir = U.resolveWorkDirectory(pgDir.getAbsolutePath(), 
"data", true, false);
+
+        return EmbeddedPostgres.builder()
+            .setOverrideWorkingDirectory(pgDir)
+            .setDataDirectory(pgDataDir)
+            .setCleanDataDirectory(true)
+            .start();
+    }
+
     /** */
     protected void executeOnIgnite(IgniteEx src, String sqlText, Object... 
args) {
         SqlFieldsQuery qry = new SqlFieldsQuery(sqlText).setArgs(args);
diff --git 
a/modules/cdc-ext/src/test/java/org/apache/ignite/cdc/postgresql/CdcPostgreSqlReplicationTest.java
 
b/modules/cdc-ext/src/test/java/org/apache/ignite/cdc/postgresql/CdcPostgreSqlReplicationTest.java
index 60d80302..9bc93091 100644
--- 
a/modules/cdc-ext/src/test/java/org/apache/ignite/cdc/postgresql/CdcPostgreSqlReplicationTest.java
+++ 
b/modules/cdc-ext/src/test/java/org/apache/ignite/cdc/postgresql/CdcPostgreSqlReplicationTest.java
@@ -129,7 +129,7 @@ public class CdcPostgreSqlReplicationTest extends 
CdcPostgreSqlReplicationAbstra
 
         src.cluster().state(ClusterState.ACTIVE);
 
-        postgres = EmbeddedPostgres.builder().start();
+        postgres = initPostgres();
     }
 
     /** {@inheritDoc} */
diff --git 
a/modules/cdc-ext/src/test/java/org/apache/ignite/cdc/postgresql/JavaToSqlTypeMapperTest.java
 
b/modules/cdc-ext/src/test/java/org/apache/ignite/cdc/postgresql/JavaToSqlTypeMapperTest.java
index 2b358332..0435f5ac 100644
--- 
a/modules/cdc-ext/src/test/java/org/apache/ignite/cdc/postgresql/JavaToSqlTypeMapperTest.java
+++ 
b/modules/cdc-ext/src/test/java/org/apache/ignite/cdc/postgresql/JavaToSqlTypeMapperTest.java
@@ -117,7 +117,7 @@ public class JavaToSqlTypeMapperTest extends 
CdcPostgreSqlReplicationAbstractTes
 
         src.cluster().state(ClusterState.ACTIVE);
 
-        postgres = EmbeddedPostgres.builder().start();
+        postgres = initPostgres();
     }
 
     /** {@inheritDoc} */

Reply via email to