You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/06/30 11:38:36 UTC
[shardingsphere] branch master updated: Upgrade scaling native mode, support auto init and cleanup. (#18709)
This is an automated email from the ASF dual-hosted git repository.
zhonghongsheng 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 992d0bb07d7 Upgrade scaling native mode, support auto init and cleanup. (#18709)
992d0bb07d7 is described below
commit 992d0bb07d745be4bdc2d4013e700be9f5c99874
Author: azexcy <10...@users.noreply.github.com>
AuthorDate: Thu Jun 30 19:38:24 2022 +0800
Upgrade scaling native mode, support auto init and cleanup. (#18709)
---
.github/workflows/it-scaling.yml | 8 +-
.../test/scaling-integration-test/_index.cn.md | 18 +--
.../test/scaling-integration-test/_index.en.md | 18 +--
.../integration/env/DataSourceEnvironment.java | 2 +
.../pipeline/cases/base/BaseExtraSQLITCase.java | 5 +-
.../data/pipeline/cases/base/BaseITCase.java | 127 ++++++++++++++++-----
.../entity/JdbcInfoEntity.java} | 15 ++-
.../cases/general/MySQLGeneralScalingIT.java | 17 ++-
.../cases/general/PostgreSQLGeneralScalingIT.java | 26 +++--
.../cases/postgresql/PostgreSQLDDLGeneratorIT.java | 18 +--
.../cases/primarykey/TextPrimaryKeyScalingIT.java | 33 ++++--
.../pipeline/env/IntegrationTestEnvironment.java | 113 +++++++++++++++++-
...TEnvTypeEnum.java => ScalingITEnvTypeEnum.java} | 4 +-
.../pipeline/factory/DatabaseContainerFactory.java | 4 +-
.../container/compose/BaseComposedContainer.java | 11 +-
.../container/compose/DockerComposedContainer.java | 14 ++-
.../container/compose/NativeComposedContainer.java | 11 +-
...tabaseContainer.java => DatabaseContainer.java} | 28 +++--
.../container/database/MySQLContainer.java | 42 ++++---
.../container/database/OpenGaussContainer.java | 39 +++++--
.../container/database/PostgreSQLContainer.java | 39 +++++--
.../proxy/ShardingSphereProxyDockerContainer.java | 6 +-
.../framework/helper/ScalingCaseHelper.java | 15 +--
.../data/pipeline/logger/ScalingLoggerFilter.java | 2 +-
.../src/test/resources/env/it-env.properties | 27 +++--
.../src/test/resources/env/mysql/initdb.sql | 6 -
.../src/test/resources/env/mysql/server.yaml | 2 +-
.../src/test/resources/env/opengauss/initdb.sql | 22 ----
.../src/test/resources/env/opengauss/server.yaml | 2 +-
.../src/test/resources/env/postgresql/initdb.sql | 22 ----
.../src/test/resources/env/postgresql/server.yaml | 2 +-
31 files changed, 457 insertions(+), 241 deletions(-)
diff --git a/.github/workflows/it-scaling.yml b/.github/workflows/it-scaling.yml
index 12c5c33d0d6..bc74491105f 100644
--- a/.github/workflows/it-scaling.yml
+++ b/.github/workflows/it-scaling.yml
@@ -87,9 +87,9 @@ jobs:
- name: Build Scaling IT image
run: ./mvnw -B clean install -am -pl shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling -Pit.env.docker -DskipTests
- name: Run Scaling MySQL Integration Test
- run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/pom.xml -Dit.cluster.env.type=DOCKER -Dit.env.mysql.version=${{ env.mysql_version }}
+ run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/pom.xml -Dscaling.it.env.type=docker -Dscaling.it.docker.mysql.version=${{ env.mysql_version }}
- name: Run Scaling PostgreSQL Integration Test
- run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/pom.xml -Dit.cluster.env.type=DOCKER -Dit.env.postgresql.version=${{ env.postgresql_version }}
+ run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/pom.xml -Dscaling.it.env.type=docker -Dscaling.it.docker.postgresql.version=${{ env.postgresql_version }}
scaling-daily-it-test:
if: (github.event_name == 'schedule' && github.repository == 'apache/shardingsphere')
@@ -115,6 +115,6 @@ jobs:
- name: Build Scaling IT image
run: ./mvnw -B clean install -am -pl shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling -Pit.env.docker -DskipTests
- name: Run Scaling Daily MySQL Integration Test
- run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/pom.xml -Dit.cluster.env.type=DOCKER -Dit.env.mysql.version=${{ env.mysql_version }}
+ run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/pom.xml -Dscaling.it.env.type=docker -Dscaling.it.docker.mysql.version=${{ env.mysql_version }}
- name: Run Scaling Daily PostgreSQL Integration Test
- run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/pom.xml -Dit.cluster.env.type=DOCKER -Dit.env.postgresql.version=${{ env.postgresql_version }}
+ run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/pom.xml -Dscaling.it.env.type=docker -Dscaling.it.docker.postgresql.version=${{ env.postgresql_version }}
diff --git a/docs/document/content/reference/test/scaling-integration-test/_index.cn.md b/docs/document/content/reference/test/scaling-integration-test/_index.cn.md
index db2a58d3514..13c2cd9b92a 100644
--- a/docs/document/content/reference/test/scaling-integration-test/_index.cn.md
+++ b/docs/document/content/reference/test/scaling-integration-test/_index.cn.md
@@ -9,7 +9,7 @@ weight = 4
## 测试环境
-环境准备方式分为 Native 和 Docker,不论哪种环境,本地都需要预先安装 Docker。
+环境准备方式分为 Native 和 Docker
- Native 环境:用于本地调试,可以使用 IDE 的 debug 模式进行调试。
- Docker 环境:环境由 Maven 运行,适用于云编译环境和测试 ShardingSphere-Proxy 的场景,如:GitHub Action。
@@ -39,25 +39,25 @@ weight = 4
- /common: 存放 Scaling 过程中用到的 DistSQL。
- /{SQL-TYPE}: 存放数据库级别的配置文件。
- /scenario: 存放测试的场景的配置文件,主要是 SQL,不同数据库可能写法不一样。
+- it-env.properties:存放对应的配置信息。
### 运行测试引擎
所有的属性值都可以通过 Maven 命令行 `-D` 的方式动态注入。
`${image-name}` 表示合法 Docker image 名称,比如:mysql:5.7, 多个的话用逗号隔开。
-`-Dit.env.postgresql.version=${image-name}` 表示需要测试的 PostgreSQL 版本。
-`-Dit.env.mysql.version=${image-name}` 表示需要测试的 MySQL 版本。
+`-Dscaling.it.docker.postgresql.version=${image-name}` 表示需要测试的 PostgreSQL 版本。
+`-Dscaling.it.docker.mysql.version=${image-name}` 表示需要测试的 MySQL 版本。
#### Native 环境启动
-Native 环境要求本地自行启动 ShardingSphere-Proxy(以及其自身依赖的 Cluster,比如 Zookeeper),同时要求 ShardingSphere-Proxy 的端口是 3307,数据库会根据用户的配置自行启动,但是对应的端口都是数据库的默认端口(MySQL=3306, PostgreSQL=5432)。
-
-因此 Native 模式下不支持运行多个 Case,每次跑完需要自行清理 Zookeeper 中的信息,以及重启 ShardingSphere-Proxy。
+Native 环境要求本地自行启动 ShardingSphere-Proxy(以及其自身依赖的 Cluster,比如 Zookeeper)和数据库,同时要求 ShardingSphere-Proxy 的端口是 3307,修改 it-env.properties 文件中的属性 `scaling.it.env.type=native`
+数据库的端口可以在 it-env.properties 中配置,如果是默认端口可以不配置。
启动方式如下:找到需要测试的 Case,比如 MySQLGeneralScalingIT,在启动之前配置对应的 VM Option,新增如下配置。
```
--Dit.cluster.env.type=native -Dit.env.mysql.version=${image-name}
+-Dscaling.it.env.type=native -Dscaling.it.docker.mysql.version=${image-name}
```
在 IDE 下使用 Junit 的方式启动即可。
@@ -81,13 +81,13 @@ Native 环境要求本地自行启动 ShardingSphere-Proxy(以及其自身依
和 Native 一样,只需要改一个参数。
```
--Dit.cluster.env.type=docker
+-Dscaling.it.env.type=docker
```
可以和 Native 一样使用 IDE 的方式运行用例,或者使用 Maven 的方式运行用例。
```bash
-./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/pom.xml -Dit.cluster.env.type=DOCKER -Dit.env.mysql.version=${image-name}
+./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/pom.xml -Dscaling.it.env.type=DOCKER -Dscaling.it.docker.mysql.version=${image-name}
```
#### 注意事项
diff --git a/docs/document/content/reference/test/scaling-integration-test/_index.en.md b/docs/document/content/reference/test/scaling-integration-test/_index.en.md
index c596d309cc8..e4885ee94bd 100644
--- a/docs/document/content/reference/test/scaling-integration-test/_index.en.md
+++ b/docs/document/content/reference/test/scaling-integration-test/_index.en.md
@@ -9,7 +9,7 @@ Verify the correctness of Scaling's own functionality and dependent modules.
## Environment
-There are two types of environment preparation: Native and Docker, either of which requires Docker to be pre-installed locally.
+There are two types of environment preparation: Native and Docker
- Native Environment: For local debugging, you can use the IDE's debug mode for debugging
- Docker Environment: Environment run by Maven for cloud compiled environments and testing ShardingSphere-Proxy scenarios, e.g. GitHub Action
@@ -38,25 +38,25 @@ Catalog:`resources/env/`
- /common: The Dist SQL used in the Scaling process.
- /{SQL-TYPE}: database-level configuration files.
- /scenario: The configuration file for the test scenario, mainly SQL, may be written differently for different databases.
+- it-env.properties: Stores the corresponding configuration information.
### Run Test Cases
All property values can be dynamically injected by means of the Maven command line `-D`.
`${image-name}` Indicates a legal docker image name, e.g., mysql:5.7, separated by commas if multiple.
-`-Dit.env.postgresql.version=${image-name}` Indicates the version of PostgreSQL that needs to be tested.
-`-Dit.env.mysql.version=${image-name}` Indicates the version of MySQL that needs to be tested.
+`-Dscaling.it.docker.postgresql.version=${image-name}` Indicates the version of PostgreSQL that needs to be tested.
+`-Dscaling.it.docker.mysql.version=${image-name}` Indicates the version of MySQL that needs to be tested.
#### Native Environment Startup
-Native environments require that ShardingSphere-Proxy (and its own dependent Cluster, such as Zookeeper) be started locally, and that ShardingSphere-Proxy be started on port 3307, while the database will be started according to the user's configuration, but the corresponding ports are the default ports for the database (MySQL=3306, PostgreSQL=5432).
-
-Therefore, Native mode does not support running multiple cases, and you need to clean up the information in Zookeeper and restart ShardingSphere-Proxy after each run.
+Native environments require that ShardingSphere-Proxy (and its own dependent Cluster, such as Zookeeper) and the database be started locally, and that ShardingSphere-Proxy's port be 3307, modify the properties in the it-env.properties file ` scaling.it.env.type=native`
+The database port can be configured in it-env.properties, or not if it is the default port.
The startup method is as follows: Find the Case you need to test, such as MySQLGeneralScalingIT, and configure the corresponding VM Option before startup, add the following configuration.
```
--Dit.cluster.env.type=native -Dit.env.mysql.version=${image-name}
+-Dscaling.it.env.type=native -Dscaling.it.docker.mysql.version=${image-name}
```
Just start it under the IDE using the Junit.
@@ -80,13 +80,13 @@ You can change it yourself in ShardingSphereProxyDockerContainer.
As with Native, only one parameter needs to be changed.
```
--Dit.cluster.env.type=docker
+-Dscaling.it.env.type=docker
```
You can run the use case using the same IDE as Native, or you can run it using maven.
```shell
-./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/pom.xml -Dit.cluster.env.type=DOCKER -Dit.env.mysql.version=${image-name}
+./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/pom.xml -Dscaling.it.env.type=DOCKER -Dscaling.it.docker.mysql.version=${image-name}
```
#### Attentions
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/DataSourceEnvironment.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/DataSourceEnvironment.java
index cd258032605..ce683c36484 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/DataSourceEnvironment.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/DataSourceEnvironment.java
@@ -69,6 +69,8 @@ public final class DataSourceEnvironment {
return String.format("jdbc:sqlserver://%s:%s", host, port);
case "Oracle":
return String.format("jdbc:oracle:thin:@%s:%s", host, port);
+ case "openGauss":
+ return String.format("jdbc:opengauss://%s:%s/", host, port);
default:
throw new UnsupportedOperationException(databaseType.getType());
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseExtraSQLITCase.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseExtraSQLITCase.java
index b0b7d01a7de..21e7d3013bc 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseExtraSQLITCase.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseExtraSQLITCase.java
@@ -18,15 +18,18 @@
package org.apache.shardingsphere.integration.data.pipeline.cases.base;
import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.integration.data.pipeline.cases.command.ExtraSQLCommand;
import org.apache.shardingsphere.integration.data.pipeline.framework.param.ScalingParameterized;
import javax.xml.bind.JAXB;
import java.util.List;
+import java.util.Objects;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+@Slf4j
public abstract class BaseExtraSQLITCase extends BaseITCase {
@Getter
@@ -34,7 +37,7 @@ public abstract class BaseExtraSQLITCase extends BaseITCase {
public BaseExtraSQLITCase(final ScalingParameterized parameterized) {
super(parameterized);
- extraSQLCommand = JAXB.unmarshal(BaseExtraSQLITCase.class.getClassLoader().getResource(parameterized.getScenario()), ExtraSQLCommand.class);
+ extraSQLCommand = JAXB.unmarshal(Objects.requireNonNull(BaseExtraSQLITCase.class.getClassLoader().getResource(parameterized.getScenario())), ExtraSQLCommand.class);
}
protected void createNoUseTable() {
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 ab582eda3df..e3695ee84a0 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
@@ -30,12 +30,13 @@ import org.apache.shardingsphere.infra.database.metadata.url.JdbcUrlAppender;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
import org.apache.shardingsphere.integration.data.pipeline.cases.command.CommonSQLCommand;
+import org.apache.shardingsphere.integration.data.pipeline.cases.entity.JdbcInfoEntity;
import org.apache.shardingsphere.integration.data.pipeline.env.IntegrationTestEnvironment;
-import org.apache.shardingsphere.integration.data.pipeline.env.enums.ITEnvTypeEnum;
+import org.apache.shardingsphere.integration.data.pipeline.env.enums.ScalingITEnvTypeEnum;
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.DockerDatabaseContainer;
+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;
@@ -70,9 +71,19 @@ import static org.junit.Assert.assertTrue;
@Getter(AccessLevel.PROTECTED)
public abstract class BaseITCase {
+ protected static final IntegrationTestEnvironment ENV = IntegrationTestEnvironment.getInstance();
+
protected static final JdbcUrlAppender JDBC_URL_APPENDER = new JdbcUrlAppender();
- private static final IntegrationTestEnvironment ENV = IntegrationTestEnvironment.getInstance();
+ protected static final String DS_0 = "scaling_it_0";
+
+ protected static final String DS_1 = "scaling_it_1";
+
+ protected static final String DS_2 = "scaling_it_2";
+
+ protected static final String DS_3 = "scaling_it_3";
+
+ protected static final String DS_4 = "scaling_it_4";
@Rule
@Getter(AccessLevel.NONE)
@@ -91,31 +102,78 @@ public abstract class BaseITCase {
public BaseITCase(final ScalingParameterized parameterized) {
databaseType = parameterized.getDatabaseType();
- if (ENV.getItEnvType() == ITEnvTypeEnum.DOCKER) {
+ if (ENV.getItEnvType() == ScalingITEnvTypeEnum.DOCKER) {
composedContainer = new DockerComposedContainer(parameterized.getDatabaseType(), parameterized.getDockerImageName());
} else {
- composedContainer = new NativeComposedContainer(parameterized.getDatabaseType(), parameterized.getDockerImageName());
+ composedContainer = new NativeComposedContainer(parameterized.getDatabaseType());
}
composedContainer.start();
- commonSQLCommand = JAXB.unmarshal(BaseITCase.class.getClassLoader().getResource("env/common/command.xml"), CommonSQLCommand.class);
+ initActualDataSources();
+ commonSQLCommand = JAXB.unmarshal(Objects.requireNonNull(BaseITCase.class.getClassLoader().getResource("env/common/command.xml")), CommonSQLCommand.class);
createProxyDatabase(parameterized.getDatabaseType());
scalingWatcher = new ScalingWatcher(composedContainer, jdbcTemplate);
}
- @SneakyThrows
+ @SneakyThrows(SQLException.class)
+ private void initActualDataSources() {
+ String jdbcUrl;
+ JdbcInfoEntity jdbcInfo;
+ if (ENV.getItEnvType() == ScalingITEnvTypeEnum.DOCKER) {
+ DockerComposedContainer dockerComposedContainer = (DockerComposedContainer) composedContainer;
+ DatabaseContainer databaseContainer = dockerComposedContainer.getDatabaseContainer();
+ jdbcUrl = databaseContainer.getJdbcUrl("");
+ jdbcInfo = new JdbcInfoEntity(databaseContainer.getUsername(), databaseContainer.getPassword(), databaseContainer.getPort());
+ } else {
+ jdbcInfo = ENV.getActualDatabaseJdbcInfo(getDatabaseType());
+ jdbcUrl = DataSourceEnvironment.getURL(databaseType, "localhost", jdbcInfo.getPort());
+ try (Connection connection = DriverManager.getConnection(jdbcUrl, jdbcInfo.getUsername(), jdbcInfo.getPassword())) {
+ for (String each : Arrays.asList(DS_0, DS_1, DS_2, DS_3, DS_4)) {
+ try {
+ connection.createStatement().execute(String.format("DROP DATABASE %s", each));
+ } catch (final SQLException ex) {
+ log.error("Error occurred when drop database. error msg={}", ex.getMessage());
+ }
+ }
+ }
+ }
+ try (Connection connection = DriverManager.getConnection(jdbcUrl, jdbcInfo.getUsername(), jdbcInfo.getPassword())) {
+ for (String each : Arrays.asList(DS_0, DS_1, DS_2, DS_3, DS_4)) {
+ try {
+ connection.createStatement().execute(String.format("CREATE DATABASE %s", each));
+ } catch (final SQLException ex) {
+ log.error("Error occurred when create database. error msg={}", ex.getMessage());
+ }
+ }
+ }
+ }
+
protected void createProxyDatabase(final DatabaseType databaseType) {
- JdbcUrlAppender jdbcUrlAppender = new JdbcUrlAppender();
- Properties queryProps = ScalingCaseHelper.getQueryPropertiesByDatabaseType(databaseType);
- String defaultDatabaseName = DatabaseTypeUtil.isPostgreSQL(databaseType) ? "postgres" : "";
- try (Connection connection = DriverManager.getConnection(jdbcUrlAppender.appendQueryProperties(composedContainer.getProxyJdbcUrl(defaultDatabaseName), queryProps), "root", "root")) {
+ String defaultDatabaseName = "";
+ if (DatabaseTypeUtil.isPostgreSQL(databaseType) || DatabaseTypeUtil.isOpenGauss(databaseType)) {
+ defaultDatabaseName = "postgres";
+ }
+ String jdbcUrl = composedContainer.getProxyJdbcUrl(defaultDatabaseName);
+ if (DatabaseTypeUtil.isPostgreSQL(databaseType) || DatabaseTypeUtil.isOpenGauss(databaseType)) {
+ jdbcUrl = JDBC_URL_APPENDER.appendQueryProperties(jdbcUrl, ScalingCaseHelper.getPostgreSQLQueryProperties());
+ }
+ try (Connection connection = DriverManager.getConnection(jdbcUrl, "root", "root")) {
+ if (ENV.getItEnvType() == ScalingITEnvTypeEnum.NATIVE) {
+ try {
+ executeWithLog(connection, "DROP DATABASE sharding_db");
+ } catch (final SQLException ex) {
+ log.warn("Drop sharding_db failed, maybe it's not exist. error msg={}", ex.getMessage());
+ }
+ }
executeWithLog(connection, "CREATE DATABASE sharding_db");
+ } catch (final SQLException ex) {
+ throw new IllegalStateException(ex);
}
jdbcTemplate = new JdbcTemplate(getProxyDataSource("sharding_db"));
}
- private DataSource getProxyDataSource(final String databaseName) {
+ protected DataSource getProxyDataSource(final String databaseName) {
HikariDataSource result = new HikariDataSource();
- result.setDriverClassName(DataSourceEnvironment.getDriverClassName(composedContainer.getDatabaseContainer().getDatabaseType()));
+ result.setDriverClassName(DataSourceEnvironment.getDriverClassName(getDatabaseType()));
result.setJdbcUrl(composedContainer.getProxyJdbcUrl(databaseName));
result.setUsername("root");
result.setPassword("root");
@@ -141,14 +199,14 @@ public abstract class BaseITCase {
@SneakyThrows
protected void addSourceResource() {
- Properties queryProps = ScalingCaseHelper.getQueryPropertiesByDatabaseType(databaseType);
// TODO if mysql can append database firstly, they can be combined
if (databaseType instanceof MySQLDatabaseType) {
- try (Connection connection = DriverManager.getConnection(JDBC_URL_APPENDER.appendQueryProperties(getComposedContainer().getProxyJdbcUrl(""), queryProps), "root", "root")) {
+ try (Connection connection = DriverManager.getConnection(getComposedContainer().getProxyJdbcUrl(""), "root", "root")) {
connection.createStatement().execute("USE sharding_db");
addSourceResource0(connection);
}
} else {
+ Properties queryProps = ScalingCaseHelper.getPostgreSQLQueryProperties();
try (Connection connection = DriverManager.getConnection(JDBC_URL_APPENDER.appendQueryProperties(getComposedContainer().getProxyJdbcUrl("sharding_db"), queryProps), "root", "root")) {
addSourceResource0(connection);
}
@@ -158,22 +216,20 @@ public abstract class BaseITCase {
}
private void addSourceResource0(final Connection connection) throws SQLException {
- Properties queryProps = ScalingCaseHelper.getQueryPropertiesByDatabaseType(databaseType);
- String addSourceResource = commonSQLCommand.getSourceAddResourceTemplate().replace("${user}", ScalingCaseHelper.getUsername(databaseType))
- .replace("${password}", ScalingCaseHelper.getPassword(databaseType))
- .replace("${ds0}", JDBC_URL_APPENDER.appendQueryProperties(getActualJdbcUrlTemplate("ds_0"), queryProps))
- .replace("${ds1}", JDBC_URL_APPENDER.appendQueryProperties(getActualJdbcUrlTemplate("ds_1"), queryProps));
+ String addSourceResource = commonSQLCommand.getSourceAddResourceTemplate().replace("${user}", ENV.getActualDataSourceUsername(databaseType))
+ .replace("${password}", ENV.getActualDataSourcePassword(databaseType))
+ .replace("${ds0}", getActualJdbcUrlTemplate(DS_0))
+ .replace("${ds1}", getActualJdbcUrlTemplate(DS_1));
executeWithLog(connection, addSourceResource);
}
@SneakyThrows
protected void addTargetResource() {
- Properties queryProps = ScalingCaseHelper.getQueryPropertiesByDatabaseType(databaseType);
- String addTargetResource = commonSQLCommand.getTargetAddResourceTemplate().replace("${user}", ScalingCaseHelper.getUsername(databaseType))
- .replace("${password}", ScalingCaseHelper.getPassword(databaseType))
- .replace("${ds2}", JDBC_URL_APPENDER.appendQueryProperties(getActualJdbcUrlTemplate("ds_2"), queryProps))
- .replace("${ds3}", JDBC_URL_APPENDER.appendQueryProperties(getActualJdbcUrlTemplate("ds_3"), queryProps))
- .replace("${ds4}", JDBC_URL_APPENDER.appendQueryProperties(getActualJdbcUrlTemplate("ds_4"), queryProps));
+ String addTargetResource = commonSQLCommand.getTargetAddResourceTemplate().replace("${user}", ENV.getActualDataSourceUsername(databaseType))
+ .replace("${password}", ENV.getActualDataSourcePassword(databaseType))
+ .replace("${ds2}", getActualJdbcUrlTemplate(DS_2))
+ .replace("${ds3}", getActualJdbcUrlTemplate(DS_3))
+ .replace("${ds4}", getActualJdbcUrlTemplate(DS_4));
executeWithLog(addTargetResource);
List<Map<String, Object>> resources = queryForListWithLog("SHOW DATABASE RESOURCES from sharding_db");
assertThat(resources.size(), is(5));
@@ -181,11 +237,11 @@ public abstract class BaseITCase {
}
private String getActualJdbcUrlTemplate(final String databaseName) {
- final DockerDatabaseContainer databaseContainer = composedContainer.getDatabaseContainer();
- if (ENV.getItEnvType() == ITEnvTypeEnum.DOCKER) {
- return String.format("jdbc:%s://%s:%s/%s", databaseContainer.getDatabaseType().getType().toLowerCase(), "db.host", databaseContainer.getPort(), databaseName);
+ if (ENV.getItEnvType() == ScalingITEnvTypeEnum.DOCKER) {
+ final DatabaseContainer databaseContainer = ((DockerComposedContainer) composedContainer).getDatabaseContainer();
+ return DataSourceEnvironment.getURL(getDatabaseType(), "db.host", databaseContainer.getPort(), databaseName);
} else {
- return String.format("jdbc:%s://%s:%s/%s", databaseContainer.getDatabaseType().getType().toLowerCase(), "127.0.0.1", databaseContainer.getFirstMappedPort(), databaseName);
+ return DataSourceEnvironment.getURL(getDatabaseType(), "127.0.0.1", ENV.getActualDataSourceDefaultPort(databaseType), databaseName);
}
}
@@ -209,6 +265,17 @@ public abstract class BaseITCase {
}
protected void createScalingRule() {
+ if (ENV.getItEnvType() == ScalingITEnvTypeEnum.NATIVE) {
+ try {
+ List<Map<String, Object>> scalingList = jdbcTemplate.queryForList("SHOW SCALING LIST");
+ for (Map<String, Object> each : scalingList) {
+ String id = each.get("id").toString();
+ jdbcTemplate.execute(String.format("DROP SCALING %s", id));
+ }
+ } catch (final DataAccessException ex) {
+ log.error("Failed to show scaling list. {}", ex.getMessage());
+ }
+ }
executeWithLog("CREATE SHARDING SCALING RULE scaling_manual (INPUT(SHARDING_SIZE=1000), DATA_CONSISTENCY_CHECKER(TYPE(NAME=DATA_MATCH)))");
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/enums/ITEnvTypeEnum.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/JdbcInfoEntity.java
similarity index 72%
copy from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/enums/ITEnvTypeEnum.java
copy to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/JdbcInfoEntity.java
index c3ead57c7a6..ce50cfa3bec 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/enums/ITEnvTypeEnum.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/JdbcInfoEntity.java
@@ -15,9 +15,18 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.integration.data.pipeline.env.enums;
+package org.apache.shardingsphere.integration.data.pipeline.cases.entity;
-public enum ITEnvTypeEnum {
+import lombok.Data;
+import lombok.RequiredArgsConstructor;
+
+@RequiredArgsConstructor
+@Data
+public final class JdbcInfoEntity {
+
+ private final String username;
+
+ private final String password;
- DOCKER, NATIVE;
+ private final int port;
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/MySQLGeneralScalingIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/MySQLGeneralScalingIT.java
index 82450c25152..f0ee0c4e8e8 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/MySQLGeneralScalingIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/MySQLGeneralScalingIT.java
@@ -18,11 +18,12 @@
package org.apache.shardingsphere.integration.data.pipeline.cases.general;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
import org.apache.shardingsphere.integration.data.pipeline.cases.base.BaseExtraSQLITCase;
import org.apache.shardingsphere.integration.data.pipeline.cases.task.MySQLIncrementTask;
-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.helper.ScalingCaseHelper;
import org.apache.shardingsphere.integration.data.pipeline.framework.param.ScalingParameterized;
import org.apache.shardingsphere.sharding.algorithm.keygen.SnowflakeKeyGenerateAlgorithm;
@@ -45,8 +46,6 @@ import static org.junit.Assert.assertTrue;
@RunWith(Parameterized.class)
public final class MySQLGeneralScalingIT extends BaseExtraSQLITCase {
- private static final IntegrationTestEnvironment ENV = IntegrationTestEnvironment.getInstance();
-
private final ScalingParameterized parameterized;
public MySQLGeneralScalingIT(final ScalingParameterized parameterized) {
@@ -58,8 +57,16 @@ public final class MySQLGeneralScalingIT extends BaseExtraSQLITCase {
@Parameters(name = "{0}")
public static Collection<ScalingParameterized> getParameters() {
Collection<ScalingParameterized> result = new LinkedList<>();
- for (String version : ENV.getMysqlVersions()) {
- result.add(new ScalingParameterized(new MySQLDatabaseType(), version, "env/scenario/general/mysql.xml"));
+ if (ENV.getItEnvType() == ScalingITEnvTypeEnum.NONE) {
+ return result;
+ }
+ if (ENV.getItEnvType() == ScalingITEnvTypeEnum.DOCKER) {
+ for (String version : ENV.getMysqlVersions()) {
+ result.add(new ScalingParameterized(new MySQLDatabaseType(), version, "env/scenario/general/mysql.xml"));
+ }
+ }
+ if (ENV.getItEnvType() == ScalingITEnvTypeEnum.NATIVE && StringUtils.equalsIgnoreCase(ENV.getNativeDatabaseType(), "MySQL")) {
+ result.add(new ScalingParameterized(new MySQLDatabaseType(), "", "env/scenario/general/mysql.xml"));
}
return result;
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/PostgreSQLGeneralScalingIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/PostgreSQLGeneralScalingIT.java
index 2bdc5fa6b4a..4a4663da2c2 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/PostgreSQLGeneralScalingIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/PostgreSQLGeneralScalingIT.java
@@ -18,12 +18,13 @@
package org.apache.shardingsphere.integration.data.pipeline.cases.general;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
import org.apache.shardingsphere.integration.data.pipeline.cases.base.BaseExtraSQLITCase;
import org.apache.shardingsphere.integration.data.pipeline.cases.task.PostgreSQLIncrementTask;
-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.helper.ScalingCaseHelper;
import org.apache.shardingsphere.integration.data.pipeline.framework.param.ScalingParameterized;
import org.apache.shardingsphere.sharding.algorithm.keygen.SnowflakeKeyGenerateAlgorithm;
@@ -46,8 +47,6 @@ import static org.junit.Assert.assertTrue;
@RunWith(Parameterized.class)
public final class PostgreSQLGeneralScalingIT extends BaseExtraSQLITCase {
- private static final IntegrationTestEnvironment ENV = IntegrationTestEnvironment.getInstance();
-
private final ScalingParameterized parameterized;
public PostgreSQLGeneralScalingIT(final ScalingParameterized parameterized) {
@@ -59,11 +58,24 @@ public final class PostgreSQLGeneralScalingIT extends BaseExtraSQLITCase {
@Parameters(name = "{0}")
public static Collection<ScalingParameterized> getParameters() {
Collection<ScalingParameterized> result = new LinkedList<>();
- for (String dockerImageName : ENV.getPostgresVersions()) {
- result.add(new ScalingParameterized(new PostgreSQLDatabaseType(), dockerImageName, "env/scenario/general/postgresql.xml"));
+ if (ENV.getItEnvType() == ScalingITEnvTypeEnum.NONE) {
+ return result;
+ }
+ if (ENV.getItEnvType() == ScalingITEnvTypeEnum.DOCKER) {
+ for (String dockerImageName : ENV.getPostgresVersions()) {
+ result.add(new ScalingParameterized(new PostgreSQLDatabaseType(), dockerImageName, "env/scenario/general/postgresql.xml"));
+ }
+ for (String dockerImageName : ENV.getOpenGaussVersions()) {
+ result.add(new ScalingParameterized(new OpenGaussDatabaseType(), dockerImageName, "env/scenario/general/postgresql.xml"));
+ }
}
- for (String dockerImageName : ENV.getOpenGaussVersions()) {
- result.add(new ScalingParameterized(new OpenGaussDatabaseType(), dockerImageName, "env/scenario/general/postgresql.xml"));
+ if (ENV.getItEnvType() == ScalingITEnvTypeEnum.NATIVE) {
+ if (StringUtils.equalsIgnoreCase(ENV.getNativeDatabaseType(), "PostgreSQL")) {
+ result.add(new ScalingParameterized(new PostgreSQLDatabaseType(), "", "env/scenario/general/postgresql.xml"));
+ }
+ if (StringUtils.equalsIgnoreCase(ENV.getNativeDatabaseType(), "openGauss")) {
+ result.add(new ScalingParameterized(new OpenGaussDatabaseType(), "", "env/scenario/general/postgresql.xml"));
+ }
}
return result;
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/postgresql/PostgreSQLDDLGeneratorIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/postgresql/PostgreSQLDDLGeneratorIT.java
index 49b63ff25ed..4718a8d3179 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/postgresql/PostgreSQLDDLGeneratorIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/postgresql/PostgreSQLDDLGeneratorIT.java
@@ -26,8 +26,9 @@ import org.apache.shardingsphere.integration.data.pipeline.cases.entity.DDLGener
import org.apache.shardingsphere.integration.data.pipeline.cases.entity.DDLGeneratorAssertionsRootEntity;
import org.apache.shardingsphere.integration.data.pipeline.cases.entity.DDLGeneratorOutputEntity;
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.DockerDatabaseContainer;
+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.DataSourceEnvironment;
import org.junit.After;
@@ -62,7 +63,7 @@ public final class PostgreSQLDDLGeneratorIT {
private static final IntegrationTestEnvironment ENV = IntegrationTestEnvironment.getInstance();
- private final DockerDatabaseContainer dockerDatabaseContainer;
+ private final DatabaseContainer databaseContainer;
private final ScalingParameterized parameterized;
@@ -72,13 +73,16 @@ public final class PostgreSQLDDLGeneratorIT {
this.parameterized = parameterized;
this.rootEntity = JAXB.unmarshal(Objects.requireNonNull(PostgreSQLDDLGeneratorIT.class.getClassLoader().getResource(parameterized.getScenario())),
DDLGeneratorAssertionsRootEntity.class);
- this.dockerDatabaseContainer = DatabaseContainerFactory.newInstance(parameterized.getDatabaseType(), parameterized.getDockerImageName());
- dockerDatabaseContainer.start();
+ this.databaseContainer = DatabaseContainerFactory.newInstance(parameterized.getDatabaseType(), parameterized.getDockerImageName());
+ databaseContainer.start();
}
@Parameters(name = "{0}")
public static Collection<ScalingParameterized> getParameters() {
Collection<ScalingParameterized> result = new LinkedList<>();
+ if (ENV.getItEnvType() == ScalingITEnvTypeEnum.NONE) {
+ return result;
+ }
for (String each : ENV.getPostgresVersions()) {
if (!Strings.isNullOrEmpty(each)) {
result.add(new ScalingParameterized(new PostgreSQLDatabaseType(), each, String.join("/", PARENT_PATH, CASE_FILE_PATH)));
@@ -118,8 +122,8 @@ public final class PostgreSQLDDLGeneratorIT {
private DataSource createDataSource() {
HikariDataSource result = new HikariDataSource();
- result.setDriverClassName(DataSourceEnvironment.getDriverClassName(dockerDatabaseContainer.getDatabaseType()));
- result.setJdbcUrl(dockerDatabaseContainer.getJdbcUrl(dockerDatabaseContainer.getHost(), dockerDatabaseContainer.getFirstMappedPort(), "postgres"));
+ result.setDriverClassName(DataSourceEnvironment.getDriverClassName(databaseContainer.getDatabaseType()));
+ result.setJdbcUrl(databaseContainer.getJdbcUrl("postgres"));
result.setUsername("root");
result.setPassword("root");
result.setMaximumPoolSize(2);
@@ -129,6 +133,6 @@ public final class PostgreSQLDDLGeneratorIT {
@After
public void stopContainer() {
- dockerDatabaseContainer.stop();
+ databaseContainer.stop();
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/primarykey/TextPrimaryKeyScalingIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/primarykey/TextPrimaryKeyScalingIT.java
index 318e764c8e2..e027cfe79ae 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/primarykey/TextPrimaryKeyScalingIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/primarykey/TextPrimaryKeyScalingIT.java
@@ -18,11 +18,12 @@
package org.apache.shardingsphere.integration.data.pipeline.cases.primarykey;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
import org.apache.shardingsphere.integration.data.pipeline.cases.base.BaseExtraSQLITCase;
-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.param.ScalingParameterized;
import org.apache.shardingsphere.sharding.algorithm.keygen.UUIDKeyGenerateAlgorithm;
import org.junit.Test;
@@ -43,8 +44,6 @@ import static org.junit.Assert.assertTrue;
@Slf4j
public class TextPrimaryKeyScalingIT extends BaseExtraSQLITCase {
- private static final IntegrationTestEnvironment ENV = IntegrationTestEnvironment.getInstance();
-
public TextPrimaryKeyScalingIT(final ScalingParameterized parameterized) {
super(parameterized);
log.info("parameterized:{}", parameterized);
@@ -53,14 +52,30 @@ public class TextPrimaryKeyScalingIT extends BaseExtraSQLITCase {
@Parameters(name = "{0}")
public static Collection<ScalingParameterized> getParameters() {
Collection<ScalingParameterized> result = new LinkedList<>();
- for (String version : ENV.getMysqlVersions()) {
- result.add(new ScalingParameterized(new MySQLDatabaseType(), version, "env/scenario/primarykey/text_primary_key/mysql.xml"));
+ if (ENV.getItEnvType() == ScalingITEnvTypeEnum.NONE) {
+ return result;
}
- for (String version : ENV.getPostgresVersions()) {
- result.add(new ScalingParameterized(new PostgreSQLDatabaseType(), version, "env/scenario/primarykey/text_primary_key/postgresql.xml"));
+ if (ENV.getItEnvType() == ScalingITEnvTypeEnum.DOCKER) {
+ for (String version : ENV.getMysqlVersions()) {
+ result.add(new ScalingParameterized(new MySQLDatabaseType(), version, "env/scenario/primarykey/text_primary_key/mysql.xml"));
+ }
+ for (String version : ENV.getPostgresVersions()) {
+ result.add(new ScalingParameterized(new PostgreSQLDatabaseType(), version, "env/scenario/primarykey/text_primary_key/postgresql.xml"));
+ }
+ for (String version : ENV.getOpenGaussVersions()) {
+ result.add(new ScalingParameterized(new OpenGaussDatabaseType(), version, "env/scenario/primarykey/text_primary_key/postgresql.xml"));
+ }
}
- for (String version : ENV.getOpenGaussVersions()) {
- result.add(new ScalingParameterized(new OpenGaussDatabaseType(), version, "env/scenario/primarykey/text_primary_key/postgresql.xml"));
+ if (ENV.getItEnvType() == ScalingITEnvTypeEnum.NATIVE) {
+ if (StringUtils.equalsIgnoreCase(ENV.getNativeDatabaseType(), "MySQL")) {
+ result.add(new ScalingParameterized(new MySQLDatabaseType(), "", "env/scenario/primarykey/text_primary_key/mysql.xml"));
+ }
+ if (StringUtils.equalsIgnoreCase(ENV.getNativeDatabaseType(), "PostgreSQL")) {
+ result.add(new ScalingParameterized(new PostgreSQLDatabaseType(), "", "env/scenario/primarykey/text_primary_key/postgresql.xml"));
+ }
+ if (StringUtils.equalsIgnoreCase(ENV.getNativeDatabaseType(), "openGauss")) {
+ result.add(new ScalingParameterized(new OpenGaussDatabaseType(), "", "env/scenario/primarykey/text_primary_key/postgresql.xml"));
+ }
}
return result;
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/IntegrationTestEnvironment.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/IntegrationTestEnvironment.java
index 4e33512c060..146af6029a9 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/IntegrationTestEnvironment.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/IntegrationTestEnvironment.java
@@ -20,7 +20,10 @@ package org.apache.shardingsphere.integration.data.pipeline.env;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
-import org.apache.shardingsphere.integration.data.pipeline.env.enums.ITEnvTypeEnum;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
+import org.apache.shardingsphere.integration.data.pipeline.cases.entity.JdbcInfoEntity;
+import org.apache.shardingsphere.integration.data.pipeline.env.enums.ScalingITEnvTypeEnum;
import java.io.IOException;
import java.io.InputStream;
@@ -37,7 +40,7 @@ public final class IntegrationTestEnvironment {
private final Properties props;
- private final ITEnvTypeEnum itEnvType;
+ private final ScalingITEnvTypeEnum itEnvType;
private final List<String> mysqlVersions;
@@ -47,10 +50,10 @@ public final class IntegrationTestEnvironment {
private IntegrationTestEnvironment() {
props = loadProperties();
- itEnvType = ITEnvTypeEnum.valueOf(props.getProperty("it.cluster.env.type", ITEnvTypeEnum.DOCKER.name()).toUpperCase());
- mysqlVersions = Arrays.stream(props.getOrDefault("it.env.mysql.version", "").toString().split(",")).filter(StringUtils::isNotBlank).collect(Collectors.toList());
- postgresVersions = Arrays.stream(props.getOrDefault("it.env.postgresql.version", "").toString().split(",")).filter(StringUtils::isNotBlank).collect(Collectors.toList());
- openGaussVersions = Arrays.stream(props.getOrDefault("it.env.opengauss.version", "").toString().split(",")).filter(StringUtils::isNotBlank).collect(Collectors.toList());
+ itEnvType = ScalingITEnvTypeEnum.valueOf(StringUtils.defaultIfBlank(props.getProperty("scaling.it.env.type").toUpperCase(), ScalingITEnvTypeEnum.NONE.name()));
+ mysqlVersions = Arrays.stream(props.getOrDefault("scaling.it.docker.mysql.version", "").toString().split(",")).filter(StringUtils::isNotBlank).collect(Collectors.toList());
+ postgresVersions = Arrays.stream(props.getOrDefault("scaling.it.docker.postgresql.version", "").toString().split(",")).filter(StringUtils::isNotBlank).collect(Collectors.toList());
+ openGaussVersions = Arrays.stream(props.getOrDefault("scaling.it.docker.opengauss.version", "").toString().split(",")).filter(StringUtils::isNotBlank).collect(Collectors.toList());
}
private Properties loadProperties() {
@@ -66,6 +69,104 @@ public final class IntegrationTestEnvironment {
return result;
}
+ /**
+ * Get actual data source connection.
+ *
+ * @param databaseType database type.
+ * @return jdbc connection
+ */
+ public JdbcInfoEntity getActualDatabaseJdbcInfo(final DatabaseType databaseType) {
+ String username;
+ String password;
+ int port;
+ switch (databaseType.getType()) {
+ case "MySQL":
+ username = props.getOrDefault("scaling.it.native.mysql.username", "root").toString();
+ password = props.getOrDefault("scaling.it.native.mysql.password", "root").toString();
+ port = Integer.parseInt(props.getOrDefault("scaling.it.native.mysql.port", 3307).toString());
+ break;
+ case "PostgreSQL":
+ username = props.getOrDefault("scaling.it.native.postgresql.username", "postgres").toString();
+ password = props.getOrDefault("scaling.it.native.postgresql.password", "postgres").toString();
+ port = Integer.parseInt(props.getOrDefault("scaling.it.native.postgresql.port", 5432).toString());
+ break;
+ case "openGauss":
+ username = props.getOrDefault("scaling.it.native.opengauss.username", "gaussdb").toString();
+ password = props.getOrDefault("scaling.it.native.opengauss.password", "Root@123").toString();
+ port = Integer.parseInt(props.getOrDefault("scaling.it.native.opengauss.port", 5432).toString());
+ break;
+ default:
+ throw new UnsupportedOperationException("Unsupported database type: " + databaseType.getType());
+ }
+ return new JdbcInfoEntity(username, password, port);
+ }
+
+ /**
+ * Get actual data source default port.
+ *
+ * @param databaseType database type.
+ * @return default port
+ */
+ public int getActualDataSourceDefaultPort(final DatabaseType databaseType) {
+ switch (databaseType.getType()) {
+ case "MySQL":
+ return Integer.parseInt(props.getOrDefault("scaling.it.native.mysql.port", 3306).toString());
+ case "PostgreSQL":
+ return Integer.parseInt(props.getOrDefault("scaling.it.native.postgresql.port", 5432).toString());
+ case "openGauss":
+ return Integer.parseInt(props.getOrDefault("scaling.it.native.opengauss.port", 5432).toString());
+ default:
+ throw new IllegalArgumentException("Unsupported database type: " + databaseType.getType());
+ }
+ }
+
+ /**
+ * Get native database type.
+ *
+ * @return native database type
+ */
+ public String getNativeDatabaseType() {
+ return String.valueOf(props.get("scaling.it.native.database"));
+ }
+
+ /**
+ * Get actual data source username.
+ *
+ * @param databaseType database type.
+ * @return actual data source username
+ */
+ public String getActualDataSourceUsername(final DatabaseType databaseType) {
+ String username;
+ if (databaseType instanceof OpenGaussDatabaseType) {
+ username = "gaussdb";
+ } else {
+ username = "root";
+ }
+ if (itEnvType == ScalingITEnvTypeEnum.NATIVE) {
+ username = String.valueOf(props.getOrDefault(String.format("scaling.it.native.%s.username", databaseType.getType().toLowerCase()), username));
+ }
+ return username;
+ }
+
+ /**
+ * Get actual data source password.
+ *
+ * @param databaseType database type.
+ * @return actual data source username
+ */
+ public String getActualDataSourcePassword(final DatabaseType databaseType) {
+ String password;
+ if (databaseType instanceof OpenGaussDatabaseType) {
+ password = "Root@123";
+ } else {
+ password = "root";
+ }
+ if (itEnvType == ScalingITEnvTypeEnum.NATIVE) {
+ password = props.getOrDefault(String.format("scaling.it.native.%s.password", databaseType.getType().toLowerCase()), password).toString();
+ }
+ return password;
+ }
+
/**
* Get instance.
*
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/enums/ITEnvTypeEnum.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/enums/ScalingITEnvTypeEnum.java
similarity index 93%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/enums/ITEnvTypeEnum.java
rename to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/enums/ScalingITEnvTypeEnum.java
index c3ead57c7a6..c0d9fdc60d6 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/enums/ITEnvTypeEnum.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/enums/ScalingITEnvTypeEnum.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.integration.data.pipeline.env.enums;
-public enum ITEnvTypeEnum {
+public enum ScalingITEnvTypeEnum {
- DOCKER, NATIVE;
+ NONE, DOCKER, NATIVE;
}
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 6f49a22052b..754be6cafe3 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,7 +20,7 @@ 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.DockerDatabaseContainer;
+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;
@@ -38,7 +38,7 @@ public final class DatabaseContainerFactory {
* @param dockerImageName database ver
* @return created instance
*/
- public static DockerDatabaseContainer newInstance(final DatabaseType databaseType, final String dockerImageName) {
+ public static DatabaseContainer newInstance(final DatabaseType databaseType, final String dockerImageName) {
switch (databaseType.getType()) {
case "MySQL":
return new MySQLContainer(dockerImageName);
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/BaseComposedContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/BaseComposedContainer.java
index 46c4be8c1cf..c312a271123 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/BaseComposedContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/BaseComposedContainer.java
@@ -18,23 +18,16 @@
package org.apache.shardingsphere.integration.data.pipeline.framework.container.compose;
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.DockerDatabaseContainer;
import org.apache.shardingsphere.test.integration.framework.container.atomic.ITContainers;
-import org.apache.shardingsphere.test.integration.util.NetworkAliasUtil;
import org.testcontainers.lifecycle.Startable;
-@Getter
public abstract class BaseComposedContainer implements Startable {
+ @Getter
private final ITContainers containers;
- private final DockerDatabaseContainer databaseContainer;
-
- public BaseComposedContainer(final DatabaseType databaseType, final String dockerImageName) {
+ public BaseComposedContainer() {
this.containers = new ITContainers("");
- this.databaseContainer = containers.registerContainer(DatabaseContainerFactory.newInstance(databaseType, dockerImageName), NetworkAliasUtil.getNetworkAlias("db"));
}
/**
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 48f82b64a0a..4dd2c0ac22e 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,8 +19,11 @@ 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.cluster.ZookeeperContainer;
+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.DataSourceEnvironment;
import org.apache.shardingsphere.test.integration.framework.container.atomic.governance.GovernanceContainer;
import org.apache.shardingsphere.test.integration.util.NetworkAliasUtil;
@@ -30,15 +33,20 @@ import org.apache.shardingsphere.test.integration.util.NetworkAliasUtil;
@Getter
public final class DockerComposedContainer extends BaseComposedContainer {
+ private final DatabaseType databaseType;
+
private final GovernanceContainer governanceContainer;
private final ShardingSphereProxyDockerContainer proxyContainer;
+ private final DatabaseContainer databaseContainer;
+
public DockerComposedContainer(final DatabaseType databaseType, final String dockerImageName) {
- super(databaseType, dockerImageName);
+ this.databaseType = databaseType;
ShardingSphereProxyDockerContainer proxyContainer = new ShardingSphereProxyDockerContainer(databaseType);
governanceContainer = getContainers().registerContainer(new ZookeeperContainer(), NetworkAliasUtil.getNetworkAlias("zk"));
- proxyContainer.dependsOn(governanceContainer, getDatabaseContainer());
+ databaseContainer = getContainers().registerContainer(DatabaseContainerFactory.newInstance(databaseType, dockerImageName), NetworkAliasUtil.getNetworkAlias("db"));
+ proxyContainer.dependsOn(governanceContainer, databaseContainer);
this.proxyContainer = getContainers().registerContainer(proxyContainer, NetworkAliasUtil.getNetworkAlias("sharding-proxy"));
}
@@ -50,6 +58,6 @@ public final class DockerComposedContainer extends BaseComposedContainer {
@Override
public String getProxyJdbcUrl(final String databaseName) {
- return getDatabaseContainer().getJdbcUrl(getProxyContainer().getHost(), getProxyContainer().getFirstMappedPort(), databaseName);
+ return DataSourceEnvironment.getURL(databaseType, proxyContainer.getHost(), proxyContainer.getFirstMappedPort(), databaseName);
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/NativeComposedContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/NativeComposedContainer.java
index 4246f00dfc4..6130d789d30 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/NativeComposedContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/NativeComposedContainer.java
@@ -18,23 +18,26 @@
package org.apache.shardingsphere.integration.data.pipeline.framework.container.compose;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.test.integration.env.DataSourceEnvironment;
/**
* Native composed container, you need start ShardingSphere-Proxy at firstly.
*/
public final class NativeComposedContainer extends BaseComposedContainer {
- public NativeComposedContainer(final DatabaseType databaseType, final String dockerImageName) {
- super(databaseType, dockerImageName);
+ private final DatabaseType databaseType;
+
+ public NativeComposedContainer(final DatabaseType databaseType) {
+ this.databaseType = databaseType;
}
@Override
public void start() {
- super.start();
+
}
@Override
public String getProxyJdbcUrl(final String databaseName) {
- return getDatabaseContainer().getJdbcUrl("localhost", 3307, databaseName);
+ return DataSourceEnvironment.getURL(databaseType, "localhost", 3307, databaseName);
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/DockerDatabaseContainer.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
similarity index 72%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/DockerDatabaseContainer.java
rename to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/DatabaseContainer.java
index 4f9be63d70f..b91b3d1cbf4 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/DockerDatabaseContainer.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
@@ -20,35 +20,41 @@ package org.apache.shardingsphere.integration.data.pipeline.framework.container.
import lombok.Getter;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.test.integration.framework.container.atomic.DockerITContainer;
-import org.testcontainers.containers.BindMode;
/**
* Docker storage container.
*/
@Getter
-public abstract class DockerDatabaseContainer extends DockerITContainer {
+public abstract class DatabaseContainer extends DockerITContainer {
private final DatabaseType databaseType;
- public DockerDatabaseContainer(final DatabaseType databaseType, final String dockerImageName) {
+ public DatabaseContainer(final DatabaseType databaseType, final String dockerImageName) {
super(databaseType.getType().toLowerCase(), dockerImageName);
this.databaseType = databaseType;
}
- @Override
- protected void configure() {
- withClasspathResourceMapping(String.format("/env/%s/initdb.sql", databaseType.getType().toLowerCase()), "/docker-entrypoint-initdb.d/", BindMode.READ_ONLY);
- }
-
/**
* Get jdbc url.
*
- * @param host host
- * @param port port
* @param databaseName database name
* @return jdbc url
*/
- public abstract String getJdbcUrl(String host, int port, String databaseName);
+ public abstract String getJdbcUrl(String databaseName);
+
+ /**
+ * Get database username.
+ *
+ * @return database username
+ */
+ public abstract String getUsername();
+
+ /**
+ * Get database password.
+ *
+ * @return database username
+ */
+ public abstract String getPassword();
/**
* Get database port.
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
index a0b5ae6aa55..aaf86d9ab2d 100644
--- 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
@@ -17,55 +17,61 @@
package org.apache.shardingsphere.integration.data.pipeline.framework.container.database;
-import org.apache.shardingsphere.infra.database.metadata.url.JdbcUrlAppender;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
import org.apache.shardingsphere.integration.data.pipeline.env.IntegrationTestEnvironment;
-import org.apache.shardingsphere.integration.data.pipeline.env.enums.ITEnvTypeEnum;
+import org.apache.shardingsphere.integration.data.pipeline.env.enums.ScalingITEnvTypeEnum;
import org.apache.shardingsphere.test.integration.env.DataSourceEnvironment;
import org.apache.shardingsphere.test.integration.framework.container.wait.JDBCConnectionWaitStrategy;
import org.testcontainers.containers.BindMode;
import java.sql.DriverManager;
-import java.util.Arrays;
-import java.util.Properties;
-public final class MySQLContainer extends DockerDatabaseContainer {
+public final class MySQLContainer extends DatabaseContainer {
private static final DatabaseType DATABASE_TYPE = new MySQLDatabaseType();
+ private final String username = "root";
+
+ private final String password = "root";
+
+ private final int port = 3306;
+
public MySQLContainer(final String dockerImageName) {
super(DATABASE_TYPE, dockerImageName);
}
@Override
protected void configure() {
- super.configure();
withCommand("--sql_mode=", "--default-authentication-plugin=mysql_native_password");
- setEnv(Arrays.asList("LANG=C.UTF-8", "MYSQL_ROOT_PASSWORD=root", "MYSQL_ROOT_HOST=%"));
+ addEnv("LANG", "C.UTF-8");
+ addEnv("MYSQL_ROOT_PASSWORD", username);
+ addEnv("MYSQL_ROOT_HOST", "%");
withClasspathResourceMapping("/env/mysql/my.cnf", "/etc/mysql/my.cnf", BindMode.READ_ONLY);
withExposedPorts(getPort());
- if (ITEnvTypeEnum.NATIVE == IntegrationTestEnvironment.getInstance().getItEnvType()) {
- addFixedExposedPort(3306, 3306);
+ if (ScalingITEnvTypeEnum.NATIVE == IntegrationTestEnvironment.getInstance().getItEnvType()) {
+ addFixedExposedPort(port, port);
}
setWaitStrategy(new JDBCConnectionWaitStrategy(() -> DriverManager.getConnection(DataSourceEnvironment.getURL(DATABASE_TYPE, "localhost", getFirstMappedPort()), "root", "root")));
}
@Override
- public String getJdbcUrl(final String host, final int port, final String databaseName) {
- String jdbcUrl = DataSourceEnvironment.getURL(DATABASE_TYPE, host, port, databaseName);
- return new JdbcUrlAppender().appendQueryProperties(jdbcUrl, createQueryProperties());
+ public String getJdbcUrl(final String databaseName) {
+ return DataSourceEnvironment.getURL(DATABASE_TYPE, getHost(), getFirstMappedPort(), databaseName);
}
- private Properties createQueryProperties() {
- Properties result = new Properties();
- result.put("useSSL", Boolean.FALSE.toString());
- result.put("rewriteBatchedStatements", Boolean.TRUE.toString());
- return result;
+ @Override
+ public String getUsername() {
+ return username;
+ }
+
+ @Override
+ public String getPassword() {
+ return password;
}
@Override
public int getPort() {
- return 3306;
+ return port;
}
}
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
index d7403d83cf4..9ad71896bc7 100644
--- 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
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.integration.data.pipeline.framework.container.
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
import org.apache.shardingsphere.integration.data.pipeline.env.IntegrationTestEnvironment;
-import org.apache.shardingsphere.integration.data.pipeline.env.enums.ITEnvTypeEnum;
+import org.apache.shardingsphere.integration.data.pipeline.env.enums.ScalingITEnvTypeEnum;
import org.apache.shardingsphere.test.integration.env.DataSourceEnvironment;
import org.apache.shardingsphere.test.integration.framework.container.wait.JDBCConnectionWaitStrategy;
import org.testcontainers.containers.BindMode;
@@ -28,38 +28,53 @@ import org.testcontainers.containers.BindMode;
import java.sql.DriverManager;
/**
- * OpenGauss container for Scaling IT.
+ * OpenGauss container for Scaling IT.
*/
-public final class OpenGaussContainer extends DockerDatabaseContainer {
+public final class OpenGaussContainer extends DatabaseContainer {
private static final DatabaseType DATABASE_TYPE = new OpenGaussDatabaseType();
+ private final String username = "gaussdb";
+
+ private final String password = "Root@123";
+
+ private final int port = 5432;
+
public OpenGaussContainer(final String dockerImageName) {
super(DATABASE_TYPE, dockerImageName);
}
@Override
protected void configure() {
- super.configure();
withCommand("--max_connections=600");
- addEnv("GS_PASSWORD", "Root@123");
+ addEnv("GS_PASSWORD", password);
withClasspathResourceMapping("/env/postgresql/postgresql.conf", "/usr/local/opengauss/share/postgresql/postgresql.conf.sample", BindMode.READ_ONLY);
withPrivilegedMode(true);
- withExposedPorts(5432);
- if (ITEnvTypeEnum.NATIVE == IntegrationTestEnvironment.getInstance().getItEnvType()) {
- addFixedExposedPort(5432, 5432);
+ withExposedPorts(port);
+ if (ScalingITEnvTypeEnum.NATIVE == IntegrationTestEnvironment.getInstance().getItEnvType()) {
+ addFixedExposedPort(port, port);
}
setWaitStrategy(new JDBCConnectionWaitStrategy(() -> DriverManager.getConnection(DataSourceEnvironment.getURL(DATABASE_TYPE, "localhost", getFirstMappedPort(), "postgres"),
- "gaussdb", "Root@123")));
+ 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 getJdbcUrl(final String host, final int port, final String databaseName) {
- return DataSourceEnvironment.getURL(DATABASE_TYPE, host, port, databaseName);
+ public String getPassword() {
+ return password;
}
@Override
public int getPort() {
- return 5432;
+ return port;
}
}
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
index 77e9bf3c5b9..a2aaa93b9ec 100644
--- 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
@@ -20,44 +20,59 @@ package org.apache.shardingsphere.integration.data.pipeline.framework.container.
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
import org.apache.shardingsphere.integration.data.pipeline.env.IntegrationTestEnvironment;
-import org.apache.shardingsphere.integration.data.pipeline.env.enums.ITEnvTypeEnum;
+import org.apache.shardingsphere.integration.data.pipeline.env.enums.ScalingITEnvTypeEnum;
import org.apache.shardingsphere.test.integration.env.DataSourceEnvironment;
import org.apache.shardingsphere.test.integration.framework.container.wait.JDBCConnectionWaitStrategy;
import org.testcontainers.containers.BindMode;
import java.sql.DriverManager;
-public final class PostgreSQLContainer extends DockerDatabaseContainer {
+public final class PostgreSQLContainer extends DatabaseContainer {
private static final DatabaseType DATABASE_TYPE = new PostgreSQLDatabaseType();
+ private final String username = "root";
+
+ private final String password = "root";
+
+ private final int port = 5432;
+
public PostgreSQLContainer(final String dockerImageName) {
super(DATABASE_TYPE, dockerImageName);
}
@Override
protected void configure() {
- super.configure();
withCommand("--max_connections=600");
withCommand("--wal_level=logical");
- addEnv("POSTGRES_USER", "root");
- addEnv("POSTGRES_PASSWORD", "root");
+ addEnv("POSTGRES_USER", username);
+ addEnv("POSTGRES_PASSWORD", password);
withClasspathResourceMapping("/env/postgresql/postgresql.conf", "/etc/postgresql/postgresql.conf", BindMode.READ_ONLY);
- withExposedPorts(5432);
- if (ITEnvTypeEnum.NATIVE == IntegrationTestEnvironment.getInstance().getItEnvType()) {
- addFixedExposedPort(5432, 5432);
+ withExposedPorts(port);
+ if (ScalingITEnvTypeEnum.NATIVE == IntegrationTestEnvironment.getInstance().getItEnvType()) {
+ addFixedExposedPort(port, port);
}
setWaitStrategy(new JDBCConnectionWaitStrategy(() -> DriverManager.getConnection(DataSourceEnvironment.getURL(DATABASE_TYPE, "localhost", getFirstMappedPort(), "postgres"),
- "root", "root")));
+ 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 getJdbcUrl(final String host, final int port, final String databaseName) {
- return DataSourceEnvironment.getURL(DATABASE_TYPE, host, port, databaseName);
+ public String getPassword() {
+ return password;
}
@Override
public int getPort() {
- return 5432;
+ return port;
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/proxy/ShardingSphereProxyDockerContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/proxy/ShardingSphereProxyDockerContainer.java
index b437a690bf0..ce325d7b262 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/proxy/ShardingSphereProxyDockerContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/proxy/ShardingSphereProxyDockerContainer.java
@@ -20,11 +20,11 @@ package org.apache.shardingsphere.integration.data.pipeline.framework.container.
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.integration.data.pipeline.env.IntegrationTestEnvironment;
-import org.apache.shardingsphere.integration.data.pipeline.env.enums.ITEnvTypeEnum;
+import org.apache.shardingsphere.integration.data.pipeline.env.enums.ScalingITEnvTypeEnum;
import org.apache.shardingsphere.integration.data.pipeline.util.DatabaseTypeUtil;
import org.apache.shardingsphere.test.integration.env.DataSourceEnvironment;
-import org.apache.shardingsphere.test.integration.framework.container.wait.JDBCConnectionWaitStrategy;
import org.apache.shardingsphere.test.integration.framework.container.atomic.DockerITContainer;
+import org.apache.shardingsphere.test.integration.framework.container.wait.JDBCConnectionWaitStrategy;
import org.testcontainers.containers.BindMode;
import java.sql.DriverManager;
@@ -56,7 +56,7 @@ public final class ShardingSphereProxyDockerContainer extends DockerITContainer
private void mapConfigurationFiles() {
withClasspathResourceMapping(String.format("/env/%s/server.yaml", databaseType.getType().toLowerCase()), "/opt/shardingsphere-proxy/conf/server.yaml", BindMode.READ_ONLY);
withClasspathResourceMapping("/env/logback.xml", "/opt/shardingsphere-proxy/conf/logback.xml", BindMode.READ_ONLY);
- if (ITEnvTypeEnum.NATIVE == IntegrationTestEnvironment.getInstance().getItEnvType()) {
+ if (ScalingITEnvTypeEnum.NATIVE == IntegrationTestEnvironment.getInstance().getItEnvType()) {
addFixedExposedPort(3307, 3307);
addFixedExposedPort(5005, 3308);
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/helper/ScalingCaseHelper.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/helper/ScalingCaseHelper.java
index 6675d33bf87..d0545ab36e7 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/helper/ScalingCaseHelper.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/helper/ScalingCaseHelper.java
@@ -22,7 +22,6 @@ import org.apache.commons.lang3.tuple.Pair;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
-import org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
import java.math.BigDecimal;
@@ -41,21 +40,11 @@ public final class ScalingCaseHelper {
/**
* Get query properties by database type.
*
- * @param databaseType database type
* @return query properties
*/
- public static Properties getQueryPropertiesByDatabaseType(final DatabaseType databaseType) {
+ public static Properties getPostgreSQLQueryProperties() {
Properties result = new Properties();
- if (databaseType instanceof MySQLDatabaseType) {
- result.put("useSSL", Boolean.FALSE.toString());
- result.put("rewriteBatchedStatements", Boolean.TRUE.toString());
- result.put("serverTimezone", "UTC");
- return result;
- }
- if (databaseType instanceof PostgreSQLDatabaseType || databaseType instanceof OpenGaussDatabaseType) {
- result.put("preferQueryMode", "extendedForPrepared");
- return result;
- }
+ result.put("preferQueryMode", "extendedForPrepared");
return result;
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/logger/ScalingLoggerFilter.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/logger/ScalingLoggerFilter.java
index 8bb072ab546..e879955baeb 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/logger/ScalingLoggerFilter.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/logger/ScalingLoggerFilter.java
@@ -27,7 +27,7 @@ import java.util.List;
public class ScalingLoggerFilter extends Filter<ILoggingEvent> {
- private static final List<String> IGNORE_LOGGER_NAMES = Arrays.asList(":mysql", ":zookeeper", ":postgresql");
+ private static final List<String> IGNORE_LOGGER_NAMES = Arrays.asList(":mysql", ":zookeeper", ":postgresql", ":opengauss");
private static final String[] IGNORE_ATOMIKOS_ARGS = new String[]{"- tips & advice", "- working demos", "- access to the full documentation",
"- special exclusive bonus offers not available to others"};
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/it-env.properties b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/it-env.properties
index 36d9e498e59..d440ba50b37 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/it-env.properties
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/it-env.properties
@@ -14,11 +14,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# it.cluster.env.type=DOCKER,NATIVE
-it.cluster.env.type=DOCKER
-# it.env.mysql.version=mysql:5.7,mysql:8.0
-it.env.mysql.version=
-# it.env.postgresql.version=postgres:10-alpine,postgres:11-alpine,postgres:12-alpine,postgres:13-alpine,postgres:14-alpine
-it.env.postgresql.version=
-# it.env.opengauss.version=enmotech/opengauss:3.0.0,enmotech/opengauss:2.1.0
-it.env.opengauss.version=
+# it.type=DOCKER,NATIVE
+scaling.it.env.type=
+# it.docker.mysql.version=mysql:5.7,mysql:8.0
+scaling.it.docker.mysql.version=
+# it.docker.postgresql.version=postgres:10-alpine,postgres:11-alpine,postgres:12-alpine,postgres:13-alpine,postgres:14-alpine
+scaling.it.docker.postgresql.version=
+# it.docker.opengauss.version=enmotech/opengauss:3.0.0,enmotech/opengauss:2.1.0
+scaling.it.docker.opengauss.version=
+# it.native.database=mysql or postgresql or opengauss
+scaling.it.native.database=
+scaling.it.native.mysql.username=root
+scaling.it.native.mysql.password=root
+scaling.it.native.mysql.port=3306
+scaling.it.native.postgresql.username=postgres
+scaling.it.native.postgresql.password=root
+scaling.it.native.postgresql.port=5432
+scaling.it.native.opengauss.username=gaussdb
+scaling.it.native.opengauss.password=Root@123
+scaling.it.native.opengauss.port=5432
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/initdb.sql b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/initdb.sql
index e36f72acd0d..95ab61e3196 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/initdb.sql
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/initdb.sql
@@ -17,9 +17,3 @@
CREATE USER IF NOT EXISTS 'root'@'%' IDENTIFIED BY 'root';
GRANT All privileges ON *.* TO 'root'@'%';
-
-CREATE DATABASE IF NOT EXISTS ds_0;
-CREATE DATABASE IF NOT EXISTS ds_1;
-CREATE DATABASE IF NOT EXISTS ds_2;
-CREATE DATABASE IF NOT EXISTS ds_3;
-CREATE DATABASE IF NOT EXISTS ds_4;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server.yaml
index 80ca7e8ab49..42d005156f2 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/server.yaml
@@ -20,7 +20,7 @@ mode:
repository:
type: ZooKeeper
props:
- namespace: it_db
+ namespace: it_db_mysql
server-lists: zk.host:2181
timeToLiveSeconds: 60
operationTimeoutMilliseconds: 500
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/opengauss/initdb.sql b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/opengauss/initdb.sql
deleted file mode 100644
index 7f0804f516e..00000000000
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/opengauss/initdb.sql
+++ /dev/null
@@ -1,22 +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 ds_0;
-CREATE DATABASE ds_1;
-CREATE DATABASE ds_2;
-CREATE DATABASE ds_3;
-CREATE DATABASE ds_4;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/opengauss/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/opengauss/server.yaml
index 96e201077e5..f3f80b4b4c3 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/opengauss/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/opengauss/server.yaml
@@ -20,7 +20,7 @@ mode:
repository:
type: ZooKeeper
props:
- namespace: opengauss_db
+ namespace: it_db_opengauss
server-lists: zk.host:2181
retryIntervalMilliseconds: 500
timeToLiveSeconds: 60
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/postgresql/initdb.sql b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/postgresql/initdb.sql
deleted file mode 100644
index 7f0804f516e..00000000000
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/postgresql/initdb.sql
+++ /dev/null
@@ -1,22 +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 ds_0;
-CREATE DATABASE ds_1;
-CREATE DATABASE ds_2;
-CREATE DATABASE ds_3;
-CREATE DATABASE ds_4;
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 314fee5e950..31bb91b093e 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
@@ -20,7 +20,7 @@ mode:
repository:
type: ZooKeeper
props:
- namespace: it_pgdb
+ namespace: it_db_postgresql
server-lists: zk.host:2181
retryIntervalMilliseconds: 500
timeToLiveSeconds: 60