You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2025/09/03 11:52:01 UTC

(shardingsphere) branch master updated: Refactor PostgreSQLContainerConfigurationFactory (#36467)

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

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 77454713b3c Refactor PostgreSQLContainerConfigurationFactory (#36467)
77454713b3c is described below

commit 77454713b3c4d74cfcb11c3d39befb7171ba1c38
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Wed Sep 3 19:51:55 2025 +0800

    Refactor PostgreSQLContainerConfigurationFactory (#36467)
---
 .../config/dialect/PostgreSQLContainerConfigurationFactory.java    | 7 +++++--
 .../storage/dialect/PostgreSQLContainerConfigurationFactory.java   | 6 +++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/config/dialect/PostgreSQLContainerConfigurationFactory.java b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/config/dialect/PostgreSQLContainerConfigurationFactory.java
index a1b1f27a2c6..8773c2551b4 100644
--- a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/config/dialect/PostgreSQLContainerConfigurationFactory.java
+++ b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/config/dialect/PostgreSQLContainerConfigurationFactory.java
@@ -61,11 +61,14 @@ public final class PostgreSQLContainerConfigurationFactory {
     }
     
     private static String getCommand() {
-        return "-c config_file=" + PostgreSQLContainer.POSTGRESQL_CONF_IN_CONTAINER;
+        return "-c config_file=" + PostgreSQLContainer.POSTGRESQL_CONF_IN_CONTAINER + " --max_connections=600 --max_prepared_transactions=600 --wal_level=logical";
     }
     
     private static Map<String, String> getContainerEnvironments() {
-        return Collections.singletonMap("POSTGRES_PASSWORD", StorageContainerConstants.PASSWORD);
+        Map<String, String> result = new HashMap<>(2, 1F);
+        result.put("POSTGRES_HOST", StorageContainerConstants.USERNAME);
+        result.put("POSTGRES_PASSWORD", StorageContainerConstants.PASSWORD);
+        return result;
     }
     
     private static Map<String, String> getMountedResources() {
diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/operation/transaction/framework/container/config/storage/dialect/PostgreSQLContainerConfigurationFactory.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/operation/transaction/framework/container/config/storage/dialect/PostgreSQLContainerConfigurationFactory.java
index f4631aa5520..77913bfe2fb 100644
--- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/operation/transaction/framework/container/config/storage/dialect/PostgreSQLContainerConfigurationFactory.java
+++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/operation/transaction/framework/container/config/storage/dialect/PostgreSQLContainerConfigurationFactory.java
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
 import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
 import org.apache.shardingsphere.test.e2e.env.container.atomic.constants.StorageContainerConstants;
 import org.apache.shardingsphere.test.e2e.env.container.atomic.storage.config.StorageContainerConfiguration;
-import org.apache.shardingsphere.test.e2e.env.container.atomic.storage.impl.OpenGaussContainer;
+import org.apache.shardingsphere.test.e2e.env.container.atomic.storage.impl.PostgreSQLContainer;
 import org.apache.shardingsphere.test.e2e.env.runtime.scenario.database.DatabaseEnvironmentManager;
 import org.apache.shardingsphere.test.e2e.env.runtime.scenario.path.ScenarioDataPath;
 import org.apache.shardingsphere.test.e2e.env.runtime.scenario.path.ScenarioDataPath.Type;
@@ -51,7 +51,7 @@ public final class PostgreSQLContainerConfigurationFactory {
     }
     
     private static String getCommand() {
-        return "--max_connections=600 --max_prepared_transactions=600 --wal_level=logical";
+        return "-c config_file=" + PostgreSQLContainer.POSTGRESQL_CONF_IN_CONTAINER + " --max_connections=600 --max_prepared_transactions=600 --wal_level=logical";
     }
     
     private static Map<String, String> getContainerEnvironments() {
@@ -65,7 +65,7 @@ public final class PostgreSQLContainerConfigurationFactory {
         Map<String, String> result = new HashMap<>(3, 1F);
         result.put(new ScenarioDataPath(scenario).getInitSQLResourcePath(Type.ACTUAL, DATABASE_TYPE) + "/01-actual-init.sql", "/docker-entrypoint-initdb.d/01-actual-init.sql");
         result.put(new ScenarioDataPath(scenario).getInitSQLResourcePath(Type.EXPECTED, DATABASE_TYPE) + "/01-expected-init.sql", "/docker-entrypoint-initdb.d/01-expected-init.sql");
-        result.put("/env/postgresql/postgresql.conf", OpenGaussContainer.OPENGAUSS_CONF_IN_CONTAINER);
+        result.put("/env/postgresql/postgresql.conf", PostgreSQLContainer.POSTGRESQL_CONF_IN_CONTAINER);
         return result;
     }
 }