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

jianglongtao 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 fff91eaaefb Reuse in-env's container in scaling IT (#19490)
fff91eaaefb is described below

commit fff91eaaefb39754ab7a087e404a05441f35dfff
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Jul 23 23:37:17 2022 +0800

    Reuse in-env's container in scaling IT (#19490)
    
    * Reuse in-env's container in scaling IT
    
    * Fix DatabaseContainerFactory
    
    * Fix DatabaseContainerFactory
    
    * Fix DatabaseContainerFactory
    
    * Remove DatabaseContainer in scaling IT
---
 .../atomic/storage/DockerStorageContainer.java     | 11 +--
 .../data/pipeline/cases/base/BaseITCase.java       | 15 ++--
 .../cases/general/CreateTableSQLGeneratorIT.java   | 22 +++---
 .../pipeline/factory/DatabaseContainerFactory.java | 18 ++---
 .../container/compose/DockerComposedContainer.java | 10 +--
 .../container/database/DatabaseContainer.java      | 65 -----------------
 .../container/database/MySQLContainer.java         | 78 --------------------
 .../container/database/OpenGaussContainer.java     | 83 ----------------------
 .../container/database/PostgreSQLContainer.java    | 80 ---------------------
 9 files changed, 39 insertions(+), 343 deletions(-)

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 94d92e2b868..b6049861121 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
@@ -19,6 +19,7 @@ package 
org.apache.shardingsphere.test.integration.env.container.atomic.storage;
 
 import com.google.common.base.Strings;
 import com.zaxxer.hikari.HikariDataSource;
+import lombok.AccessLevel;
 import lombok.Getter;
 import lombok.SneakyThrows;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
@@ -41,16 +42,16 @@ import java.util.Optional;
 /**
  * Docker storage container.
  */
+@Getter
 public abstract class DockerStorageContainer extends DockerITContainer 
implements StorageContainer {
     
     private final DatabaseType databaseType;
     
+    @Getter(AccessLevel.NONE)
     private final String scenario;
     
-    @Getter
     private final Map<String, DataSource> actualDataSourceMap;
     
-    @Getter
     private final Map<String, DataSource> expectedDataSourceMap;
     
     public DockerStorageContainer(final DatabaseType databaseType, final 
String dockerImageName, final String scenario) {
@@ -80,8 +81,10 @@ public abstract class DockerStorageContainer extends 
DockerITContainer implement
     @Override
     @SneakyThrows({IOException.class, JAXBException.class})
     protected void postStart() {
-        DatabaseEnvironmentManager.getDatabaseNames(scenario).forEach(each -> 
actualDataSourceMap.put(each, createDataSource(each)));
-        
DatabaseEnvironmentManager.getExpectedDatabaseNames(scenario).forEach(each -> 
expectedDataSourceMap.put(each, createDataSource(each)));
+        if (!Strings.isNullOrEmpty(scenario)) {
+            DatabaseEnvironmentManager.getDatabaseNames(scenario).forEach(each 
-> actualDataSourceMap.put(each, createDataSource(each)));
+            
DatabaseEnvironmentManager.getExpectedDatabaseNames(scenario).forEach(each -> 
expectedDataSourceMap.put(each, createDataSource(each)));
+        }
     }
     
     private DataSource createDataSource(final String dataSourceName) {
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java
index a9ab656cddb..869a66dbfa6 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java
@@ -35,11 +35,11 @@ import 
org.apache.shardingsphere.integration.data.pipeline.env.enums.ScalingITEn
 import 
org.apache.shardingsphere.integration.data.pipeline.framework.container.compose.BaseComposedContainer;
 import 
org.apache.shardingsphere.integration.data.pipeline.framework.container.compose.DockerComposedContainer;
 import 
org.apache.shardingsphere.integration.data.pipeline.framework.container.compose.NativeComposedContainer;
-import 
org.apache.shardingsphere.integration.data.pipeline.framework.container.database.DatabaseContainer;
 import 
org.apache.shardingsphere.integration.data.pipeline.framework.helper.ScalingCaseHelper;
 import 
org.apache.shardingsphere.integration.data.pipeline.framework.param.ScalingParameterized;
 import 
org.apache.shardingsphere.integration.data.pipeline.framework.watcher.ScalingWatcher;
 import 
org.apache.shardingsphere.integration.data.pipeline.util.DatabaseTypeUtil;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.DockerStorageContainer;
 import 
org.apache.shardingsphere.test.integration.env.runtime.DataSourceEnvironment;
 import org.junit.Rule;
 import org.opengauss.util.PSQLException;
@@ -118,9 +118,9 @@ public abstract class BaseITCase {
         }
         composedContainer.start();
         if (ENV.getItEnvType() == ScalingITEnvTypeEnum.DOCKER) {
-            DatabaseContainer databaseContainer = ((DockerComposedContainer) 
composedContainer).getDatabaseContainer();
-            username = databaseContainer.getUsername();
-            password = databaseContainer.getPassword();
+            DockerStorageContainer storageContainer = 
((DockerComposedContainer) composedContainer).getStorageContainer();
+            username = storageContainer.getTestCaseUsername();
+            password = storageContainer.getTestCasePassword();
         } else {
             username = ENV.getActualDataSourceUsername(databaseType);
             password = ENV.getActualDataSourcePassword(databaseType);
@@ -230,11 +230,10 @@ public abstract class BaseITCase {
     
     private String getActualJdbcUrlTemplate(final String databaseName) {
         if (ScalingITEnvTypeEnum.DOCKER == ENV.getItEnvType()) {
-            final DatabaseContainer databaseContainer = 
((DockerComposedContainer) composedContainer).getDatabaseContainer();
-            return DataSourceEnvironment.getURL(getDatabaseType(), 
getDatabaseType().getType().toLowerCase() + ".host", 
databaseContainer.getPort(), databaseName);
-        } else {
-            return DataSourceEnvironment.getURL(getDatabaseType(), 
"127.0.0.1", ENV.getActualDataSourceDefaultPort(databaseType), databaseName);
+            DockerStorageContainer storageContainer = 
((DockerComposedContainer) composedContainer).getStorageContainer();
+            return DataSourceEnvironment.getURL(getDatabaseType(), 
getDatabaseType().getType().toLowerCase() + ".host", 
storageContainer.getPort(), databaseName);
         }
+        return DataSourceEnvironment.getURL(getDatabaseType(), "127.0.0.1", 
ENV.getActualDataSourceDefaultPort(databaseType), databaseName);
     }
     
     protected void initShardingAlgorithm() {
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 5b7919aca91..46ad046e916 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
@@ -29,8 +29,8 @@ import 
org.apache.shardingsphere.integration.data.pipeline.cases.entity.CreateTa
 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.factory.DatabaseContainerFactory;
-import 
org.apache.shardingsphere.integration.data.pipeline.framework.container.database.DatabaseContainer;
 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.runtime.DataSourceEnvironment;
 import org.junit.After;
 import org.junit.Test;
@@ -71,7 +71,7 @@ public final class CreateTableSQLGeneratorIT {
     
     private static final IntegrationTestEnvironment ENV = 
IntegrationTestEnvironment.getInstance();
     
-    private final DatabaseContainer databaseContainer;
+    private final DockerStorageContainer storageContainer;
     
     private final ScalingParameterized parameterized;
     
@@ -79,10 +79,10 @@ public final class CreateTableSQLGeneratorIT {
     
     public CreateTableSQLGeneratorIT(final ScalingParameterized parameterized) 
{
         this.parameterized = parameterized;
-        this.rootEntity = 
JAXB.unmarshal(Objects.requireNonNull(CreateTableSQLGeneratorIT.class.getClassLoader().getResource(parameterized.getScenario())),
-                CreateTableSQLGeneratorAssertionsRootEntity.class);
-        this.databaseContainer = 
DatabaseContainerFactory.newInstance(parameterized.getDatabaseType(), 
parameterized.getDockerImageName());
-        databaseContainer.start();
+        rootEntity = JAXB.unmarshal(
+                
Objects.requireNonNull(CreateTableSQLGeneratorIT.class.getClassLoader().getResource(parameterized.getScenario())),
 CreateTableSQLGeneratorAssertionsRootEntity.class);
+        storageContainer = 
DatabaseContainerFactory.newInstance(parameterized.getDatabaseType(), 
parameterized.getDockerImageName());
+        storageContainer.start();
     }
     
     @Parameters(name = "{0}")
@@ -127,10 +127,10 @@ public final class CreateTableSQLGeneratorIT {
     
     private DataSource createDataSource(final String databaseName) {
         HikariDataSource result = new HikariDataSource();
-        
result.setDriverClassName(DataSourceEnvironment.getDriverClassName(databaseContainer.getDatabaseType()));
-        result.setJdbcUrl(databaseContainer.getJdbcUrl(databaseName));
-        result.setUsername(databaseContainer.getUsername());
-        result.setPassword(databaseContainer.getPassword());
+        
result.setDriverClassName(DataSourceEnvironment.getDriverClassName(storageContainer.getDatabaseType()));
+        result.setJdbcUrl(storageContainer.getJdbcUrl(databaseName));
+        result.setUsername(storageContainer.getTestCaseUsername());
+        result.setPassword(storageContainer.getTestCasePassword());
         result.setMaximumPoolSize(2);
         result.setTransactionIsolation("TRANSACTION_READ_COMMITTED");
         return result;
@@ -158,6 +158,6 @@ public final class CreateTableSQLGeneratorIT {
     
     @After
     public void stopContainer() {
-        databaseContainer.stop();
+        storageContainer.stop();
     }
 }
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/factory/DatabaseContainerFactory.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/factory/DatabaseContainerFactory.java
index 754be6cafe3..e405f139c77 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/factory/DatabaseContainerFactory.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/factory/DatabaseContainerFactory.java
@@ -20,10 +20,10 @@ package 
org.apache.shardingsphere.integration.data.pipeline.factory;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import 
org.apache.shardingsphere.integration.data.pipeline.framework.container.database.DatabaseContainer;
-import 
org.apache.shardingsphere.integration.data.pipeline.framework.container.database.MySQLContainer;
-import 
org.apache.shardingsphere.integration.data.pipeline.framework.container.database.OpenGaussContainer;
-import 
org.apache.shardingsphere.integration.data.pipeline.framework.container.database.PostgreSQLContainer;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.DockerStorageContainer;
+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;
 
 /**
  * Storage container factory.
@@ -35,17 +35,17 @@ public final class DatabaseContainerFactory {
      * Create new instance of storage container.
      *
      * @param databaseType database type
-     * @param dockerImageName database ver
+     * @param dockerImageName database image name
      * @return created instance
      */
-    public static DatabaseContainer newInstance(final DatabaseType 
databaseType, final String dockerImageName) {
+    public static DockerStorageContainer newInstance(final DatabaseType 
databaseType, final String dockerImageName) {
         switch (databaseType.getType()) {
             case "MySQL":
-                return new MySQLContainer(dockerImageName);
+                return new MySQLContainer("", dockerImageName);
             case "PostgreSQL":
-                return new PostgreSQLContainer(dockerImageName);
+                return new PostgreSQLContainer("", dockerImageName);
             case "openGauss":
-                return new OpenGaussContainer(dockerImageName);
+                return new OpenGaussContainer("", dockerImageName);
             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/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 8be68d776e9..34fea654c0d 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
@@ -20,10 +20,10 @@ 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.factory.DatabaseContainerFactory;
-import 
org.apache.shardingsphere.integration.data.pipeline.framework.container.database.DatabaseContainer;
 import 
org.apache.shardingsphere.integration.data.pipeline.framework.container.proxy.ShardingSphereProxyDockerContainer;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.governance.GovernanceContainer;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.governance.impl.ZookeeperContainer;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.DockerStorageContainer;
 import 
org.apache.shardingsphere.test.integration.env.runtime.DataSourceEnvironment;
 
 /**
@@ -36,16 +36,16 @@ public final class DockerComposedContainer extends 
BaseComposedContainer {
     private final ShardingSphereProxyDockerContainer proxyContainer;
     
     @Getter
-    private final DatabaseContainer databaseContainer;
+    private final DockerStorageContainer storageContainer;
     
     public DockerComposedContainer(final DatabaseType databaseType, final 
String dockerImageName) {
         this.databaseType = databaseType;
         GovernanceContainer governanceContainer = 
getContainers().registerContainer(new ZookeeperContainer());
-        databaseContainer = 
getContainers().registerContainer(DatabaseContainerFactory.newInstance(databaseType,
 dockerImageName));
+        storageContainer = 
getContainers().registerContainer(DatabaseContainerFactory.newInstance(databaseType,
 dockerImageName));
         ShardingSphereProxyDockerContainer proxyContainer = new 
ShardingSphereProxyDockerContainer(databaseType);
-        proxyContainer.dependsOn(governanceContainer, databaseContainer);
+        proxyContainer.dependsOn(governanceContainer, storageContainer);
         ShardingSphereProxyDockerContainer anotherProxyContainer = new 
ShardingSphereProxyDockerContainer(databaseType);
-        anotherProxyContainer.dependsOn(governanceContainer, 
databaseContainer);
+        anotherProxyContainer.dependsOn(governanceContainer, storageContainer);
         this.proxyContainer = 
getContainers().registerContainer(proxyContainer);
         getContainers().registerContainer(anotherProxyContainer);
     }
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/DatabaseContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/DatabaseContainer.java
deleted file mode 100644
index 79a37d4c74b..00000000000
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/DatabaseContainer.java
+++ /dev/null
@@ -1,65 +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.
- */
-
-package 
org.apache.shardingsphere.integration.data.pipeline.framework.container.database;
-
-import lombok.Getter;
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import 
org.apache.shardingsphere.test.integration.env.container.atomic.DockerITContainer;
-
-/**
- * Docker storage container.
- */
-@Getter
-public abstract class DatabaseContainer extends DockerITContainer {
-    
-    private final DatabaseType databaseType;
-    
-    public DatabaseContainer(final DatabaseType databaseType, final String 
dockerImageName) {
-        super(databaseType.getType().toLowerCase(), dockerImageName);
-        this.databaseType = databaseType;
-    }
-    
-    /**
-     * Get jdbc url.
-     *
-     * @param databaseName database name
-     * @return jdbc url
-     */
-    public abstract String getJdbcUrl(String databaseName);
-    
-    /**
-     * Get root username.
-     *
-     * @return root username
-     */
-    public abstract String getUsername();
-    
-    /**
-     * Get root password.
-     *
-     * @return root username
-     */
-    public abstract String getPassword();
-    
-    /**
-     * Get database port.
-     *
-     * @return database port
-     */
-    public abstract int getPort();
-}
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/MySQLContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/MySQLContainer.java
deleted file mode 100644
index b572961543d..00000000000
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/MySQLContainer.java
+++ /dev/null
@@ -1,78 +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.
- */
-
-package 
org.apache.shardingsphere.integration.data.pipeline.framework.container.database;
-
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
-import 
org.apache.shardingsphere.test.integration.env.runtime.DataSourceEnvironment;
-import 
org.apache.shardingsphere.test.integration.env.container.wait.JDBCConnectionWaitStrategy;
-import org.testcontainers.containers.BindMode;
-
-import java.sql.DriverManager;
-
-public final class MySQLContainer extends DatabaseContainer {
-    
-    private static final DatabaseType DATABASE_TYPE = new MySQLDatabaseType();
-    
-    private final String username = "scaling";
-    
-    private final String password = "root";
-    
-    private final int port = 3306;
-    
-    public MySQLContainer(final String dockerImageName) {
-        super(DATABASE_TYPE, dockerImageName);
-    }
-    
-    @Override
-    protected void configure() {
-        withCommand("--sql_mode=", 
"--default-authentication-plugin=mysql_native_password", 
"--lower_case_table_names=1");
-        addEnv("LANG", "C.UTF-8");
-        addEnv("MYSQL_ROOT_PASSWORD", "root");
-        addEnv("MYSQL_ROOT_HOST", "%");
-        withClasspathResourceMapping("/env/mysql/my.cnf", "/etc/mysql/my.cnf", 
BindMode.READ_ONLY);
-        withClasspathResourceMapping("/env/mysql/initdb.sql", 
"/docker-entrypoint-initdb.d/", BindMode.READ_ONLY);
-        withExposedPorts(port);
-        setWaitStrategy(new JDBCConnectionWaitStrategy(() -> 
DriverManager.getConnection(DataSourceEnvironment.getURL(DATABASE_TYPE, 
"localhost", getFirstMappedPort()), username, password)));
-    }
-    
-    @Override
-    public String getJdbcUrl(final String databaseName) {
-        return DataSourceEnvironment.getURL(DATABASE_TYPE, getHost(), 
getFirstMappedPort(), databaseName);
-    }
-    
-    @Override
-    public String getUsername() {
-        return username;
-    }
-    
-    @Override
-    public String getPassword() {
-        return password;
-    }
-    
-    @Override
-    public int getPort() {
-        return port;
-    }
-    
-    @Override
-    public String getAbbreviation() {
-        return "mysql";
-    }
-}
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/OpenGaussContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/OpenGaussContainer.java
deleted file mode 100644
index 8ce01d11247..00000000000
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/OpenGaussContainer.java
+++ /dev/null
@@ -1,83 +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.
- */
-
-package 
org.apache.shardingsphere.integration.data.pipeline.framework.container.database;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import 
org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
-import 
org.apache.shardingsphere.test.integration.env.runtime.DataSourceEnvironment;
-import 
org.apache.shardingsphere.test.integration.env.container.wait.JDBCConnectionWaitStrategy;
-import org.testcontainers.containers.BindMode;
-
-import java.sql.DriverManager;
-
-/**
- * OpenGauss container for Scaling IT.
- */
-public final class OpenGaussContainer extends DatabaseContainer {
-    
-    private static final DatabaseType DATABASE_TYPE = new 
OpenGaussDatabaseType();
-    
-    private final String username = "scaling";
-    
-    private final String password = "Root@123";
-    
-    private final int port = 5432;
-    
-    public OpenGaussContainer(final String dockerImageName) {
-        super(DATABASE_TYPE, dockerImageName);
-    }
-    
-    @Override
-    protected void configure() {
-        withCommand("--max_connections=600");
-        addEnv("GS_PASSWORD", password);
-        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);
-        withClasspathResourceMapping("/env/opengauss/initdb.sql", 
"/docker-entrypoint-initdb.d/", BindMode.READ_ONLY);
-        withPrivilegedMode(true);
-        withExposedPorts(port);
-        setWaitStrategy(new JDBCConnectionWaitStrategy(() -> 
DriverManager.getConnection(DataSourceEnvironment.getURL(DATABASE_TYPE, 
"localhost", getFirstMappedPort(), "postgres"),
-                username, password)));
-    }
-    
-    @Override
-    public String getJdbcUrl(final String databaseName) {
-        return DataSourceEnvironment.getURL(DATABASE_TYPE, getHost(), 
getFirstMappedPort(), StringUtils.isBlank(databaseName) ? "postgres" : 
databaseName);
-    }
-    
-    @Override
-    public String getUsername() {
-        return username;
-    }
-    
-    @Override
-    public String getPassword() {
-        return password;
-    }
-    
-    @Override
-    public int getPort() {
-        return port;
-    }
-    
-    @Override
-    public String getAbbreviation() {
-        return "opengauss";
-    }
-}
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/PostgreSQLContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/PostgreSQLContainer.java
deleted file mode 100644
index 155a81c8002..00000000000
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/PostgreSQLContainer.java
+++ /dev/null
@@ -1,80 +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.
- */
-
-package 
org.apache.shardingsphere.integration.data.pipeline.framework.container.database;
-
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import 
org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
-import 
org.apache.shardingsphere.test.integration.env.container.wait.JDBCConnectionWaitStrategy;
-import 
org.apache.shardingsphere.test.integration.env.runtime.DataSourceEnvironment;
-import org.testcontainers.containers.BindMode;
-
-import java.sql.DriverManager;
-
-public final class PostgreSQLContainer extends DatabaseContainer {
-    
-    private static final DatabaseType DATABASE_TYPE = new 
PostgreSQLDatabaseType();
-    
-    private final String username = "scaling";
-    
-    private final String password = "root";
-    
-    private final int port = 5432;
-    
-    public PostgreSQLContainer(final String dockerImageName) {
-        super(DATABASE_TYPE, dockerImageName);
-    }
-    
-    @Override
-    protected void configure() {
-        withCommand("--max_connections=200", "--wal_level=logical");
-        String rootUsername = "root";
-        String rootPassword = "root";
-        addEnv("POSTGRES_USER", rootUsername);
-        addEnv("POSTGRES_PASSWORD", rootPassword);
-        withClasspathResourceMapping("/env/postgresql/postgresql.conf", 
"/etc/postgresql/postgresql.conf", BindMode.READ_ONLY);
-        withClasspathResourceMapping("/env/postgresql/initdb.sql", 
"/docker-entrypoint-initdb.d/", BindMode.READ_ONLY);
-        withExposedPorts(port);
-        setWaitStrategy(new JDBCConnectionWaitStrategy(() -> 
DriverManager.getConnection(DataSourceEnvironment.getURL(DATABASE_TYPE, 
"localhost", getFirstMappedPort(), "postgres"),
-                rootUsername, rootPassword)));
-    }
-    
-    @Override
-    public String getJdbcUrl(final String databaseName) {
-        return DataSourceEnvironment.getURL(DATABASE_TYPE, getHost(), 
getFirstMappedPort(), databaseName);
-    }
-    
-    @Override
-    public String getUsername() {
-        return username;
-    }
-    
-    @Override
-    public String getPassword() {
-        return password;
-    }
-    
-    @Override
-    public int getPort() {
-        return port;
-    }
-    
-    @Override
-    public String getAbbreviation() {
-        return "postgresql";
-    }
-}

Reply via email to