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 281c83bea85 Refactor : transfer all container related config files to 
env module (#20021)
281c83bea85 is described below

commit 281c83bea85815e576b6cd150736f3e28f3e010e
Author: 孙念君 Nianjun Sun <[email protected]>
AuthorDate: Thu Aug 11 21:24:01 2022 +0800

    Refactor : transfer all container related config files to env module 
(#20021)
    
    * Refactor : transfer all container related config files to env module 
(#19958)
    
    * Refactor : make scaling init resource base on env
    
    * Refactor : refactor the storage container init process (#19958)
    
    * Refactor : add default password for PG container
    
    * Refactor : refactor the setCommand method to trigger each command
    
    * Refactor : refactor the config files for scaling
    
    * Refactor : refactor the configuration factory to scaling (#19958)
    
    * Refactor : add H2 type to pass the configuration check
---
 .../impl/ShardingSphereProxyClusterContainer.java  |  6 +--
 .../atomic/storage/DockerStorageContainer.java     | 14 +++++
 .../atomic/storage/StorageContainerFactory.java    | 13 +++--
 .../config/StorageContainerConfiguration.java      | 47 +++++++++++++++++
 .../mysql/DefaultMySQLContainerConfiguration.java} | 41 ++++++---------
 .../DefaultOpenGaussContainerConfiguration.java    | 43 +++++++++++++++
 .../DefaultPostgreSQLContainerConfiguration.java   | 43 +++++++++++++++
 .../atomic/storage/impl/MySQLContainer.java        | 15 +++---
 .../atomic/storage/impl/OpenGaussContainer.java    | 13 +++--
 .../atomic/storage/impl/PostgreSQLContainer.java   | 13 +++--
 .../test/resources/env/scaling/mysql/01-initdb.sql | 25 ---------
 .../src/test/resources/env/scaling/mysql/my.cnf    | 29 ----------
 .../test/resources/env/scaling/mysql/server-5.yaml | 45 ----------------
 .../test/resources/env/scaling/mysql/server-8.yaml | 45 ----------------
 .../resources/env/scaling/postgresql/01-initdb.sql | 28 ----------
 .../env/scaling/postgresql/postgresql.conf         | 25 ---------
 .../resources/env/scaling/postgresql/server.yaml   | 57 --------------------
 .../cases/general/CreateTableSQLGeneratorIT.java   |  4 +-
 ...calingStorageContainerConfigurationFactory.java | 61 ++++++++++++++++++++++
 .../mysql/ScalingMySQLContainerConfiguration.java  | 45 ++++++++++++++++
 .../ScalingPostgreSQLContainerConfiguration.java   | 45 ++++++++++++++++
 .../container/compose/DockerComposedContainer.java |  4 +-
 .../src/test/resources/env/postgresql/server.yaml  |  2 +-
 .../compose/mode/ClusterComposedContainer.java     |  4 +-
 .../compose/mode/StandaloneComposedContainer.java  |  6 ++-
 ...SuiteStorageContainerConfigurationFactory.java} | 37 +++++++------
 26 files changed, 382 insertions(+), 328 deletions(-)

diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/adapter/impl/ShardingSphereProxyClusterContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/adapter/impl/ShardingSphereProxyClusterContainer.java
index 43cb9fbe385..669c7025393 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/adapter/impl/ShardingSphereProxyClusterContainer.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/adapter/impl/ShardingSphereProxyClusterContainer.java
@@ -109,12 +109,12 @@ public final class ShardingSphereProxyClusterContainer 
extends DockerITContainer
     private void mapScalingConfigurationFiles() {
         if (DatabaseTypeUtil.isMySQL(databaseType)) {
             String majorVersion = 
DatabaseTypeUtil.parseMajorVersion(((GenericContainer<?>) 
storageContainer).getDockerImageName());
-            
withClasspathResourceMapping(String.format("/env/%s/%s/server-%s.yaml", module, 
databaseType.getType().toLowerCase(), majorVersion),
+            
withClasspathResourceMapping(String.format("/env/%s/server-%s.yaml", 
databaseType.getType().toLowerCase(), majorVersion),
                     "/opt/shardingsphere-proxy/conf/server.yaml", 
BindMode.READ_ONLY);
         } else {
-            
withClasspathResourceMapping(String.format("/env/%s/%s/server.yaml", module, 
databaseType.getType().toLowerCase()), 
"/opt/shardingsphere-proxy/conf/server.yaml", BindMode.READ_ONLY);
+            withClasspathResourceMapping(String.format("/env/%s/server.yaml", 
databaseType.getType().toLowerCase()), 
"/opt/shardingsphere-proxy/conf/server.yaml", BindMode.READ_ONLY);
         }
-        withClasspathResourceMapping(String.format("/env/%s/logback.xml", 
module), "/opt/shardingsphere-proxy/conf/logback.xml", BindMode.READ_ONLY);
+        withClasspathResourceMapping("/env/logback.xml", 
"/opt/shardingsphere-proxy/conf/logback.xml", BindMode.READ_ONLY);
     }
     
     @Override
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/DockerStorageContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/DockerStorageContainer.java
index 91e95863a39..3a88e4a7d7d 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/DockerStorageContainer.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/DockerStorageContainer.java
@@ -78,6 +78,20 @@ public abstract class DockerStorageContainer extends 
DockerITContainer implement
                         : DataSourceEnvironment.getURL(databaseType, 
"localhost", getFirstMappedPort()), getUsername(), getUnifiedPassword())));
     }
     
+    protected final void setCommands(final String[] commands) {
+        for (String each : commands) {
+            setCommand(each);
+        }
+    }
+    
+    protected final void addEnvs(final Map<String, String> envs) {
+        envs.forEach(this::addEnv);
+    }
+    
+    protected final void mapResources(final Map<String, String> resources) {
+        resources.forEach((key, value) -> withClasspathResourceMapping(key, 
value, BindMode.READ_ONLY));
+    }
+    
     @Override
     @SneakyThrows({IOException.class, JAXBException.class})
     protected void postStart() {
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/StorageContainerFactory.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/StorageContainerFactory.java
index a132967c3a1..f855d2cfc56 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/StorageContainerFactory.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/StorageContainerFactory.java
@@ -20,6 +20,7 @@ package 
org.apache.shardingsphere.test.integration.env.container.atomic.storage;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.impl.H2Container;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.impl.MySQLContainer;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.impl.OpenGaussContainer;
@@ -33,20 +34,22 @@ public final class StorageContainerFactory {
     
     /**
      * Create new instance of storage container.
-     * 
+     *
      * @param databaseType database type
      * @param dockerImageName docker image name
      * @param scenario scenario
+     * @param storageContainerConfiguration storageContainerConfiguration
      * @return created instance
      */
-    public static StorageContainer newInstance(final DatabaseType 
databaseType, final String dockerImageName, final String scenario) {
+    public static StorageContainer newInstance(final DatabaseType 
databaseType, final String dockerImageName, final String scenario,
+                                               final 
StorageContainerConfiguration storageContainerConfiguration) {
         switch (databaseType.getType()) {
             case "MySQL":
-                return new MySQLContainer(dockerImageName, scenario);
+                return new MySQLContainer(dockerImageName, scenario, 
storageContainerConfiguration);
             case "PostgreSQL":
-                return new PostgreSQLContainer(dockerImageName, scenario);
+                return new PostgreSQLContainer(dockerImageName, scenario, 
storageContainerConfiguration);
             case "openGauss":
-                return new OpenGaussContainer(dockerImageName, scenario);
+                return new OpenGaussContainer(dockerImageName, scenario, 
storageContainerConfiguration);
             case "H2":
                 return new H2Container(scenario);
             default:
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/StorageContainerConfiguration.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/StorageContainerConfiguration.java
new file mode 100644
index 00000000000..87507020bd3
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/StorageContainerConfiguration.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config;
+
+import java.util.Map;
+
+/**
+ * Docker storage container configuration.
+ */
+public interface StorageContainerConfiguration {
+    
+    /**
+     * get docker container commands.
+     * 
+     * @return docker container commands
+     */
+    String[] getCommands();
+    
+    /**
+     * get docker container environment variables.
+     * 
+     * @return docker container environments
+     */
+    Map<String, String> getEnvs();
+    
+    /**
+     * get docker container mapping resources.
+     * 
+     * @return docker container resource mapping
+     */
+    Map<String, String> getResourceMappings();
+}
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/MySQLContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/mysql/DefaultMySQLContainerConfiguration.java
similarity index 51%
copy from 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/MySQLContainer.java
copy to 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/mysql/DefaultMySQLContainerConfiguration.java
index bf84a6daff0..4bea8b4a8f9 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/MySQLContainer.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/mysql/DefaultMySQLContainerConfiguration.java
@@ -15,41 +15,34 @@
  * limitations under the License.
  */
 
-package 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.impl;
+package 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.mysql;
 
-import com.google.common.base.Strings;
-import org.apache.shardingsphere.infra.database.type.DatabaseTypeFactory;
-import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.DockerStorageContainer;
-import org.testcontainers.containers.BindMode;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
 
-import java.util.Optional;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
 
-/**
- * MySQL container.
- */
-public final class MySQLContainer extends DockerStorageContainer {
-    
-    public MySQLContainer(final String dockerImageName, final String scenario) 
{
-        super(DatabaseTypeFactory.getInstance("MySQL"), 
Strings.isNullOrEmpty(dockerImageName) ? "mysql/mysql-server:5.7" : 
dockerImageName, scenario);
-    }
+public class DefaultMySQLContainerConfiguration implements 
StorageContainerConfiguration {
     
     @Override
-    protected void configure() {
+    public String[] getCommands() {
         // TODO need auto set server-id by generator, now always set server-id 
to 1
-        setCommand("--server-id=1");
-        addEnv("LANG", "C.UTF-8");
-        addEnv("MYSQL_RANDOM_ROOT_PASSWORD", "yes");
-        withClasspathResourceMapping("/env/mysql/my.cnf", "/etc/mysql/my.cnf", 
BindMode.READ_ONLY);
-        super.configure();
+        String[] commands = new String[1];
+        commands[0] = "--server-id=1";
+        return commands;
     }
     
     @Override
-    public int getPort() {
-        return 3306;
+    public Map<String, String> getEnvs() {
+        Map<String, String> result = new HashMap<>();
+        result.put("LANG", "C.UTF-8");
+        result.put("MYSQL_RANDOM_ROOT_PASSWORD", "yes");
+        return result;
     }
     
     @Override
-    protected Optional<String> getDefaultDatabaseName() {
-        return Optional.empty();
+    public Map<String, String> getResourceMappings() {
+        return Collections.singletonMap("/env/mysql/my.cnf", 
"/etc/mysql/my.cnf");
     }
 }
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/opengauss/DefaultOpenGaussContainerConfiguration.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/opengauss/DefaultOpenGaussContainerConfiguration.java
new file mode 100644
index 00000000000..f34bda86623
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/opengauss/DefaultOpenGaussContainerConfiguration.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.opengauss;
+
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
+import org.testcontainers.shaded.com.google.common.collect.ImmutableMap;
+
+import java.util.Map;
+
+public class DefaultOpenGaussContainerConfiguration implements 
StorageContainerConfiguration {
+    
+    @Override
+    public String[] getCommands() {
+        return new String[0];
+    }
+    
+    @Override
+    public Map<String, String> getEnvs() {
+        return ImmutableMap.<String, String>builder().put("GS_PASSWORD", 
"Test@123").build();
+    }
+    
+    @Override
+    public Map<String, String> getResourceMappings() {
+        return ImmutableMap.<String, String>builder()
+                .put("/env/postgresql/postgresql.conf", 
"/usr/local/opengauss/share/postgresql/postgresql.conf.sample")
+                .put("/env/opengauss/pg_hba.conf", 
"/usr/local/opengauss/share/postgresql/pg_hba.conf.sample").build();
+    }
+}
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/postgresql/DefaultPostgreSQLContainerConfiguration.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/postgresql/DefaultPostgreSQLContainerConfiguration.java
new file mode 100644
index 00000000000..bca03af2de2
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/postgresql/DefaultPostgreSQLContainerConfiguration.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.postgresql;
+
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
+
+import java.util.Collections;
+import java.util.Map;
+
+public class DefaultPostgreSQLContainerConfiguration implements 
StorageContainerConfiguration {
+    
+    @Override
+    public String[] getCommands() {
+        String[] commands = new String[1];
+        commands[0] = "-c config_file=/etc/postgresql/postgresql.conf";
+        return commands;
+    }
+    
+    @Override
+    public Map<String, String> getEnvs() {
+        return Collections.singletonMap("POSTGRES_PASSWORD", "Test@123");
+    }
+    
+    @Override
+    public Map<String, String> getResourceMappings() {
+        return Collections.singletonMap("/env/postgresql/postgresql.conf", 
"/etc/postgresql/postgresql.conf");
+    }
+}
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/MySQLContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/MySQLContainer.java
index bf84a6daff0..942125d96ef 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/MySQLContainer.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/MySQLContainer.java
@@ -20,7 +20,7 @@ package 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.
 import com.google.common.base.Strings;
 import org.apache.shardingsphere.infra.database.type.DatabaseTypeFactory;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.DockerStorageContainer;
-import org.testcontainers.containers.BindMode;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
 
 import java.util.Optional;
 
@@ -29,17 +29,18 @@ import java.util.Optional;
  */
 public final class MySQLContainer extends DockerStorageContainer {
     
-    public MySQLContainer(final String dockerImageName, final String scenario) 
{
+    private final StorageContainerConfiguration storageContainerConfiguration;
+    
+    public MySQLContainer(final String dockerImageName, final String scenario, 
final StorageContainerConfiguration storageContainerConfiguration) {
         super(DatabaseTypeFactory.getInstance("MySQL"), 
Strings.isNullOrEmpty(dockerImageName) ? "mysql/mysql-server:5.7" : 
dockerImageName, scenario);
+        this.storageContainerConfiguration = storageContainerConfiguration;
     }
     
     @Override
     protected void configure() {
-        // TODO need auto set server-id by generator, now always set server-id 
to 1
-        setCommand("--server-id=1");
-        addEnv("LANG", "C.UTF-8");
-        addEnv("MYSQL_RANDOM_ROOT_PASSWORD", "yes");
-        withClasspathResourceMapping("/env/mysql/my.cnf", "/etc/mysql/my.cnf", 
BindMode.READ_ONLY);
+        setCommands(storageContainerConfiguration.getCommands());
+        addEnvs(storageContainerConfiguration.getEnvs());
+        mapResources(storageContainerConfiguration.getResourceMappings());
         super.configure();
     }
     
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/OpenGaussContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/OpenGaussContainer.java
index 5cce5d88323..12bcd78d0b6 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/OpenGaussContainer.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/OpenGaussContainer.java
@@ -20,7 +20,7 @@ package 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.
 import com.google.common.base.Strings;
 import org.apache.shardingsphere.infra.database.type.DatabaseTypeFactory;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.DockerStorageContainer;
-import org.testcontainers.containers.BindMode;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
 
 import java.util.Optional;
 
@@ -29,15 +29,18 @@ import java.util.Optional;
  */
 public final class OpenGaussContainer extends DockerStorageContainer {
     
-    public OpenGaussContainer(final String dockerImageName, final String 
scenario) {
+    private final StorageContainerConfiguration storageContainerConfiguration;
+    
+    public OpenGaussContainer(final String dockerImageName, final String 
scenario, final StorageContainerConfiguration storageContainerConfiguration) {
         super(DatabaseTypeFactory.getInstance("openGauss"), 
Strings.isNullOrEmpty(dockerImageName) ? "enmotech/opengauss:3.0.0" : 
dockerImageName, scenario);
+        this.storageContainerConfiguration = storageContainerConfiguration;
     }
     
     @Override
     protected void configure() {
-        addEnv("GS_PASSWORD", getUnifiedPassword());
-        withClasspathResourceMapping("/env/postgresql/postgresql.conf", 
"/usr/local/opengauss/share/postgresql/postgresql.conf.sample", 
BindMode.READ_ONLY);
-        withClasspathResourceMapping("/env/opengauss/pg_hba.conf", 
"/usr/local/opengauss/share/postgresql/pg_hba.conf.sample", BindMode.READ_ONLY);
+        setCommands(storageContainerConfiguration.getCommands());
+        addEnvs(storageContainerConfiguration.getEnvs());
+        mapResources(storageContainerConfiguration.getResourceMappings());
         withPrivilegedMode(true);
         super.configure();
     }
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/PostgreSQLContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/PostgreSQLContainer.java
index d32a67b9bf6..0b31b805dfe 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/PostgreSQLContainer.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/PostgreSQLContainer.java
@@ -20,7 +20,7 @@ package 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.
 import com.google.common.base.Strings;
 import org.apache.shardingsphere.infra.database.type.DatabaseTypeFactory;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.DockerStorageContainer;
-import org.testcontainers.containers.BindMode;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
 
 import java.util.Optional;
 
@@ -29,15 +29,18 @@ import java.util.Optional;
  */
 public final class PostgreSQLContainer extends DockerStorageContainer {
     
-    public PostgreSQLContainer(final String dockerImageName, final String 
scenario) {
+    private final StorageContainerConfiguration storageContainerConfiguration;
+    
+    public PostgreSQLContainer(final String dockerImageName, final String 
scenario, final StorageContainerConfiguration storageContainerConfiguration) {
         super(DatabaseTypeFactory.getInstance("PostgreSQL"), 
Strings.isNullOrEmpty(dockerImageName) ? "postgres:12-alpine" : 
dockerImageName, scenario);
+        this.storageContainerConfiguration = storageContainerConfiguration;
     }
     
     @Override
     protected void configure() {
-        addEnv("POSTGRES_PASSWORD", getUnifiedPassword());
-        withClasspathResourceMapping("/env/postgresql/postgresql.conf", 
"/etc/postgresql/postgresql.conf", BindMode.READ_ONLY);
-        setCommand("-c config_file=/etc/postgresql/postgresql.conf");
+        setCommands(storageContainerConfiguration.getCommands());
+        addEnvs(storageContainerConfiguration.getEnvs());
+        mapResources(storageContainerConfiguration.getResourceMappings());
         super.configure();
     }
     
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/01-initdb.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/01-initdb.sql
deleted file mode 100644
index 6c95fe0c2ba..00000000000
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/01-initdb.sql
+++ /dev/null
@@ -1,25 +0,0 @@
---
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements.  See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to You under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License.  You may obtain a copy of the License at
---
---     http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
---
-
-CREATE DATABASE scaling_it_0;
-CREATE DATABASE scaling_it_1;
-CREATE DATABASE scaling_it_2;
-CREATE DATABASE scaling_it_3;
-CREATE DATABASE scaling_it_4;
-
-GRANT REPLICATION CLIENT, REPLICATION SLAVE, SELECT, INSERT, UPDATE, DELETE, 
INDEX ON *.* TO `test_user`@`%`;
-GRANT CREATE, DROP ON TABLE *.* TO test_user;
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/my.cnf
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/my.cnf
deleted file mode 100644
index 6d55640b7b2..00000000000
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/my.cnf
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-[mysql]
-
-[mysqld]
-log-bin=mysql-bin
-binlog-format=row
-binlog-row-image=full
-max_connections=600
-default-authentication-plugin=mysql_native_password
-sql_mode=
-lower_case_table_names=1
-# for mysql 8.0
-secure_file_priv=/var/lib/mysql
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/server-5.yaml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/server-5.yaml
deleted file mode 100644
index 4f15db8bae5..00000000000
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/server-5.yaml
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-mode:
-  type: Cluster
-  repository:
-    type: ZooKeeper
-    props:
-      namespace: it_db_mysql
-      server-lists: zk.host:2181
-      timeToLiveSeconds: 60
-      operationTimeoutMilliseconds: 500
-      retryIntervalMilliseconds: 500
-      maxRetries: 3
-  overwrite: false
-
-rules:
-  - !AUTHORITY
-    users:
-      - proxy@:Proxy@123
-    provider:
-      type: ALL_PERMITTED
-
-props:
-  max-connections-size-per-query: 1
-  kernel-executor-size: 16  # Infinite by default.
-  proxy-frontend-flush-threshold: 128  # The default value is 128.
-  proxy-hint-enabled: true
-  sql-show: true
-  sql-federation-enabled: true
-  proxy-mysql-default-version: 5.7.22 
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/server-8.yaml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/server-8.yaml
deleted file mode 100644
index 732f4c4c599..00000000000
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/mysql/server-8.yaml
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-mode:
-  type: Cluster
-  repository:
-    type: ZooKeeper
-    props:
-      namespace: it_db_mysql
-      server-lists: zk.host:2181
-      timeToLiveSeconds: 60
-      operationTimeoutMilliseconds: 500
-      retryIntervalMilliseconds: 500
-      maxRetries: 3
-  overwrite: false
-
-rules:
-  - !AUTHORITY
-    users:
-      - proxy@:Proxy@123
-    provider:
-      type: ALL_PERMITTED
-
-props:
-  max-connections-size-per-query: 1
-  kernel-executor-size: 16  # Infinite by default.
-  proxy-frontend-flush-threshold: 128  # The default value is 128.
-  proxy-hint-enabled: true
-  sql-show: true
-  sql-federation-enabled: true
-  proxy-mysql-default-version: 8.0.11
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/postgresql/01-initdb.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/postgresql/01-initdb.sql
deleted file mode 100644
index bd8f263008e..00000000000
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/postgresql/01-initdb.sql
+++ /dev/null
@@ -1,28 +0,0 @@
---
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements.  See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to You under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License.  You may obtain a copy of the License at
---
---     http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-CREATE DATABASE scaling_it_0;
-CREATE DATABASE scaling_it_1;
-CREATE DATABASE scaling_it_2;
-CREATE DATABASE scaling_it_3;
-CREATE DATABASE scaling_it_4;
-CREATE DATABASE scaling;
-
-GRANT CREATE, CONNECT ON DATABASE scaling_it_0 TO test_user;
-GRANT CREATE, CONNECT ON DATABASE scaling_it_1 TO test_user;
-GRANT CREATE, CONNECT ON DATABASE scaling_it_2 TO test_user;
-GRANT CREATE, CONNECT ON DATABASE scaling_it_3 TO test_user;
-GRANT CREATE, CONNECT ON DATABASE scaling_it_4 TO test_user;
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/postgresql/postgresql.conf
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/postgresql/postgresql.conf
deleted file mode 100644
index 9d432a4cab4..00000000000
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/postgresql/postgresql.conf
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-listen_addresses = '*'
-wal_level = logical
-max_connections = 600
-max_replication_slots = 10
-log_timezone = 'Asia/Shanghai'
-datestyle = 'iso, mdy'
-timezone = 'Asia/Shanghai'
-wal_sender_timeout = 0
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/postgresql/server.yaml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/postgresql/server.yaml
deleted file mode 100644
index 6836217929f..00000000000
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/env/scaling/postgresql/server.yaml
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-mode:
-  type: Cluster
-  repository:
-    type: ZooKeeper
-    props:
-      namespace: it_db_postgresql
-      server-lists: zk.host:2181
-      retryIntervalMilliseconds: 500
-      timeToLiveSeconds: 60
-      maxRetries: 3
-      operationTimeoutMilliseconds: 500
-  overwrite: true
-
-rules:
-  - !AUTHORITY
-    users:
-      - proxy@:Proxy@123
-      - sharding@:sharding
-    provider:
-      type: ALL_PERMITTED
-
-props:
-  max-connections-size-per-query: 1
-  kernel-executor-size: 16  # Infinite by default.
-  proxy-frontend-flush-threshold: 128  # The default value is 128.
-  proxy-hint-enabled: false
-  sql-show: true
-  check-table-metadata-enabled: false
-  # Proxy backend query fetch size. A larger value may increase the memory 
usage of ShardingSphere Proxy.
-  # The default value is -1, which means set the minimum value for different 
JDBC drivers.
-  proxy-backend-query-fetch-size: -1
-  proxy-frontend-executor-size: 0 # Proxy frontend executor size. The default 
value is 0, which means let Netty decide.
-  # Available options of proxy backend executor suitable: OLAP(default), OLTP. 
The OLTP option may reduce time cost of writing packets to client, but it may 
increase the latency of SQL execution
-  # and block other clients if client connections are more than 
`proxy-frontend-executor-size`, especially executing slow SQL.
-  proxy-backend-executor-suitable: OLAP
-  proxy-frontend-max-connections: 0 # Less than or equal to 0 means no 
limitation.
-  sql-federation-enabled: false
-  # Available proxy backend driver type: JDBC (default), ExperimentalVertx
-  proxy-backend-driver-type: JDBC
-  proxy-frontend-database-protocol-type: PostgreSQL
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/CreateTableSQLGeneratorIT.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/CreateTableSQLGeneratorIT.java
index ce3f86cff4a..6ec2bc295d7 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/CreateTableSQLGeneratorIT.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/CreateTableSQLGeneratorIT.java
@@ -27,6 +27,7 @@ import 
org.apache.shardingsphere.integration.data.pipeline.cases.entity.CreateTa
 import 
org.apache.shardingsphere.integration.data.pipeline.cases.entity.CreateTableSQLGeneratorOutputEntity;
 import 
org.apache.shardingsphere.integration.data.pipeline.env.IntegrationTestEnvironment;
 import 
org.apache.shardingsphere.integration.data.pipeline.env.enums.ScalingITEnvTypeEnum;
+import 
org.apache.shardingsphere.integration.data.pipeline.framework.comtaner.config.ScalingStorageContainerConfigurationFactory;
 import 
org.apache.shardingsphere.integration.data.pipeline.framework.param.ScalingParameterized;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.DockerStorageContainer;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.StorageContainerFactory;
@@ -79,7 +80,8 @@ public final class CreateTableSQLGeneratorIT {
         this.parameterized = parameterized;
         rootEntity = JAXB.unmarshal(
                 
Objects.requireNonNull(CreateTableSQLGeneratorIT.class.getClassLoader().getResource(parameterized.getScenario())),
 CreateTableSQLGeneratorAssertionsRootEntity.class);
-        storageContainer = (DockerStorageContainer) 
StorageContainerFactory.newInstance(parameterized.getDatabaseType(), 
parameterized.getDockerImageName(), "");
+        storageContainer = (DockerStorageContainer) 
StorageContainerFactory.newInstance(parameterized.getDatabaseType(), 
parameterized.getDockerImageName(), "",
+                
ScalingStorageContainerConfigurationFactory.newInstance(parameterized.getDatabaseType(),
 ""));
         storageContainer.start();
     }
     
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/comtaner/config/ScalingStorageContainerConfigurationFactory.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/comtaner/config/ScalingStorageContainerConfigurationFactory.java
new file mode 100644
index 00000000000..3e62f6c29ad
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/comtaner/config/ScalingStorageContainerConfigurationFactory.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package 
org.apache.shardingsphere.integration.data.pipeline.framework.comtaner.config;
+
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import 
org.apache.shardingsphere.integration.data.pipeline.framework.comtaner.config.impl.mysql.ScalingMySQLContainerConfiguration;
+import 
org.apache.shardingsphere.integration.data.pipeline.framework.comtaner.config.impl.postgresql.ScalingPostgreSQLContainerConfiguration;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.mysql.DefaultMySQLContainerConfiguration;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.opengauss.DefaultOpenGaussContainerConfiguration;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.postgresql.DefaultPostgreSQLContainerConfiguration;
+
+public final class ScalingStorageContainerConfigurationFactory {
+    
+    /**
+     * Create new instance of storage container.
+     *
+     * @param databaseType database type
+     * @param scenario scenario
+     * @return created instance
+     */
+    public static StorageContainerConfiguration newInstance(final DatabaseType 
databaseType, final String scenario) {
+        switch (databaseType.getType()) {
+            case "MySQL":
+                if ("default".equalsIgnoreCase(scenario)) {
+                    return new DefaultMySQLContainerConfiguration();
+                }
+                if ("".equalsIgnoreCase(scenario)) {
+                    return new ScalingMySQLContainerConfiguration();
+                }
+                return new DefaultMySQLContainerConfiguration();
+            case "PostgreSQL":
+                if ("default".equalsIgnoreCase(scenario)) {
+                    return new DefaultPostgreSQLContainerConfiguration();
+                }
+                if ("".equalsIgnoreCase(scenario)) {
+                    return new ScalingPostgreSQLContainerConfiguration();
+                }
+                return new DefaultPostgreSQLContainerConfiguration();
+            case "openGauss":
+                return new DefaultOpenGaussContainerConfiguration();
+            default:
+                throw new RuntimeException(String.format("Database `%s` is 
unknown.", databaseType.getType()));
+        }
+    }
+}
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/comtaner/config/impl/mysql/ScalingMySQLContainerConfiguration.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/comtaner/config/impl/mysql/ScalingMySQLContainerConfiguration.java
new file mode 100644
index 00000000000..ba63237b883
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/comtaner/config/impl/mysql/ScalingMySQLContainerConfiguration.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package 
org.apache.shardingsphere.integration.data.pipeline.framework.comtaner.config.impl.mysql;
+
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.mysql.DefaultMySQLContainerConfiguration;
+
+import java.util.Collections;
+import java.util.Map;
+
+/**
+ * Scaling mysql container configuration.
+ */
+public final class ScalingMySQLContainerConfiguration implements 
StorageContainerConfiguration {
+    
+    @Override
+    public String[] getCommands() {
+        return new DefaultMySQLContainerConfiguration().getCommands();
+    }
+    
+    @Override
+    public Map<String, String> getEnvs() {
+        return new DefaultMySQLContainerConfiguration().getEnvs();
+    }
+    
+    @Override
+    public Map<String, String> getResourceMappings() {
+        return Collections.singletonMap("/env/mysql/my.cnf", 
"/etc/mysql/my.cnf");
+    }
+}
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/comtaner/config/impl/postgresql/ScalingPostgreSQLContainerConfiguration.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/comtaner/config/impl/postgresql/ScalingPostgreSQLContainerConfigu
 [...]
new file mode 100644
index 00000000000..0bcfbc5418f
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/comtaner/config/impl/postgresql/ScalingPostgreSQLContainerConfiguration.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package 
org.apache.shardingsphere.integration.data.pipeline.framework.comtaner.config.impl.postgresql;
+
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.postgresql.DefaultPostgreSQLContainerConfiguration;
+
+import java.util.Collections;
+import java.util.Map;
+
+/**
+ * Scaling postgresql container configuration.
+ */
+public final class ScalingPostgreSQLContainerConfiguration implements 
StorageContainerConfiguration {
+    
+    @Override
+    public String[] getCommands() {
+        return new DefaultPostgreSQLContainerConfiguration().getCommands();
+    }
+    
+    @Override
+    public Map<String, String> getEnvs() {
+        return new DefaultPostgreSQLContainerConfiguration().getEnvs();
+    }
+    
+    @Override
+    public Map<String, String> getResourceMappings() {
+        return Collections.singletonMap("/env/postgresql/postgresql.conf", 
"/etc/postgresql/postgresql.conf");
+    }
+}
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/DockerComposedContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/DockerComposedContainer.java
index ea575af8952..70b104f94c0 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/DockerComposedContainer.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/DockerComposedContainer.java
@@ -19,6 +19,7 @@ package 
org.apache.shardingsphere.integration.data.pipeline.framework.container.
 
 import lombok.Getter;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import 
org.apache.shardingsphere.integration.data.pipeline.framework.comtaner.config.ScalingStorageContainerConfigurationFactory;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.AdapterContainerFactory;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.impl.ShardingSphereProxyClusterContainer;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.governance.GovernanceContainer;
@@ -45,7 +46,8 @@ public final class DockerComposedContainer extends 
BaseComposedContainer {
     public DockerComposedContainer(final DatabaseType databaseType, final 
String dockerImageName) {
         this.databaseType = databaseType;
         governanceContainer = getContainers().registerContainer(new 
ZookeeperContainer());
-        storageContainer = 
getContainers().registerContainer((DockerStorageContainer) 
StorageContainerFactory.newInstance(databaseType, dockerImageName, ""));
+        storageContainer = 
getContainers().registerContainer((DockerStorageContainer) 
StorageContainerFactory.newInstance(databaseType, dockerImageName,
+                "", 
ScalingStorageContainerConfigurationFactory.newInstance(databaseType, "")));
         ShardingSphereProxyClusterContainer proxyClusterContainer =
                 (ShardingSphereProxyClusterContainer) 
AdapterContainerFactory.newInstance("Cluster", "proxy", databaseType, 
storageContainer, "", "scaling");
         proxyClusterContainer.dependsOn(governanceContainer, storageContainer);
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/postgresql/server.yaml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/postgresql/server.yaml
index 7d6926a0f67..6836217929f 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/postgresql/server.yaml
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/postgresql/server.yaml
@@ -31,7 +31,7 @@ mode:
 rules:
   - !AUTHORITY
     users:
-      - root@:Root@123
+      - proxy@:Proxy@123
       - sharding@:sharding
     provider:
       type: ALL_PERMITTED
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/mode/ClusterComposedContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/mode/ClusterComposedContainer.java
index 81bee1a9ad6..e26eb7bedf7 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/mode/ClusterComposedContainer.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/mode/ClusterComposedContainer.java
@@ -17,6 +17,7 @@
 
 package org.apache.shardingsphere.test.integration.container.compose.mode;
 
+import 
org.apache.shardingsphere.test.integration.container.config.SuiteStorageContainerConfigurationFactory;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.DockerITContainer;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.ITContainers;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.AdapterContainer;
@@ -50,7 +51,8 @@ public final class ClusterComposedContainer implements 
ComposedContainer {
         // TODO support other types of governance
         governanceContainer = 
containers.registerContainer(GovernanceContainerFactory.newInstance("ZooKeeper"));
         // TODO add more version of databases
-        storageContainer = 
containers.registerContainer(StorageContainerFactory.newInstance(parameterizedArray.getDatabaseType(),
 "", scenario));
+        storageContainer = 
containers.registerContainer(StorageContainerFactory.newInstance(parameterizedArray.getDatabaseType(),
 "", scenario,
+                
SuiteStorageContainerConfigurationFactory.newInstance(parameterizedArray.getDatabaseType(),
 scenario)));
         AdapterContainer adapterContainer = 
AdapterContainerFactory.newInstance(
                 parameterizedArray.getMode(), parameterizedArray.getAdapter(), 
parameterizedArray.getDatabaseType(), storageContainer, scenario);
         if (adapterContainer instanceof DockerITContainer) {
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/mode/StandaloneComposedContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/mode/StandaloneComposedContainer.java
index c379f6dcdcd..4a052a37c19 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/mode/StandaloneComposedContainer.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/mode/StandaloneComposedContainer.java
@@ -17,13 +17,14 @@
 
 package org.apache.shardingsphere.test.integration.container.compose.mode;
 
+import 
org.apache.shardingsphere.test.integration.container.compose.ComposedContainer;
+import 
org.apache.shardingsphere.test.integration.container.config.SuiteStorageContainerConfigurationFactory;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.DockerITContainer;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.ITContainers;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.AdapterContainer;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.AdapterContainerFactory;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.StorageContainer;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.StorageContainerFactory;
-import 
org.apache.shardingsphere.test.integration.container.compose.ComposedContainer;
 import 
org.apache.shardingsphere.test.integration.framework.param.model.ParameterizedArray;
 
 import javax.sql.DataSource;
@@ -44,7 +45,8 @@ public final class StandaloneComposedContainer implements 
ComposedContainer {
         String scenario = parameterizedArray.getScenario();
         containers = new ITContainers(scenario);
         // TODO add more version of databases
-        storageContainer = 
containers.registerContainer(StorageContainerFactory.newInstance(parameterizedArray.getDatabaseType(),
 "", scenario));
+        storageContainer = 
containers.registerContainer(StorageContainerFactory.newInstance(parameterizedArray.getDatabaseType(),
 "", scenario,
+                
SuiteStorageContainerConfigurationFactory.newInstance(parameterizedArray.getDatabaseType(),
 scenario)));
         adapterContainer = containers.registerContainer(
                 
AdapterContainerFactory.newInstance(parameterizedArray.getMode(), 
parameterizedArray.getAdapter(), parameterizedArray.getDatabaseType(), 
storageContainer, scenario));
         if (adapterContainer instanceof DockerITContainer) {
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/StorageContainerFactory.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/config/SuiteStorageContainerConfigurationFactory.java
similarity index 60%
copy from 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/StorageContainerFactory.java
copy to 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/config/SuiteStorageContainerConfigurationFactory.java
index a132967c3a1..72f07f9949e 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/StorageContainerFactory.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/config/SuiteStorageContainerConfigurationFactory.java
@@ -15,40 +15,39 @@
  * limitations under the License.
  */
 
-package 
org.apache.shardingsphere.test.integration.env.container.atomic.storage;
+package org.apache.shardingsphere.test.integration.container.config;
 
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.impl.H2Container;
-import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.impl.MySQLContainer;
-import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.impl.OpenGaussContainer;
-import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.impl.PostgreSQLContainer;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.mysql.DefaultMySQLContainerConfiguration;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.opengauss.DefaultOpenGaussContainerConfiguration;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.postgresql.DefaultPostgreSQLContainerConfiguration;
 
-/**
- * Storage container factory.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class StorageContainerFactory {
+public class SuiteStorageContainerConfigurationFactory {
     
     /**
      * Create new instance of storage container.
-     * 
+     *
      * @param databaseType database type
-     * @param dockerImageName docker image name
      * @param scenario scenario
      * @return created instance
      */
-    public static StorageContainer newInstance(final DatabaseType 
databaseType, final String dockerImageName, final String scenario) {
+    public static StorageContainerConfiguration newInstance(final DatabaseType 
databaseType, final String scenario) {
         switch (databaseType.getType()) {
             case "MySQL":
-                return new MySQLContainer(dockerImageName, scenario);
+                if ("default".equalsIgnoreCase(scenario)) {
+                    return new DefaultMySQLContainerConfiguration();
+                }
+                return new DefaultMySQLContainerConfiguration();
             case "PostgreSQL":
-                return new PostgreSQLContainer(dockerImageName, scenario);
+                if ("default".equalsIgnoreCase(scenario)) {
+                    return new DefaultPostgreSQLContainerConfiguration();
+                }
+                return new DefaultPostgreSQLContainerConfiguration();
             case "openGauss":
-                return new OpenGaussContainer(dockerImageName, scenario);
+                return new DefaultOpenGaussContainerConfiguration();
             case "H2":
-                return new H2Container(scenario);
+                return null;
             default:
                 throw new RuntimeException(String.format("Database `%s` is 
unknown.", databaseType.getType()));
         }

Reply via email to