This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 9335e9d45bb Refactor discovery integration test (#22210)
9335e9d45bb is described below
commit 9335e9d45bb6fa118c06911077623e438bd1bfe9
Author: zhaojinchao <[email protected]>
AuthorDate: Wed Nov 16 23:09:52 2022 +0800
Refactor discovery integration test (#22210)
* Refactor discovery integration test
* Update my.cnf
* Fix checkstyle
---
test/integration-test/{ha => discovery}/pom.xml | 8 +--
.../discovery}/cases/base/BaseITCase.java | 27 +++++-----
.../cases/mysql/MySQLDiscoveryGeneralIT.java} | 26 +++++-----
.../discovery}/env/IntegrationTestEnvironment.java | 22 ++------
.../discovery}/env/enums/ITEnvTypeEnum.java | 2 +-
.../container/compose/BaseContainerComposer.java | 2 +-
.../container/compose/DockerContainerComposer.java | 8 +--
.../ProxyClusterContainerConfigurationFactory.java | 2 +-
.../mysql/MySQLContainerConfigurationFactory.java | 6 +--
.../parameter/DiscoveryParameterized.java} | 4 +-
.../discovery/util/DiscoveryContainerUtil.java} | 10 ++--
.../src/test/resources/env/it-env.properties} | 17 +++----
.../src/test/resources/env/mysql/01-initdb.sql | 2 +-
.../mysql_discovery/mysql_1}/01-initdb.sql | 2 +-
.../env/scenario/mysql_discovery}/mysql_1/my.cnf | 22 +++++---
.../mysql_discovery}/mysql_2/01-initdb.sql | 2 +-
.../env/scenario/mysql_discovery/mysql_2}/my.cnf | 23 ++++++---
.../mysql_discovery/mysql_3}/01-initdb.sql | 2 +-
.../env/scenario/mysql_discovery/mysql_3}/my.cnf | 22 +++++---
.../scenario/mysql_discovery}/proxy/server.yaml | 0
.../src/test/resources/logback-test.xml | 0
.../StorageContainerConfigurationFactory.java | 50 -------------------
.../OpenGaussContainerConfigurationFactory.java | 58 ----------------------
.../PostgreSQLContainerConfigurationFactory.java | 54 --------------------
.../ha/src/test/resources/env/it-env.properties | 38 --------------
test/integration-test/pom.xml | 2 +-
26 files changed, 107 insertions(+), 304 deletions(-)
diff --git a/test/integration-test/ha/pom.xml
b/test/integration-test/discovery/pom.xml
similarity index 94%
rename from test/integration-test/ha/pom.xml
rename to test/integration-test/discovery/pom.xml
index b793db60a6d..bfff7b9d32a 100644
--- a/test/integration-test/ha/pom.xml
+++ b/test/integration-test/discovery/pom.xml
@@ -24,7 +24,7 @@
<artifactId>shardingsphere-integration-test</artifactId>
<version>5.2.2-SNAPSHOT</version>
</parent>
- <artifactId>shardingsphere-integration-test-ha</artifactId>
+ <artifactId>shardingsphere-integration-test-discovery</artifactId>
<name>${project.artifactId}</name>
<dependencies>
@@ -40,11 +40,7 @@
<version>${project.version}</version>
<type>test-jar</type>
</dependency>
-
- <dependency>
- <groupId>org.postgresql</groupId>
- <artifactId>postgresql</artifactId>
- </dependency>
+
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
diff --git
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/cases/base/BaseITCase.java
b/test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/cases/base/BaseITCase.java
similarity index 69%
rename from
test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/cases/base/BaseITCase.java
rename to
test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/cases/base/BaseITCase.java
index 28f83600013..1958ac35181 100644
---
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/cases/base/BaseITCase.java
+++
b/test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/cases/base/BaseITCase.java
@@ -15,18 +15,17 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.test.integration.ha.cases.base;
+package org.apache.shardingsphere.test.integration.discovery.cases.base;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.infra.database.metadata.url.JdbcUrlAppender;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import
org.apache.shardingsphere.test.integration.env.container.atomic.util.DatabaseTypeUtil;
-import
org.apache.shardingsphere.test.integration.ha.env.IntegrationTestEnvironment;
-import
org.apache.shardingsphere.test.integration.ha.framework.container.compose.BaseContainerComposer;
-import
org.apache.shardingsphere.test.integration.ha.framework.container.compose.DockerContainerComposer;
-import
org.apache.shardingsphere.test.integration.ha.framework.parameter.HAParameterized;
+import
org.apache.shardingsphere.test.integration.discovery.env.IntegrationTestEnvironment;
+import
org.apache.shardingsphere.test.integration.discovery.framework.container.compose.BaseContainerComposer;
+import
org.apache.shardingsphere.test.integration.discovery.framework.container.compose.DockerContainerComposer;
+import
org.apache.shardingsphere.test.integration.discovery.framework.parameter.DiscoveryParameterized;
import javax.sql.DataSource;
import java.util.List;
@@ -54,21 +53,21 @@ public abstract class BaseITCase {
private DataSource proxyDataSource;
- public BaseITCase(final HAParameterized haParameterized) {
- databaseType = haParameterized.getDatabaseType();
- containerComposer = new
DockerContainerComposer(haParameterized.getScenario(),
haParameterized.getDatabaseType(), haParameterized.getStorageContainerImage());
+ public BaseITCase(final DiscoveryParameterized discoveryParameterized) {
+ databaseType = discoveryParameterized.getDatabaseType();
+ containerComposer = new
DockerContainerComposer(discoveryParameterized.getScenario(),
discoveryParameterized.getDatabaseType(),
discoveryParameterized.getStorageContainerImage());
containerComposer.start();
- databaseName = (DatabaseTypeUtil.isPostgreSQL(databaseType) ||
DatabaseTypeUtil.isOpenGauss(databaseType)) ? "postgres" : "";
+ databaseName = "";
initStorageDataSources();
initProxyDataSource();
}
- private void initProxyDataSource() {
- proxyDataSource = containerComposer.getProxyDatasource(databaseName);
- }
-
private void initStorageDataSources() {
exposedDataSources =
containerComposer.getExposedDatasource(databaseName);
mappedDataSources =
containerComposer.getMappedDatasource(databaseName);
}
+
+ private void initProxyDataSource() {
+ proxyDataSource = containerComposer.getProxyDatasource(databaseName);
+ }
}
diff --git
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/cases/mysql/MySQLHaGeneralIT.java
b/test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/cases/mysql/MySQLDiscoveryGeneralIT.java
similarity index 66%
rename from
test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/cases/mysql/MySQLHaGeneralIT.java
rename to
test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/cases/mysql/MySQLDiscoveryGeneralIT.java
index 7cb851ba66c..7423fb530cc 100644
---
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/cases/mysql/MySQLHaGeneralIT.java
+++
b/test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/cases/mysql/MySQLDiscoveryGeneralIT.java
@@ -15,12 +15,12 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.test.integration.ha.cases.mysql;
+package org.apache.shardingsphere.test.integration.discovery.cases.mysql;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
-import org.apache.shardingsphere.test.integration.ha.cases.base.BaseITCase;
-import
org.apache.shardingsphere.test.integration.ha.framework.parameter.HAParameterized;
+import
org.apache.shardingsphere.test.integration.discovery.cases.base.BaseITCase;
+import
org.apache.shardingsphere.test.integration.discovery.framework.parameter.DiscoveryParameterized;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -32,25 +32,25 @@ import java.util.LinkedList;
import java.util.List;
/**
- * MySQL High Availability Integration Test.
+ * MySQL Discovery Integration Test.
*/
@Slf4j
@RunWith(Parameterized.class)
-public final class MySQLHaGeneralIT extends BaseITCase {
+public final class MySQLDiscoveryGeneralIT extends BaseITCase {
- private final HAParameterized haParameterized;
+ private final DiscoveryParameterized discoveryParameterized;
- public MySQLHaGeneralIT(final HAParameterized haParameterized) {
- super(haParameterized);
- this.haParameterized = haParameterized;
+ public MySQLDiscoveryGeneralIT(final DiscoveryParameterized
discoveryParameterized) {
+ super(discoveryParameterized);
+ this.discoveryParameterized = discoveryParameterized;
}
@Parameters(name = "{0}")
- public static Collection<HAParameterized> getParameters() {
- Collection<HAParameterized> result = new LinkedList<>();
+ public static Collection<DiscoveryParameterized> getParameters() {
+ Collection<DiscoveryParameterized> result = new LinkedList<>();
MySQLDatabaseType databaseType = new MySQLDatabaseType();
for (String each : ENV.listStorageContainerImages(databaseType)) {
- result.add(new HAParameterized(databaseType, each, "mysql_ha"));
+ result.add(new DiscoveryParameterized(databaseType, each,
"mysql_discovery"));
}
return result;
}
@@ -59,7 +59,7 @@ public final class MySQLHaGeneralIT extends BaseITCase {
public void assertProxyJdbcConnection() {
List<DataSource> mappedDataSources = getMappedDataSources();
List<DataSource> exposedDataSources = getExposedDataSources();
- // TODO add the MySQL HA logic here.
+ // TODO add the MySQL Discovery logic here.
mappedDataSources.forEach(each -> log.info(each.toString()));
exposedDataSources.forEach(each -> log.info(each.toString()));
}
diff --git
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/env/IntegrationTestEnvironment.java
b/test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/env/IntegrationTestEnvironment.java
similarity index 73%
rename from
test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/env/IntegrationTestEnvironment.java
rename to
test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/env/IntegrationTestEnvironment.java
index 2ccf9abe9e9..8d0b03292a2 100644
---
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/env/IntegrationTestEnvironment.java
+++
b/test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/env/IntegrationTestEnvironment.java
@@ -15,14 +15,14 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.test.integration.ha.env;
+package org.apache.shardingsphere.test.integration.discovery.env;
import com.google.common.base.Strings;
import lombok.Getter;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.test.integration.ha.env.enums.ITEnvTypeEnum;
+import
org.apache.shardingsphere.test.integration.discovery.env.enums.ITEnvTypeEnum;
import java.io.IOException;
import java.io.InputStream;
@@ -43,16 +43,10 @@ public final class IntegrationTestEnvironment {
private final List<String> mysqlVersions;
- private final List<String> postgresVersions;
-
- private final List<String> openGaussVersions;
-
private IntegrationTestEnvironment() {
props = loadProperties();
itEnvType = ITEnvTypeEnum.valueOf(props.getProperty("it.env.type",
ITEnvTypeEnum.NONE.name()).toUpperCase());
mysqlVersions =
Arrays.stream(props.getOrDefault("it.docker.mysql.version",
"").toString().split(",")).filter(each ->
!Strings.isNullOrEmpty(each)).collect(Collectors.toList());
- postgresVersions =
Arrays.stream(props.getOrDefault("it.docker.postgresql.version",
"").toString().split(",")).filter(each ->
!Strings.isNullOrEmpty(each)).collect(Collectors.toList());
- openGaussVersions =
Arrays.stream(props.getOrDefault("it.docker.opengauss.version",
"").toString().split(",")).filter(each ->
!Strings.isNullOrEmpty(each)).collect(Collectors.toList());
}
@SneakyThrows(IOException.class)
@@ -83,15 +77,9 @@ public final class IntegrationTestEnvironment {
* @return storage container images
*/
public List<String> listStorageContainerImages(final DatabaseType
databaseType) {
- switch (databaseType.getType()) {
- case "MySQL":
- return mysqlVersions;
- case "PostgreSQL":
- return postgresVersions;
- case "openGauss":
- return openGaussVersions;
- default:
- throw new UnsupportedOperationException("Unsupported database
type: " + databaseType.getType());
+ if ("MySQL".equals(databaseType.getType())) {
+ return mysqlVersions;
}
+ throw new UnsupportedOperationException("Unsupported database type: "
+ databaseType.getType());
}
}
diff --git
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/env/enums/ITEnvTypeEnum.java
b/test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/env/enums/ITEnvTypeEnum.java
similarity index 92%
rename from
test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/env/enums/ITEnvTypeEnum.java
rename to
test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/env/enums/ITEnvTypeEnum.java
index 9f4e96d2016..061a968e6f9 100644
---
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/env/enums/ITEnvTypeEnum.java
+++
b/test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/env/enums/ITEnvTypeEnum.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.test.integration.ha.env.enums;
+package org.apache.shardingsphere.test.integration.discovery.env.enums;
public enum ITEnvTypeEnum {
diff --git
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/compose/BaseContainerComposer.java
b/test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/framework/container/compose/BaseContainerComposer.java
similarity index 96%
rename from
test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/compose/BaseContainerComposer.java
rename to
test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/framework/container/compose/BaseContainerComposer.java
index a6d0cb6228c..9995aa1211c 100644
---
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/compose/BaseContainerComposer.java
+++
b/test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/framework/container/compose/BaseContainerComposer.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.test.integration.ha.framework.container.compose;
+package
org.apache.shardingsphere.test.integration.discovery.framework.container.compose;
import lombok.Getter;
import
org.apache.shardingsphere.test.integration.env.container.atomic.ITContainers;
diff --git
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/compose/DockerContainerComposer.java
b/test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/framework/container/compose/DockerContainerComposer.java
similarity index 92%
rename from
test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/compose/DockerContainerComposer.java
rename to
test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/framework/container/compose/DockerContainerComposer.java
index 6704fc5149b..2cb6c9a409e 100644
---
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/compose/DockerContainerComposer.java
+++
b/test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/framework/container/compose/DockerContainerComposer.java
@@ -15,11 +15,12 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.test.integration.ha.framework.container.compose;
+package
org.apache.shardingsphere.test.integration.discovery.framework.container.compose;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import
org.apache.shardingsphere.test.integration.discovery.framework.container.config.mysql.MySQLContainerConfigurationFactory;
import
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.AdapterContainerFactory;
import
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.config.AdaptorContainerConfiguration;
import
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.impl.ShardingSphereProxyClusterContainer;
@@ -34,8 +35,7 @@ import
org.apache.shardingsphere.test.integration.env.container.atomic.storage.c
import
org.apache.shardingsphere.test.integration.env.container.atomic.util.ContainerUtil;
import
org.apache.shardingsphere.test.integration.env.container.atomic.util.StorageContainerUtil;
import
org.apache.shardingsphere.test.integration.env.runtime.DataSourceEnvironment;
-import
org.apache.shardingsphere.test.integration.ha.framework.container.config.ProxyClusterContainerConfigurationFactory;
-import
org.apache.shardingsphere.test.integration.ha.framework.container.config.StorageContainerConfigurationFactory;
+import
org.apache.shardingsphere.test.integration.discovery.framework.container.config.ProxyClusterContainerConfigurationFactory;
import javax.sql.DataSource;
import java.util.Collections;
@@ -65,7 +65,7 @@ public final class DockerContainerComposer extends
BaseContainerComposer {
this.databaseType = databaseType;
this.storageContainers = new LinkedList<>();
governanceContainer = getContainers().registerContainer(new
ZookeeperContainer());
- List<StorageContainerConfiguration> containerConfigs =
StorageContainerConfigurationFactory.newInstance(scenario, databaseType);
+ List<StorageContainerConfiguration> containerConfigs =
MySQLContainerConfigurationFactory.newInstance(scenario, databaseType);
containerConfigs.forEach(each -> {
DockerStorageContainer storageContainer =
getContainers().registerContainer((DockerStorageContainer)
StorageContainerFactory.newInstance(databaseType, storageContainerImage, null,
each));
storageContainer.setNetworkAliases(Collections.singletonList(databaseType.getType().toLowerCase()
+ "_" + ContainerUtil.generateStorageContainerId()));
diff --git
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/config/ProxyClusterContainerConfigurationFactory.java
b/test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/framework/container/config/ProxyClusterContainerConfigurationFactory.java
similarity index 96%
rename from
test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/config/ProxyClusterContainerConfigurationFactory.java
rename to
test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/framework/container/config/ProxyClusterContainerConfigurationFactory.java
index 8cb68fa232e..49762e4efa9 100644
---
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/config/ProxyClusterContainerConfigurationFactory.java
+++
b/test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/framework/container/config/ProxyClusterContainerConfigurationFactory.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.test.integration.ha.framework.container.config;
+package
org.apache.shardingsphere.test.integration.discovery.framework.container.config;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
diff --git
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/config/mysql/MySQLContainerConfigurationFactory.java
b/test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/framework/container/config/mysql/MySQLContainerConfigurationFactory.java
similarity index 92%
rename from
test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/config/mysql/MySQLContainerConfigurationFactory.java
rename to
test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/framework/container/config/mysql/MySQLContainerConfigurationFactory.java
index 52be173eb2c..8e391a87d2b 100644
---
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/config/mysql/MySQLContainerConfigurationFactory.java
+++
b/test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/framework/container/config/mysql/MySQLContainerConfigurationFactory.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.test.integration.ha.framework.container.config.mysql;
+package
org.apache.shardingsphere.test.integration.discovery.framework.container.config.mysql;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
@@ -23,7 +23,7 @@ import
org.apache.shardingsphere.infra.database.type.DatabaseType;
import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.StorageContainerConstants;
import
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
import
org.apache.shardingsphere.test.integration.env.container.atomic.util.ContainerUtil;
-import org.apache.shardingsphere.test.integration.ha.util.HAContainerUtil;
+import
org.apache.shardingsphere.test.integration.discovery.util.DiscoveryContainerUtil;
import java.util.Collections;
import java.util.HashMap;
@@ -45,7 +45,7 @@ public final class MySQLContainerConfigurationFactory {
* @return created instance
*/
public static List<StorageContainerConfiguration> newInstance(final String
scenario, final DatabaseType databaseType) {
- Integer containerQuantity =
HAContainerUtil.loadContainerRawNamesAndQuantity(scenario).get(databaseType.getType().toLowerCase());
+ Integer containerQuantity =
DiscoveryContainerUtil.loadContainerRawNamesAndQuantity(scenario).get(databaseType.getType().toLowerCase());
if (null == containerQuantity) {
return getDefaultConfiguration(databaseType);
}
diff --git
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/parameter/HAParameterized.java
b/test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/framework/parameter/DiscoveryParameterized.java
similarity index 90%
rename from
test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/parameter/HAParameterized.java
rename to
test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/framework/parameter/DiscoveryParameterized.java
index f5e078d7908..43296539a2f 100644
---
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/parameter/HAParameterized.java
+++
b/test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/framework/parameter/DiscoveryParameterized.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.test.integration.ha.framework.parameter;
+package
org.apache.shardingsphere.test.integration.discovery.framework.parameter;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@@ -25,7 +25,7 @@ import
org.apache.shardingsphere.infra.database.type.DatabaseType;
@Getter
@RequiredArgsConstructor
@ToString
-public final class HAParameterized {
+public final class DiscoveryParameterized {
private final DatabaseType databaseType;
diff --git
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/util/HAContainerUtil.java
b/test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/util/DiscoveryContainerUtil.java
similarity index 90%
rename from
test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/util/HAContainerUtil.java
rename to
test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/util/DiscoveryContainerUtil.java
index e22f6240762..0ea5435f062 100644
---
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/util/HAContainerUtil.java
+++
b/test/integration-test/discovery/src/test/java/org/apache/shardingsphere/test/integration/discovery/util/DiscoveryContainerUtil.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.test.integration.ha.util;
+package org.apache.shardingsphere.test.integration.discovery.util;
import lombok.NoArgsConstructor;
@@ -25,10 +25,10 @@ import java.util.HashMap;
import java.util.Map;
/**
- * HA container utility.
+ * Discovery container utility.
*/
@NoArgsConstructor
-public final class HAContainerUtil {
+public final class DiscoveryContainerUtil {
/**
* Get container names and quantity.
@@ -39,9 +39,9 @@ public final class HAContainerUtil {
Map<String, Integer> result = new HashMap<>(3, 1);
ClassLoader classLoader =
Thread.currentThread().getContextClassLoader();
URL resource = classLoader.getResource("env/scenario/" + scenario);
- if (resource != null) {
+ if (null != resource) {
String[] containerNames = new File(resource.getPath()).list((dir,
name) -> new File(dir, name).isDirectory());
- if (containerNames != null) {
+ if (null != containerNames) {
result = extractContainerNamesWithQuantity(containerNames);
}
}
diff --git
a/test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/mysql_1/my.cnf
b/test/integration-test/discovery/src/test/resources/env/it-env.properties
similarity index 82%
copy from
test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/mysql_1/my.cnf
copy to test/integration-test/discovery/src/test/resources/env/it-env.properties
index 1a0e57d805e..cf159af24b3 100644
---
a/test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/mysql_1/my.cnf
+++ b/test/integration-test/discovery/src/test/resources/env/it-env.properties
@@ -14,14 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
-[mysql]
-
-[mysqld]
-server-id=1
-log-bin=mysql-bin
-binlog-format=row
-binlog-row-image=full
-max_connections=600
-# for mysql 8.0
-secure_file_priv=/var/lib/mysql
+# it.type=NONE,DOCKER,NATIVE
+it.env.type=NONE
+# it.env.cases=mysql_discovery
+it.env.cases=
+# it.docker.mysql.version=mysql:5.7,mysql:8.0
+it.docker.mysql.version=
diff --git
a/test/integration-test/ha/src/test/resources/env/mysql/01-initdb.sql
b/test/integration-test/discovery/src/test/resources/env/mysql/01-initdb.sql
similarity index 96%
rename from test/integration-test/ha/src/test/resources/env/mysql/01-initdb.sql
rename to
test/integration-test/discovery/src/test/resources/env/mysql/01-initdb.sql
index b46490db647..657f32059ac 100644
--- a/test/integration-test/ha/src/test/resources/env/mysql/01-initdb.sql
+++ b/test/integration-test/discovery/src/test/resources/env/mysql/01-initdb.sql
@@ -15,7 +15,7 @@
-- limitations under the License.
--
-CREATE DATABASE ha_test;
+CREATE DATABASE discovery_test;
GRANT REPLICATION CLIENT, REPLICATION SLAVE, SELECT, INSERT, UPDATE, DELETE,
INDEX ON *.* TO `test_user`@`%`;
GRANT CREATE, DROP ON TABLE *.* TO test_user;
diff --git
a/test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/mysql_3/01-initdb.sql
b/test/integration-test/discovery/src/test/resources/env/scenario/mysql_discovery/mysql_1/01-initdb.sql
similarity index 96%
rename from
test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/mysql_3/01-initdb.sql
rename to
test/integration-test/discovery/src/test/resources/env/scenario/mysql_discovery/mysql_1/01-initdb.sql
index b57a1c65e14..bd71ad0163c 100644
---
a/test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/mysql_3/01-initdb.sql
+++
b/test/integration-test/discovery/src/test/resources/env/scenario/mysql_discovery/mysql_1/01-initdb.sql
@@ -15,4 +15,4 @@
-- limitations under the License.
--
-CREATE DATABASE ha_test;
+CREATE DATABASE discovery_test;
diff --git
a/test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/mysql_1/my.cnf
b/test/integration-test/discovery/src/test/resources/env/scenario/mysql_discovery/mysql_1/my.cnf
similarity index 58%
rename from
test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/mysql_1/my.cnf
rename to
test/integration-test/discovery/src/test/resources/env/scenario/mysql_discovery/mysql_1/my.cnf
index 1a0e57d805e..39152346b6f 100644
---
a/test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/mysql_1/my.cnf
+++
b/test/integration-test/discovery/src/test/resources/env/scenario/mysql_discovery/mysql_1/my.cnf
@@ -18,10 +18,18 @@
[mysql]
[mysqld]
-server-id=1
-log-bin=mysql-bin
-binlog-format=row
-binlog-row-image=full
-max_connections=600
-# for mysql 8.0
-secure_file_priv=/var/lib/mysql
+server_id = 100
+gtid_mode = ON
+enforce_gtid_consistency = ON
+master_info_repository = TABLE
+relay_log_info_repository = TABLE
+binlog_checksum = NONE
+log_slave_updates = ON
+log_bin = binlog
+binlog_format = ROW
+transaction_write_set_extraction = XXHASH64
+loose-group_replication_group_name = '558edd3c-02ec-11ea-9bb3-080027e39bd2'
+loose-group_replication_start_on_boot = OFF
+loose-group_replication_local_address = '127.0.0.1:10001'
+loose-group_replication_group_seeds =
'127.0.0.1:10001,127.0.0.1:10002,127.0.0.1:10003'
+loose-group_replication_bootstrap_group = OFF
diff --git
a/test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/mysql_2/01-initdb.sql
b/test/integration-test/discovery/src/test/resources/env/scenario/mysql_discovery/mysql_2/01-initdb.sql
similarity index 96%
rename from
test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/mysql_2/01-initdb.sql
rename to
test/integration-test/discovery/src/test/resources/env/scenario/mysql_discovery/mysql_2/01-initdb.sql
index b57a1c65e14..bd71ad0163c 100644
---
a/test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/mysql_2/01-initdb.sql
+++
b/test/integration-test/discovery/src/test/resources/env/scenario/mysql_discovery/mysql_2/01-initdb.sql
@@ -15,4 +15,4 @@
-- limitations under the License.
--
-CREATE DATABASE ha_test;
+CREATE DATABASE discovery_test;
diff --git
a/test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/mysql_3/my.cnf
b/test/integration-test/discovery/src/test/resources/env/scenario/mysql_discovery/mysql_2/my.cnf
similarity index 58%
rename from
test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/mysql_3/my.cnf
rename to
test/integration-test/discovery/src/test/resources/env/scenario/mysql_discovery/mysql_2/my.cnf
index 1a0e57d805e..a0ce1691b8f 100644
---
a/test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/mysql_3/my.cnf
+++
b/test/integration-test/discovery/src/test/resources/env/scenario/mysql_discovery/mysql_2/my.cnf
@@ -18,10 +18,19 @@
[mysql]
[mysqld]
-server-id=1
-log-bin=mysql-bin
-binlog-format=row
-binlog-row-image=full
-max_connections=600
-# for mysql 8.0
-secure_file_priv=/var/lib/mysql
+server_id = 101
+gtid_mode = ON
+enforce_gtid_consistency = ON
+master_info_repository = TABLE
+relay_log_info_repository = TABLE
+binlog_checksum = NONE
+log_slave_updates = ON
+log_bin = binlog
+binlog_format= ROW
+transaction_write_set_extraction = XXHASH64
+loose-group_replication_group_name = '558edd3c-02ec-11ea-9bb3-080027e39bd2'
+loose-group_replication_start_on_boot = OFF
+loose-group_replication_local_address = '127.0.0.1:10002'
+loose-group_replication_group_seeds
'127.0.0.1:10001,127.0.0.1:10002,127.0.0.1:10003'
+loose-group_replication_bootstrap_group = OFF
+
diff --git
a/test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/mysql_1/01-initdb.sql
b/test/integration-test/discovery/src/test/resources/env/scenario/mysql_discovery/mysql_3/01-initdb.sql
similarity index 96%
rename from
test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/mysql_1/01-initdb.sql
rename to
test/integration-test/discovery/src/test/resources/env/scenario/mysql_discovery/mysql_3/01-initdb.sql
index b57a1c65e14..bd71ad0163c 100644
---
a/test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/mysql_1/01-initdb.sql
+++
b/test/integration-test/discovery/src/test/resources/env/scenario/mysql_discovery/mysql_3/01-initdb.sql
@@ -15,4 +15,4 @@
-- limitations under the License.
--
-CREATE DATABASE ha_test;
+CREATE DATABASE discovery_test;
diff --git
a/test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/mysql_2/my.cnf
b/test/integration-test/discovery/src/test/resources/env/scenario/mysql_discovery/mysql_3/my.cnf
similarity index 58%
rename from
test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/mysql_2/my.cnf
rename to
test/integration-test/discovery/src/test/resources/env/scenario/mysql_discovery/mysql_3/my.cnf
index 1a0e57d805e..14dc12ba18f 100644
---
a/test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/mysql_2/my.cnf
+++
b/test/integration-test/discovery/src/test/resources/env/scenario/mysql_discovery/mysql_3/my.cnf
@@ -18,10 +18,18 @@
[mysql]
[mysqld]
-server-id=1
-log-bin=mysql-bin
-binlog-format=row
-binlog-row-image=full
-max_connections=600
-# for mysql 8.0
-secure_file_priv=/var/lib/mysql
+server_id = 102
+gtid_mode = ON
+enforce_gtid_consistency = ON
+master_info_repository = TABLE
+relay_log_info_repository = TABLE
+binlog_checksum = NONE
+log_slave_updates = ON
+log_bin = binlog
+binlog_format= ROW
+transaction_write_set_extraction = XXHASH64
+loose-group_replication_group_name = '558edd3c-02ec-11ea-9bb3-080027e39bd2'
+loose-group_replication_start_on_boot = OFF
+loose-group_replication_local_address = '127.0.0.1:10003'
+loose-group_replication_group_seeds
'127.0.0.1:10001,127.0.0.1:10002,127.0.0.1:10003'
+loose-group_replication_bootstrap_group = OFF
diff --git
a/test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/proxy/server.yaml
b/test/integration-test/discovery/src/test/resources/env/scenario/mysql_discovery/proxy/server.yaml
similarity index 100%
rename from
test/integration-test/ha/src/test/resources/env/scenario/mysql_ha/proxy/server.yaml
rename to
test/integration-test/discovery/src/test/resources/env/scenario/mysql_discovery/proxy/server.yaml
diff --git a/test/integration-test/ha/src/test/resources/logback-test.xml
b/test/integration-test/discovery/src/test/resources/logback-test.xml
similarity index 100%
rename from test/integration-test/ha/src/test/resources/logback-test.xml
rename to test/integration-test/discovery/src/test/resources/logback-test.xml
diff --git
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/config/StorageContainerConfigurationFactory.java
b/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/config/StorageContainerConfigurationFactory.java
deleted file mode 100644
index 322de371511..00000000000
---
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/config/StorageContainerConfigurationFactory.java
+++ /dev/null
@@ -1,50 +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.test.integration.ha.framework.container.config;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
-import
org.apache.shardingsphere.test.integration.ha.framework.container.config.mysql.MySQLContainerConfigurationFactory;
-
-import java.util.List;
-
-/**
- * Storage container configuration factory.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class StorageContainerConfigurationFactory {
-
- /**
- * Create new instance of storage container configuration.
- *
- * @param scenario scenario
- * @param databaseType database type
- * @return created instance
- */
- public static List<StorageContainerConfiguration> newInstance(final String
scenario, final DatabaseType databaseType) {
- switch (databaseType.getType()) {
- case "MySQL":
- return
MySQLContainerConfigurationFactory.newInstance(scenario, databaseType);
- // TODO please add other configuration factory for PG or OG if
there is HA solution for these database types.
- default:
- throw new RuntimeException(String.format("Database `%s` is
unknown.", databaseType.getType()));
- }
- }
-}
diff --git
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/config/opengauss/OpenGaussContainerConfigurationFactory.java
b/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/config/opengauss/OpenGaussContainerConfigurationFactory.java
deleted file mode 100644
index 685278d193e..00000000000
---
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/config/opengauss/OpenGaussContainerConfigurationFactory.java
+++ /dev/null
@@ -1,58 +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.test.integration.ha.framework.container.config.opengauss;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.StorageContainerConstants;
-import
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * OpenGauss container configuration factory.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class OpenGaussContainerConfigurationFactory {
-
- /**
- * Create new instance of openGauss container configuration.
- *
- * @return created instance
- */
- public static StorageContainerConfiguration newInstance() {
- return new StorageContainerConfiguration(getCommand(),
getContainerEnvironments(), getMountedResources());
- }
-
- private static String getCommand() {
- return "";
- }
-
- private static Map<String, String> getContainerEnvironments() {
- return Collections.singletonMap("GS_PASSWORD",
StorageContainerConstants.PASSWORD);
- }
-
- private static Map<String, String> getMountedResources() {
- Map<String, String> result = new HashMap<>(2, 1);
- result.put("/env/postgresql/postgresql.conf",
StorageContainerConstants.OPENGAUSS_CONF_IN_CONTAINER);
- result.put("/env/opengauss/pg_hba.conf",
StorageContainerConstants.OPENGAUSS_HBA_IN_CONF_CONTAINER);
- return result;
- }
-}
diff --git
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/config/postgresql/PostgreSQLContainerConfigurationFactory.java
b/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/config/postgresql/PostgreSQLContainerConfigurationFactory.java
deleted file mode 100644
index fec8f42378d..00000000000
---
a/test/integration-test/ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/config/postgresql/PostgreSQLContainerConfigurationFactory.java
+++ /dev/null
@@ -1,54 +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.test.integration.ha.framework.container.config.postgresql;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.StorageContainerConstants;
-import
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
-
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * PostgreSQL container configuration factory.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class PostgreSQLContainerConfigurationFactory {
-
- /**
- * Create new instance of PostgreSQL container configuration.
- *
- * @return created instance
- */
- public static StorageContainerConfiguration newInstance() {
- return new StorageContainerConfiguration(getCommand(),
getContainerEnvironments(), getMountedResources());
- }
-
- private static String getCommand() {
- return "-c config_file=" +
StorageContainerConstants.POSTGRESQL_CONF_IN_CONTAINER;
- }
-
- private static Map<String, String> getContainerEnvironments() {
- return Collections.singletonMap("POSTGRES_PASSWORD",
StorageContainerConstants.PASSWORD);
- }
-
- private static Map<String, String> getMountedResources() {
- return Collections.singletonMap("/env/postgresql/postgresql.conf",
StorageContainerConstants.POSTGRESQL_CONF_IN_CONTAINER);
- }
-}
diff --git a/test/integration-test/ha/src/test/resources/env/it-env.properties
b/test/integration-test/ha/src/test/resources/env/it-env.properties
deleted file mode 100644
index c8b45531ddc..00000000000
--- a/test/integration-test/ha/src/test/resources/env/it-env.properties
+++ /dev/null
@@ -1,38 +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.
-#
-# it.type=NONE,DOCKER,NATIVE
-it.env.type=NONE
-# it.env.cases=mysql_ha
-it.env.cases=
-# it.docker.mysql.version=mysql:5.7,mysql:8.0
-it.docker.mysql.version=
-#
it.docker.postgresql.version=postgres:10-alpine,postgres:11-alpine,postgres:12-alpine,postgres:13-alpine,postgres:14-alpine
-it.docker.postgresql.version=
-# it.docker.opengauss.version=enmotech/opengauss:3.0.0,enmotech/opengauss:2.1.0
-it.docker.opengauss.version=
-# it.native.database=mysql or postgresql or opengauss
-#it.native.database=
-#it.native.mysql.username=root
-#it.native.mysql.password=root
-#it.native.mysql.port=3306
-#it.native.postgresql.username=postgres
-#it.native.postgresql.password=root
-#it.native.postgresql.port=5432
-#it.native.opengauss.username=gaussdb
-#it.native.opengauss.password=Root@123
-#it.native.opengauss.port=5432
-
diff --git a/test/integration-test/pom.xml b/test/integration-test/pom.xml
index 3c2e78d8edf..f8da0fafc2c 100644
--- a/test/integration-test/pom.xml
+++ b/test/integration-test/pom.xml
@@ -34,7 +34,7 @@
<module>test-suite</module>
<module>scaling</module>
<module>transaction</module>
- <module>ha</module>
+ <module>discovery</module>
<module>showprocesslist</module>
</modules>