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 4d98673f7e3 Refactor transaction container (#20200)
4d98673f7e3 is described below
commit 4d98673f7e35ca4a60cea808778e6766e24359e5
Author: 孙念君 Nianjun Sun <[email protected]>
AuthorDate: Tue Aug 16 19:30:53 2022 +0800
Refactor transaction container (#20200)
* Refactor : reafctor the transaction storage container(#19627)
* Refactor : refactor the user/pass
* Refactor : refactor the initial sql file
* Revert : revert the transaction config files
* Refactor : change the default user/pass for proxy in transaction test
* Fix : fix an error proxy password
* Fix : fix a pg conainer command initialization issue
* Refactor : update the role name of opengauss
* Refactor : refactor the opengauss container
* Refactor : refactor the transaction it as code conduct
* Refactor : refactor as the reviewer's suggestion
---
.../atomic/storage/DockerStorageContainer.java | 17 +++++--
.../mysql/MySQLContainerConfigurationFactory.java | 2 +-
.../OpenGaussContainerConfigurationFactory.java | 2 +-
.../PostgreSQLContainerConfigurationFactory.java | 2 +-
.../atomic/storage/impl/OpenGaussContainer.java | 9 +++-
.../container/init-sql/mysql/00-init-authority.sql | 1 +
.../init-sql/opengauss/00-init-authority.sql | 2 +-
.../transaction/engine/base/BaseITCase.java | 16 +++----
.../transaction/engine/base/JDBCDataSource.java | 1 -
.../env/IntegrationTestEnvironment.java | 35 +++++---------
.../container/compose/DockerComposedContainer.java | 14 +++---
.../StorageContainerConfigurationFactory.java | 55 ++++++++++++++++++++++
.../mysql/MySQLContainerConfigurationFactory.java | 15 +++---
.../OpenGaussContainerConfigurationFactory.java | 17 ++++---
.../PostgreSQLContainerConfigurationFactory.java | 16 ++++---
.../jdbc/ShardingSphereJDBCContainer.java | 6 +--
.../proxy/ShardingSphereProxyDockerContainer.java | 8 ++--
.../env/mysql/{initdb.sql => 01-initdb.sql} | 3 +-
.../src/test/resources/env/mysql/server.yaml | 2 +-
.../test/resources/env/opengauss/01-initdb.sql} | 4 +-
.../src/test/resources/env/opengauss/server.yaml | 2 +-
.../test/resources/env/postgresql/01-initdb.sql} | 2 -
.../src/test/resources/env/postgresql/server.yaml | 2 +-
.../resources/env/transaction-it-env.properties | 6 +--
24 files changed, 148 insertions(+), 91 deletions(-)
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/DockerStorageContainer.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/DockerStorageContainer.java
index 3a88e4a7d7d..aa76d1ec8da 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/DockerStorageContainer.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/DockerStorageContainer.java
@@ -45,6 +45,7 @@ import java.util.Optional;
@Getter
public abstract class DockerStorageContainer extends DockerITContainer
implements StorageContainer {
+ @Getter
private final DatabaseType databaseType;
@Getter(AccessLevel.NONE)
@@ -110,7 +111,7 @@ public abstract class DockerStorageContainer extends
DockerITContainer implement
public DataSource createAccessDataSource(final String dataSourceName) {
HikariDataSource result = new HikariDataSource();
result.setDriverClassName(DataSourceEnvironment.getDriverClassName(databaseType));
- result.setJdbcUrl(DataSourceEnvironment.getURL(databaseType,
getHost(), getMappedPort(getPort()), dataSourceName));
+ result.setJdbcUrl(getJdbcUrl(dataSourceName));
result.setUsername(getUsername());
result.setPassword(getUnifiedPassword());
result.setMaximumPoolSize(4);
@@ -118,16 +119,22 @@ public abstract class DockerStorageContainer extends
DockerITContainer implement
return result;
}
+ /**
+ * Get JDBC URL.
+ *
+ * @param dataSourceName datasource name
+ * @return JDBC URL
+ */
+ public String getJdbcUrl(final String dataSourceName) {
+ return DataSourceEnvironment.getURL(databaseType, getHost(),
getMappedPort(getPort()), dataSourceName);
+ }
+
/**
* Get username.
*
* @return username
*/
public final String getUsername() {
- return getNormalUsername();
- }
-
- protected final String getNormalUsername() {
return "test_user";
}
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/mysql/MySQLContainerConfigurationFactory.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/mysql/MySQLContainerConfigurationFactory.java
index b125c1cef9a..15de2c0a062 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/mysql/MySQLContainerConfigurationFactory.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/mysql/MySQLContainerConfigurationFactory.java
@@ -33,7 +33,7 @@ import java.util.Map;
public final class MySQLContainerConfigurationFactory {
/**
- * Create new instance of mysql container configuration.
+ * Create new instance of MySQL container configuration.
*
* @return created instance
*/
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/opengauss/OpenGaussContainerConfigurationFactory.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/opengauss/OpenGaussContainerConfigurationFactory.java
index b2d9614bc36..5659ad313a8 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/opengauss/OpenGaussContainerConfigurationFactory.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/opengauss/OpenGaussContainerConfigurationFactory.java
@@ -32,7 +32,7 @@ import java.util.Map;
public final class OpenGaussContainerConfigurationFactory {
/**
- * Create new instance of opengauss container configuration.
+ * Create new instance of openGauss container configuration.
*
* @return created instance
*/
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/postgresql/PostgreSQLContainerConfigurationFactory.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/postgresql/PostgreSQLContainerConfigurationFactory.java
index df319667a28..d3825132989 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/postgresql/PostgreSQLContainerConfigurationFactory.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/postgresql/PostgreSQLContainerConfigurationFactory.java
@@ -31,7 +31,7 @@ import java.util.Map;
public final class PostgreSQLContainerConfigurationFactory {
/**
- * Create new instance of postgresql container configuration.
+ * Create new instance of PostgreSQL container configuration.
*
* @return created instance
*/
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/OpenGaussContainer.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/OpenGaussContainer.java
index 566a2d92eea..19c6ef3c3c6 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/OpenGaussContainer.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/OpenGaussContainer.java
@@ -18,9 +18,11 @@
package
org.apache.shardingsphere.test.integration.env.container.atomic.storage.impl;
import com.google.common.base.Strings;
+import org.apache.commons.lang3.StringUtils;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeFactory;
import
org.apache.shardingsphere.test.integration.env.container.atomic.storage.DockerStorageContainer;
import
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
+import
org.apache.shardingsphere.test.integration.env.runtime.DataSourceEnvironment;
import java.util.Optional;
@@ -52,6 +54,11 @@ public final class OpenGaussContainer extends
DockerStorageContainer {
@Override
protected Optional<String> getDefaultDatabaseName() {
- return Optional.of("postgres");
+ return Optional.of("test_user");
+ }
+
+ @Override
+ public String getJdbcUrl(final String dataSourceName) {
+ return DataSourceEnvironment.getURL(getDatabaseType(), getHost(),
getMappedPort(getPort()), StringUtils.isNotEmpty(dataSourceName) ?
dataSourceName : "test_user");
}
}
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/container/init-sql/mysql/00-init-authority.sql
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/container/init-sql/mysql/00-init-authority.sql
index fa57a26c931..be9f8e84577 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/container/init-sql/mysql/00-init-authority.sql
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/container/init-sql/mysql/00-init-authority.sql
@@ -17,3 +17,4 @@
CREATE USER IF NOT EXISTS 'test_user'@'%' IDENTIFIED BY 'Test@123';
GRANT ALL ON *.* TO 'test_user'@'%';
+
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/container/init-sql/opengauss/00-init-authority.sql
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/container/init-sql/opengauss/00-init-authority.sql
index 6aff8379dc4..94149dfba63 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/container/init-sql/opengauss/00-init-authority.sql
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/container/init-sql/opengauss/00-init-authority.sql
@@ -16,5 +16,5 @@
--
CREATE USER test_user WITH ENCRYPTED PASSWORD 'Test@123';
-ALTER ROLE test_user Superuser;
+ALTER ROLE test_user SYSADMIN;
CREATE DATABASE test_user;
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/base/BaseITCase.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/base/BaseITCase.java
index 6a0eb0a4698..11bbdc55401 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/base/BaseITCase.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/base/BaseITCase.java
@@ -39,9 +39,9 @@ import
org.apache.shardingsphere.integration.transaction.env.enums.TransactionTe
import
org.apache.shardingsphere.integration.transaction.framework.container.compose.BaseComposedContainer;
import
org.apache.shardingsphere.integration.transaction.framework.container.compose.DockerComposedContainer;
import
org.apache.shardingsphere.integration.transaction.framework.container.compose.NativeComposedContainer;
-import
org.apache.shardingsphere.integration.transaction.framework.container.database.DatabaseContainer;
import
org.apache.shardingsphere.integration.transaction.framework.param.TransactionParameterized;
import
org.apache.shardingsphere.integration.transaction.util.TransactionTestCaseClassScanner;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.storage.DockerStorageContainer;
import
org.apache.shardingsphere.test.integration.env.container.atomic.util.DatabaseTypeUtil;
import
org.apache.shardingsphere.test.integration.env.runtime.DataSourceEnvironment;
import org.apache.shardingsphere.transaction.core.TransactionType;
@@ -128,7 +128,7 @@ public abstract class BaseITCase {
private void createJdbcDataSource() {
if (composedContainer instanceof DockerComposedContainer) {
DockerComposedContainer dockerComposedContainer =
(DockerComposedContainer) composedContainer;
- DatabaseContainer databaseContainer =
dockerComposedContainer.getDatabaseContainer();
+ DockerStorageContainer databaseContainer =
dockerComposedContainer.getStorageContainer();
Map<String, DataSource> actualDataSourceMap =
databaseContainer.getActualDataSourceMap();
actualDataSourceMap.put("ds_0",
createDataSource(databaseContainer, DS_0));
actualDataSourceMap.put("ds_1",
createDataSource(databaseContainer, DS_1));
@@ -136,12 +136,12 @@ public abstract class BaseITCase {
}
}
- private DataSource createDataSource(final DatabaseContainer
databaseContainer, final String dataSourceName) {
+ private DataSource createDataSource(final DockerStorageContainer
databaseContainer, final String dataSourceName) {
HikariDataSource result = new HikariDataSource();
result.setDriverClassName(DataSourceEnvironment.getDriverClassName(databaseType));
result.setJdbcUrl(DataSourceEnvironment.getURL(databaseType,
databaseContainer.getHost(),
databaseContainer.getMappedPort(databaseContainer.getPort()), dataSourceName));
result.setUsername(databaseContainer.getUsername());
- result.setPassword(databaseContainer.getPassword());
+ result.setPassword(databaseContainer.getUnifiedPassword());
result.setMaximumPoolSize(4);
result.setTransactionIsolation("TRANSACTION_READ_COMMITTED");
return result;
@@ -306,7 +306,7 @@ public abstract class BaseITCase {
String jdbcUrl;
if (ENV.getItEnvType() == TransactionITEnvTypeEnum.DOCKER) {
DockerComposedContainer dockerComposedContainer =
(DockerComposedContainer) composedContainer;
- DatabaseContainer databaseContainer =
dockerComposedContainer.getDatabaseContainer();
+ DockerStorageContainer databaseContainer =
dockerComposedContainer.getStorageContainer();
jdbcUrl = databaseContainer.getJdbcUrl("");
} else {
jdbcUrl = DataSourceEnvironment.getURL(databaseType, "localhost",
jdbcInfo.getPort());
@@ -318,8 +318,8 @@ public abstract class BaseITCase {
JdbcInfoEntity jdbcInfo;
if (ENV.getItEnvType() == TransactionITEnvTypeEnum.DOCKER) {
DockerComposedContainer dockerComposedContainer =
(DockerComposedContainer) composedContainer;
- DatabaseContainer databaseContainer =
dockerComposedContainer.getDatabaseContainer();
- jdbcInfo = new JdbcInfoEntity(databaseContainer.getUsername(),
databaseContainer.getPassword(), databaseContainer.getPort());
+ DockerStorageContainer databaseContainer =
dockerComposedContainer.getStorageContainer();
+ jdbcInfo = new JdbcInfoEntity(databaseContainer.getUsername(),
databaseContainer.getUnifiedPassword(), databaseContainer.getPort());
} else {
jdbcInfo = ENV.getActualDatabaseJdbcInfo(getDatabaseType());
}
@@ -468,7 +468,7 @@ public abstract class BaseITCase {
private String getActualJdbcUrlTemplate(final String databaseName) {
if (ENV.getItEnvType() == TransactionITEnvTypeEnum.DOCKER) {
- final DatabaseContainer databaseContainer =
((DockerComposedContainer) composedContainer).getDatabaseContainer();
+ final DockerStorageContainer databaseContainer =
((DockerComposedContainer) composedContainer).getStorageContainer();
return DataSourceEnvironment.getURL(getDatabaseType(),
getDatabaseType().getType().toLowerCase() + ".host",
databaseContainer.getPort(), databaseName);
} else {
return DataSourceEnvironment.getURL(getDatabaseType(),
"127.0.0.1", ENV.getActualDataSourceDefaultPort(databaseType), databaseName);
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/base/JDBCDataSource.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/base/JDBCDataSource.java
index 08dfd7dda27..576ceb933b5 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/base/JDBCDataSource.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/base/JDBCDataSource.java
@@ -56,5 +56,4 @@ public final class JDBCDataSource extends AutoDataSource {
private Connection createConnection() throws SQLException {
return
composedContainer.getJdbcContainer().getTargetDataSource().getConnection();
}
-
}
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/env/IntegrationTestEnvironment.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/env/IntegrationTestEnvironment.java
index c019390cd69..4ebf5aac9fc 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/env/IntegrationTestEnvironment.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/env/IntegrationTestEnvironment.java
@@ -24,7 +24,6 @@ import
org.apache.shardingsphere.infra.database.type.DatabaseType;
import
org.apache.shardingsphere.integration.transaction.engine.entity.JdbcInfoEntity;
import
org.apache.shardingsphere.integration.transaction.env.enums.TransactionITEnvTypeEnum;
import
org.apache.shardingsphere.integration.transaction.env.enums.TransactionTestCaseRegistry;
-import
org.apache.shardingsphere.test.integration.env.container.atomic.util.DatabaseTypeUtil;
import java.io.IOException;
import java.io.InputStream;
@@ -165,16 +164,10 @@ public final class IntegrationTestEnvironment {
* @return actual data source username
*/
public String getActualDataSourceUsername(final DatabaseType databaseType)
{
- String username;
- if (DatabaseTypeUtil.isOpenGauss(databaseType)) {
- username = "gaussdb";
- } else {
- username = "root";
- }
- if (itEnvType == TransactionITEnvTypeEnum.NATIVE) {
- username =
String.valueOf(props.getOrDefault(String.format("transaction.it.native.%s.username",
databaseType.getType().toLowerCase()), username));
- }
- return username;
+ String username = "test_user";
+ return itEnvType == TransactionITEnvTypeEnum.NATIVE
+ ?
String.valueOf(props.getOrDefault(String.format("transaction.it.native.%s.username",
databaseType.getType().toLowerCase()), username))
+ : username;
}
/**
@@ -184,16 +177,10 @@ public final class IntegrationTestEnvironment {
* @return actual data source username
*/
public String getActualDataSourcePassword(final DatabaseType databaseType)
{
- String password;
- if (DatabaseTypeUtil.isOpenGauss(databaseType)) {
- password = "Root@123";
- } else {
- password = "root";
- }
- if (itEnvType == TransactionITEnvTypeEnum.NATIVE) {
- password =
props.getOrDefault(String.format("transaction.it.native.%s.password",
databaseType.getType().toLowerCase()), password).toString();
- }
- return password;
+ String password = "Test@123";
+ return itEnvType == TransactionITEnvTypeEnum.NATIVE
+ ?
props.getOrDefault(String.format("transaction.it.native.%s.password",
databaseType.getType().toLowerCase()), password).toString()
+ : password;
}
/**
@@ -202,7 +189,8 @@ public final class IntegrationTestEnvironment {
* @return proxy password
*/
public String getProxyPassword() {
- return props.getOrDefault("transaction.it.proxy.password",
"root").toString();
+ // TODO this should extract into a constant
+ return props.getOrDefault("transaction.it.proxy.password",
"Proxy@123").toString();
}
/**
@@ -211,7 +199,8 @@ public final class IntegrationTestEnvironment {
* @return proxy userName
*/
public String getProxyUserName() {
- return props.getOrDefault("transaction.it.proxy.username",
"root").toString();
+ // TODO this should extract into a constant
+ return props.getOrDefault("transaction.it.proxy.username",
"proxy").toString();
}
/**
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/compose/DockerComposedContainer.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/compose/DockerComposedContainer.java
index 555343f96db..ca98d809ad7 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/compose/DockerComposedContainer.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/compose/DockerComposedContainer.java
@@ -22,13 +22,14 @@ import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import
org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
-import
org.apache.shardingsphere.integration.transaction.factory.DatabaseContainerFactory;
-import
org.apache.shardingsphere.integration.transaction.framework.container.database.DatabaseContainer;
+import
org.apache.shardingsphere.integration.transaction.framework.container.config.StorageContainerConfigurationFactory;
import
org.apache.shardingsphere.integration.transaction.framework.container.jdbc.ShardingSphereJDBCContainer;
import
org.apache.shardingsphere.integration.transaction.framework.container.proxy.ShardingSphereProxyDockerContainer;
import
org.apache.shardingsphere.integration.transaction.framework.param.TransactionParameterized;
import
org.apache.shardingsphere.test.integration.env.container.atomic.governance.GovernanceContainer;
import
org.apache.shardingsphere.test.integration.env.container.atomic.governance.impl.ZookeeperContainer;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.storage.DockerStorageContainer;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.storage.StorageContainerFactory;
import
org.apache.shardingsphere.test.integration.env.runtime.DataSourceEnvironment;
import java.util.Objects;
@@ -48,20 +49,21 @@ public final class DockerComposedContainer extends
BaseComposedContainer {
private final ShardingSphereJDBCContainer jdbcContainer;
- private final DatabaseContainer databaseContainer;
+ private final DockerStorageContainer storageContainer;
public DockerComposedContainer(final TransactionParameterized
parameterized) {
this.databaseType = parameterized.getDatabaseType();
governanceContainer = getContainers().registerContainer(new
ZookeeperContainer());
- databaseContainer =
getContainers().registerContainer(DatabaseContainerFactory.newInstance(this.databaseType,
parameterized.getDockerImageName()));
+ storageContainer =
getContainers().registerContainer((DockerStorageContainer)
StorageContainerFactory.newInstance(databaseType,
parameterized.getDockerImageName(), "",
+
StorageContainerConfigurationFactory.newInstance(databaseType)));
if
(TransactionTestConstants.PROXY.equalsIgnoreCase(parameterized.getAdapter())) {
this.jdbcContainer = null;
ShardingSphereProxyDockerContainer proxyContainer = new
ShardingSphereProxyDockerContainer(this.databaseType);
- proxyContainer.dependsOn(governanceContainer, databaseContainer);
+ proxyContainer.dependsOn(governanceContainer, storageContainer);
this.proxyContainer =
getContainers().registerContainer(proxyContainer);
} else {
this.proxyContainer = null;
- ShardingSphereJDBCContainer jdbcContainer = new
ShardingSphereJDBCContainer(databaseContainer,
+ ShardingSphereJDBCContainer jdbcContainer = new
ShardingSphereJDBCContainer(storageContainer,
Objects.requireNonNull(ShardingSphereJDBCContainer.class.getClassLoader().getResource(getShardingSphereConfigResource(parameterized))).getFile());
this.jdbcContainer =
getContainers().registerContainer(jdbcContainer);
}
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/config/StorageContainerConfigurationFactory.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/config/StorageContainerConfigurationFactory.java
new file mode 100644
index 00000000000..0af021e9a69
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/config/StorageContainerConfigurationFactory.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package
org.apache.shardingsphere.integration.transaction.framework.container.config;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import
org.apache.shardingsphere.integration.transaction.framework.container.config.mysql.MySQLContainerConfigurationFactory;
+import
org.apache.shardingsphere.integration.transaction.framework.container.config.opengauss.OpenGaussContainerConfigurationFactory;
+import
org.apache.shardingsphere.integration.transaction.framework.container.config.postgresql.PostgreSQLContainerConfigurationFactory;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.h2.H2ContainerConfigurationFactory;
+
+/**
+ * Storage container configuration factory.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class StorageContainerConfigurationFactory {
+
+ /**
+ * Create new instance of storage container configuration.
+ *
+ * @param databaseType database type
+ * @return created instance
+ */
+ public static StorageContainerConfiguration newInstance(final DatabaseType
databaseType) {
+ switch (databaseType.getType()) {
+ case "MySQL":
+ return MySQLContainerConfigurationFactory.newInstance();
+ case "PostgreSQL":
+ return PostgreSQLContainerConfigurationFactory.newInstance();
+ case "openGauss":
+ return OpenGaussContainerConfigurationFactory.newInstance();
+ case "H2":
+ return H2ContainerConfigurationFactory.newInstance();
+ default:
+ throw new RuntimeException(String.format("Database `%s` is
unknown.", databaseType.getType()));
+ }
+ }
+}
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/mysql/MySQLContainerConfigurationFactory.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/config/mysql/MySQLContainerConfigurationFactory.java
similarity index 81%
copy from
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/mysql/MySQLContainerConfigurationFactory.java
copy to
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/config/mysql/MySQLContainerConfigurationFactory.java
index b125c1cef9a..67dcbfd0be6 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/mysql/MySQLContainerConfigurationFactory.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/config/mysql/MySQLContainerConfigurationFactory.java
@@ -15,12 +15,11 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.mysql;
+package
org.apache.shardingsphere.integration.transaction.framework.container.config.mysql;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
-import
org.apache.shardingsphere.test.integration.env.container.atomic.util.MySQLContainerUtil;
import java.util.Collections;
import java.util.HashMap;
@@ -33,8 +32,8 @@ import java.util.Map;
public final class MySQLContainerConfigurationFactory {
/**
- * Create new instance of mysql container configuration.
- *
+ * Create new instance of MySQL container configuration.
+ *
* @return created instance
*/
public static StorageContainerConfiguration newInstance() {
@@ -42,15 +41,17 @@ public final class MySQLContainerConfigurationFactory {
}
private static String[] getCommands() {
- String[] result = new String[1];
- result[0] = "--server-id=" + MySQLContainerUtil.generateServerId();
+ String[] result = new String[2];
+ result[0] = "--sql_mode=";
+ result[1] = "--default-authentication-plugin=mysql_native_password";
return result;
}
private static Map<String, String> getContainerEnvironments() {
- Map<String, String> result = new HashMap<>(2, 1);
+ Map<String, String> result = new HashMap<>(3, 1);
result.put("LANG", "C.UTF-8");
result.put("MYSQL_RANDOM_ROOT_PASSWORD", "yes");
+ result.put("MYSQL_ROOT_HOST", "%");
return result;
}
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/opengauss/OpenGaussContainerConfigurationFactory.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/config/opengauss/OpenGaussContainerConfigurationFactory.java
similarity index 77%
copy from
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/opengauss/OpenGaussContainerConfigurationFactory.java
copy to
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/config/opengauss/OpenGaussContainerConfigurationFactory.java
index b2d9614bc36..2706ddbdaa1 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/opengauss/OpenGaussContainerConfigurationFactory.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/config/opengauss/OpenGaussContainerConfigurationFactory.java
@@ -15,14 +15,13 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.opengauss;
+package
org.apache.shardingsphere.integration.transaction.framework.container.config.opengauss;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
import java.util.Collections;
-import java.util.HashMap;
import java.util.Map;
/**
@@ -32,8 +31,8 @@ import java.util.Map;
public final class OpenGaussContainerConfigurationFactory {
/**
- * Create new instance of opengauss container configuration.
- *
+ * Create new instance of openGauss container configuration.
+ *
* @return created instance
*/
public static StorageContainerConfiguration newInstance() {
@@ -41,7 +40,10 @@ public final class OpenGaussContainerConfigurationFactory {
}
private static String[] getCommands() {
- return new String[0];
+ String[] result = new String[2];
+ result[0] = "--max_connections=600";
+ result[1] = "--max_prepared_transactions=600";
+ return result;
}
private static Map<String, String> getContainerEnvironments() {
@@ -49,9 +51,6 @@ public final class OpenGaussContainerConfigurationFactory {
}
private static Map<String, String> getMountedResources() {
- Map<String, String> result = new HashMap<>(2, 1);
- result.put("/env/postgresql/postgresql.conf",
"/usr/local/opengauss/share/postgresql/postgresql.conf.sample");
- result.put("/env/opengauss/pg_hba.conf",
"/usr/local/opengauss/share/postgresql/pg_hba.conf.sample");
- return result;
+ return Collections.singletonMap("/env/postgresql/postgresql.conf",
"/usr/local/opengauss/share/postgresql/postgresql.conf.sample");
}
}
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/postgresql/PostgreSQLContainerConfigurationFactory.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/config/postgresql/PostgreSQLContainerConfigurationFactory.java
similarity index 76%
copy from
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/postgresql/PostgreSQLContainerConfigurationFactory.java
copy to
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/config/postgresql/PostgreSQLContainerConfigurationFactory.java
index df319667a28..4fb827fbee0 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/postgresql/PostgreSQLContainerConfigurationFactory.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/config/postgresql/PostgreSQLContainerConfigurationFactory.java
@@ -15,13 +15,14 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.postgresql;
+package
org.apache.shardingsphere.integration.transaction.framework.container.config.postgresql;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
import java.util.Collections;
+import java.util.HashMap;
import java.util.Map;
/**
@@ -31,8 +32,8 @@ import java.util.Map;
public final class PostgreSQLContainerConfigurationFactory {
/**
- * Create new instance of postgresql container configuration.
- *
+ * Create new instance of PostgreSQL container configuration.
+ *
* @return created instance
*/
public static StorageContainerConfiguration newInstance() {
@@ -41,15 +42,18 @@ public final class PostgreSQLContainerConfigurationFactory {
private static String[] getCommands() {
String[] result = new String[1];
- result[0] = "-c config_file=/etc/postgresql/postgresql.conf";
+ result[0] = "--max_connections=600 --max_prepared_transactions=600
--wal_level=logical";
return result;
}
private static Map<String, String> getContainerEnvironments() {
- return Collections.singletonMap("POSTGRES_PASSWORD", "Test@123");
+ Map<String, String> result = new HashMap<>(2, 1);
+ result.put("POSTGRES_HOST", "test_user");
+ result.put("POSTGRES_PASSWORD", "Test@123");
+ return result;
}
private static Map<String, String> getMountedResources() {
- return Collections.singletonMap("/env/postgresql/postgresql.conf",
"/etc/postgresql/postgresql.conf");
+ return Collections.singletonMap("/env/postgresql/postgresql.conf",
"/usr/local/opengauss/share/postgresql/postgresql.conf.sample");
}
}
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/jdbc/ShardingSphereJDBCContainer.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/jdbc/ShardingSphereJDBCContainer.java
index d02281b8814..3abadd1862a 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/jdbc/ShardingSphereJDBCContainer.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/jdbc/ShardingSphereJDBCContainer.java
@@ -18,8 +18,8 @@
package
org.apache.shardingsphere.integration.transaction.framework.container.jdbc;
import
org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory;
-import
org.apache.shardingsphere.integration.transaction.framework.container.database.DatabaseContainer;
import
org.apache.shardingsphere.test.integration.env.container.atomic.EmbeddedITContainer;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.storage.DockerStorageContainer;
import javax.sql.DataSource;
import java.io.File;
@@ -33,13 +33,13 @@ import java.util.concurrent.atomic.AtomicReference;
*/
public final class ShardingSphereJDBCContainer implements EmbeddedITContainer {
- private final DatabaseContainer databaseContainer;
+ private final DockerStorageContainer databaseContainer;
private final String ruleConfigPath;
private final AtomicReference<DataSource> targetDataSourceProvider = new
AtomicReference<>();
- public ShardingSphereJDBCContainer(final DatabaseContainer
databaseContainer, final String ruleConfigPath) {
+ public ShardingSphereJDBCContainer(final DockerStorageContainer
databaseContainer, final String ruleConfigPath) {
this.databaseContainer = databaseContainer;
this.ruleConfigPath = ruleConfigPath;
}
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/proxy/ShardingSphereProxyDockerContainer.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/proxy/ShardingSphereProxyDockerContainer.java
index a2e564f30e7..93c7796e863 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/proxy/ShardingSphereProxyDockerContainer.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/proxy/ShardingSphereProxyDockerContainer.java
@@ -44,11 +44,9 @@ public final class ShardingSphereProxyDockerContainer
extends DockerITContainer
protected void configure() {
withExposedPorts(3307);
mountConfigurationFiles();
- if (DatabaseTypeUtil.isPostgreSQL(databaseType) ||
DatabaseTypeUtil.isOpenGauss(databaseType)) {
- setWaitStrategy(new JDBCConnectionWaitStrategy(() ->
DriverManager.getConnection(DataSourceEnvironment.getURL(databaseType,
getHost(), getMappedPort(3307), "postgres"), "root", "root")));
- } else {
- setWaitStrategy(new JDBCConnectionWaitStrategy(() ->
DriverManager.getConnection(DataSourceEnvironment.getURL(databaseType,
getHost(), getMappedPort(3307), ""), "root", "root")));
- }
+ setWaitStrategy(DatabaseTypeUtil.isPostgreSQL(databaseType) ||
DatabaseTypeUtil.isOpenGauss(databaseType)
+ ? new JDBCConnectionWaitStrategy(() ->
DriverManager.getConnection(DataSourceEnvironment.getURL(databaseType,
getHost(), getMappedPort(3307), "postgres"), "proxy", "Proxy@123"))
+ : new JDBCConnectionWaitStrategy(() ->
DriverManager.getConnection(DataSourceEnvironment.getURL(databaseType,
getHost(), getMappedPort(3307), ""), "proxy", "Proxy@123")));
}
private void mountConfigurationFiles() {
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/mysql/initdb.sql
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/mysql/01-initdb.sql
similarity index 88%
rename from
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/mysql/initdb.sql
rename to
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/mysql/01-initdb.sql
index e6af28f7158..33fc1b0cfb7 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/mysql/initdb.sql
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/mysql/01-initdb.sql
@@ -15,5 +15,4 @@
-- limitations under the License.
--
-CREATE USER IF NOT EXISTS 'root'@'%' IDENTIFIED BY 'Root@123';
-GRANT All privileges ON *.* TO 'root'@'%';
+
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/mysql/server.yaml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/mysql/server.yaml
index 42d005156f2..4904389dcd7 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/mysql/server.yaml
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/mysql/server.yaml
@@ -31,7 +31,7 @@ mode:
rules:
- !AUTHORITY
users:
- - root@:root
+ - proxy@:Proxy@123
provider:
type: ALL_PERMITTED
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/container/init-sql/mysql/00-init-authority.sql
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/opengauss/01-initdb.sql
similarity index 88%
copy from
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/container/init-sql/mysql/00-init-authority.sql
copy to
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/opengauss/01-initdb.sql
index fa57a26c931..ba098f9ef1c 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/container/init-sql/mysql/00-init-authority.sql
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/opengauss/01-initdb.sql
@@ -13,7 +13,5 @@
-- 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 USER IF NOT EXISTS 'test_user'@'%' IDENTIFIED BY 'Test@123';
-GRANT ALL ON *.* TO 'test_user'@'%';
+
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/opengauss/server.yaml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/opengauss/server.yaml
index 2c96a38ded8..1a585b3788c 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/opengauss/server.yaml
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/opengauss/server.yaml
@@ -31,7 +31,7 @@ mode:
rules:
- !AUTHORITY
users:
- - root@%:root
+ - proxy@%:Proxy@123
- sharding@:sharding
provider:
type: ALL_PERMITTED
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/container/init-sql/mysql/00-init-authority.sql
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/postgresql/01-initdb.sql
similarity index 88%
copy from
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/container/init-sql/mysql/00-init-authority.sql
copy to
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/postgresql/01-initdb.sql
index fa57a26c931..113e14fef2f 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/resources/container/init-sql/mysql/00-init-authority.sql
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/postgresql/01-initdb.sql
@@ -15,5 +15,3 @@
-- limitations under the License.
--
-CREATE USER IF NOT EXISTS 'test_user'@'%' IDENTIFIED BY 'Test@123';
-GRANT ALL ON *.* TO 'test_user'@'%';
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/postgresql/server.yaml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/postgresql/server.yaml
index ce064aa7ef1..f232fd861d8 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/postgresql/server.yaml
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/postgresql/server.yaml
@@ -31,7 +31,7 @@ mode:
rules:
- !AUTHORITY
users:
- - root@%:root
+ - proxy@%:Proxy@123
- sharding@:sharding
provider:
type: ALL_PERMITTED
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/transaction-it-env.properties
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/transaction-it-env.properties
index 91a14d971df..ccf1879aa1f 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/transaction-it-env.properties
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/resources/env/transaction-it-env.properties
@@ -19,7 +19,7 @@ transaction.it.env.type=
# transaction.it.env.cases= MySQLAutoCommitTestCase,
PostgresSQLAutoCommitTestCase, ClassicTransferTestCase,
MultiTableCommitAndRollbackTestCase, SingleTableCommitAndRollbackTestCase,
MySQLSetReadOnlyTestCase, MySQLSavePointTestCase, PostgreSQLSavePointTestCase
transaction.it.env.cases=PostgresSQLAutoCommitTestCase,
MultiTableCommitAndRollbackTestCase, SingleTableCommitAndRollbackTestCase,
MySQLSetReadOnlyTestCase, MySQLSavePointTestCase, MySQLLocalTruncateTestCase,
MySQLXATruncateTestCase
# transaction.it.env.transtypes=LOCAL, XA, BASE
-transaction.it.env.transtypes=LOCAL, XA
+transaction.it.env.transtypes=
# transaction.it.env.xa.providers=Atomikos, Bitronix, Narayana
transaction.it.env.xa.providers=
# transaction.it.docker.mysql.version=5.7,8.0
@@ -39,5 +39,5 @@ transaction.it.native.postgresql.port=5432
transaction.it.native.opengauss.username=gaussdb
transaction.it.native.opengauss.password=Root@123
transaction.it.native.opengauss.port=5432
-transaction.it.proxy.username=root
-transaction.it.proxy.password=root
+transaction.it.proxy.username=proxy
+transaction.it.proxy.password=Proxy@123