You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by tu...@apache.org on 2022/09/09 04:58:19 UTC

[shardingsphere] branch master updated: Optimize transaction integration test execution time (#20888)

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

tuichenchuxin 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 e9c29ae600d Optimize transaction integration test execution time (#20888)
e9c29ae600d is described below

commit e9c29ae600d5d9140b073b335a44c33c18ebb891
Author: ZhangCheng <fl...@outlook.com>
AuthorDate: Fri Sep 9 12:58:12 2022 +0800

    Optimize transaction integration test execution time (#20888)
    
    * Optimize transaction integration test execution speed
    
    * Fix
    
    * Modify job
    
    * Simplified code
    
    * Fix
---
 .github/workflows/it-transaction.yml               | 24 ++------
 .../transaction/engine/base/BaseITCase.java        | 67 ++++++++++++++--------
 .../engine/base/BaseTransactionITCase.java         | 53 +++++++++++++++++
 .../engine/mysql/MySQLProxyTransactionIT.java      | 16 ------
 .../opengauss/OpenGaussProxyTransactionIT.java     | 16 ------
 .../postgresql/PostgreSQLProxyTransactionIT.java   | 16 ------
 .../container/compose/DockerContainerComposer.java |  3 +-
 .../framework/param/TransactionParameterized.java  |  7 ++-
 8 files changed, 107 insertions(+), 95 deletions(-)

diff --git a/.github/workflows/it-transaction.yml b/.github/workflows/it-transaction.yml
index 707775ffd62..d3b94b6c49d 100644
--- a/.github/workflows/it-transaction.yml
+++ b/.github/workflows/it-transaction.yml
@@ -83,21 +83,9 @@ jobs:
           java-version: 8
       - name: Build Transaction IT image
         run: ./mvnw -B clean install -am -pl shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction -Pit.env.docker -DskipTests
-      - name: Run MySQL Local Transaction Integration Test
-        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/pom.xml -Dtransaction.it.env.type=docker -Dtransaction.it.env.transtypes=LOCAL -Dtransaction.it.docker.mysql.version=${{ env.mysql_version }}
-      - name: Run Transaction MySQL Integration Test With Atomikos
-        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/pom.xml -Dtransaction.it.env.type=docker -Dtransaction.it.env.transtypes=XA -Dtransaction.it.env.xa.providers=Atomikos -Dtransaction.it.docker.mysql.version=${{ env.mysql_version }}
-      - name: Run Transaction MySQL Integration Test With Narayana
-        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/pom.xml -Dtransaction.it.env.type=docker -Dtransaction.it.env.transtypes=XA -Dtransaction.it.env.xa.providers=Narayana -Dtransaction.it.docker.mysql.version=${{ env.mysql_version }}
-      - name: Run PostgreSQL Local Transaction Integration Test
-        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/pom.xml -Dtransaction.it.env.type=docker -Dtransaction.it.env.transtypes=LOCAL -Dtransaction.it.docker.postgresql.version=${{ env.postgresql_version }}
-      - name: Run Transaction PostgreSQL Integration Test With Atomikos
-        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/pom.xml -Dtransaction.it.env.type=docker -Dtransaction.it.env.transtypes=XA -Dtransaction.it.env.xa.providers=Atomikos -Dtransaction.it.docker.postgresql.version=${{ env.postgresql_version }}
-      - name: Run Transaction PostgreSQL Integration Test With Narayana
-        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/pom.xml -Dtransaction.it.env.type=docker -Dtransaction.it.env.transtypes=XA -Dtransaction.it.env.xa.providers=Narayana -Dtransaction.it.docker.postgresql.version=${{ env.postgresql_version }}
-      - name: Run OpenGauss Local Transaction Integration Test
-        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/pom.xml -Dtransaction.it.env.type=docker -Dtransaction.it.env.transtypes=LOCAL -Dtransaction.it.docker.opengauss.version=${{ env.opengauss_version }}
-      - name: Run Transaction OpenGauss Integration Test With Atomikos
-        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/pom.xml -Dtransaction.it.env.type=docker -Dtransaction.it.env.transtypes=XA -Dtransaction.it.env.xa.providers=Atomikos -Dtransaction.it.docker.opengauss.version=${{ env.opengauss_version }}
-      - name: Run Transaction OpenGauss Integration Test With Narayana
-        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/pom.xml -Dtransaction.it.env.type=docker -Dtransaction.it.env.transtypes=XA -Dtransaction.it.env.xa.providers=Narayana -Dtransaction.it.docker.opengauss.version=${{ env.opengauss_version }}
+      - name: Run MySQL Transaction Integration Test
+        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/pom.xml -Dtransaction.it.env.type=docker -Dtransaction.it.env.transtypes=LOCAL,XA -Dtransaction.it.env.xa.providers=Atomikos,Narayana -Dtransaction.it.docker.mysql.version=${{ env.mysql_version }}
+      - name: Run PostgreSQL Transaction Integration Test
+        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/pom.xml -Dtransaction.it.env.type=docker -Dtransaction.it.env.transtypes=LOCAL,XA -Dtransaction.it.env.xa.providers=Atomikos,Narayana -Dtransaction.it.docker.postgresql.version=${{ env.postgresql_version }}
+      - name: Run OpenGauss Transaction Integration Test
+        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/pom.xml -Dtransaction.it.env.type=docker -Dtransaction.it.env.transtypes=LOCAL,XA -Dtransaction.it.env.xa.providers=Atomikos,Narayana -Dtransaction.it.docker.opengauss.version=${{ env.opengauss_version }}
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 6d0cc728ccc..e3ce1ec3b52 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
@@ -57,6 +57,7 @@ import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.LinkedList;
 import java.util.List;
@@ -65,6 +66,7 @@ import java.util.Objects;
 import java.util.Optional;
 import java.util.Properties;
 import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
@@ -90,7 +92,7 @@ public abstract class BaseITCase {
     
     protected static final Collection<String> ALL_DS = Arrays.asList(DS_0, DS_1, DS_2);
     
-    protected static final Collection<String> ALL_XA_PROVIDERS = Arrays.asList(TransactionTestConstants.ATOMIKOS, TransactionTestConstants.BITRONIX, TransactionTestConstants.NARAYANA);
+    protected static final List<String> ALL_XA_PROVIDERS = Arrays.asList(TransactionTestConstants.ATOMIKOS, TransactionTestConstants.BITRONIX, TransactionTestConstants.NARAYANA);
     
     protected static final String SHARDING_DB = "sharding_db";
     
@@ -209,44 +211,59 @@ public abstract class BaseITCase {
     private static void addParametersByTransactionTypes(final String version, final TransactionTestCaseRegistry currentTestCaseInfo,
                                                         final Class<? extends BaseTransactionTestCase> caseClass, final TransactionTestCase annotation,
                                                         final Map<String, TransactionParameterized> parameterizedMap, final String group) {
-        for (TransactionType each : annotation.transactionTypes()) {
-            if (!ENV.getAllowTransactionTypes().isEmpty() && !ENV.getAllowTransactionTypes().contains(each.toString())) {
-                log.info("Collect transaction test case, need to run transaction types don't contain this, skip: {}-{}.", caseClass.getName(), each);
-                continue;
+        if (AdapterContainerConstants.PROXY.equals(currentTestCaseInfo.getRunningAdaptor())) {
+            List<TransactionType> allowTransactionTypes = ENV.getAllowTransactionTypes().isEmpty() ? Arrays.stream(TransactionType.values()).collect(Collectors.toList())
+                    : ENV.getAllowTransactionTypes().stream().map(BaseITCase::getTransactionType).collect(Collectors.toList());
+            List<String> allowProviders = ENV.getAllowXAProviders().isEmpty() ? ALL_XA_PROVIDERS : ENV.getAllowXAProviders();
+            addTestParameters(version, currentTestCaseInfo, caseClass, allowTransactionTypes, allowProviders, parameterizedMap, group);
+        } else {
+            for (TransactionType each : annotation.transactionTypes()) {
+                if (!ENV.getAllowTransactionTypes().isEmpty() && !ENV.getAllowTransactionTypes().contains(each.toString())) {
+                    log.info("Collect transaction test case, need to run transaction types don't contain this, skip: {}-{}.", caseClass.getName(), each);
+                    continue;
+                }
+                addParametersByTransactionProvidersInJDBC(version, currentTestCaseInfo, caseClass, each, parameterizedMap, group);
             }
-            addParametersByTransactionProviders(version, currentTestCaseInfo, caseClass, each, parameterizedMap, group);
         }
     }
     
-    private static void addParametersByTransactionProviders(final String version, final TransactionTestCaseRegistry currentTestCaseInfo,
-                                                            final Class<? extends BaseTransactionTestCase> caseClass, final TransactionType transactionType,
-                                                            final Map<String, TransactionParameterized> parameterizedMap, final String group) {
-        if (TransactionType.LOCAL.equals(transactionType)) {
-            addTestParameters(version, currentTestCaseInfo, caseClass, transactionType, "", parameterizedMap, group);
-        } else if (TransactionType.XA.equals(transactionType)) {
-            if (ENV.getAllowXAProviders().isEmpty()) {
-                for (String provider : ALL_XA_PROVIDERS) {
-                    addTestParameters(version, currentTestCaseInfo, caseClass, transactionType, provider, parameterizedMap, group);
-                }
-            } else {
-                for (String provider : ENV.getAllowXAProviders()) {
-                    addTestParameters(version, currentTestCaseInfo, caseClass, transactionType, provider, parameterizedMap, group);
-                }
+    private static TransactionType getTransactionType(final String each) {
+        switch (each) {
+            case "LOCAL":
+                return TransactionType.LOCAL;
+            case "XA":
+                return TransactionType.XA;
+            case "BASE":
+                return TransactionType.BASE;
+            default:
+                throw new UnsupportedOperationException("Unsupported transaction type.");
+        }
+    }
+    
+    private static void addParametersByTransactionProvidersInJDBC(final String version, final TransactionTestCaseRegistry currentTestCaseInfo,
+                                                                  final Class<? extends BaseTransactionTestCase> caseClass, final TransactionType each,
+                                                                  final Map<String, TransactionParameterized> parameterizedMap, final String group) {
+        if (TransactionType.LOCAL.equals(each)) {
+            addTestParameters(version, currentTestCaseInfo, caseClass, Collections.singletonList(each), Collections.singletonList(""), parameterizedMap, group);
+        } else if (TransactionType.XA.equals(each)) {
+            List<String> allowProviders = ENV.getAllowXAProviders().isEmpty() ? ALL_XA_PROVIDERS : ENV.getAllowXAProviders();
+            for (String provider : allowProviders) {
+                addTestParameters(version, currentTestCaseInfo, caseClass, Collections.singletonList(each), Collections.singletonList(provider), parameterizedMap, group);
             }
         }
     }
     
     private static void addTestParameters(final String version, final TransactionTestCaseRegistry currentTestCaseInfo,
-                                          final Class<? extends BaseTransactionTestCase> caseClass, final TransactionType transactionType, final String provider,
+                                          final Class<? extends BaseTransactionTestCase> caseClass, final List<TransactionType> transactionTypes, final List<String> providers,
                                           final Map<String, TransactionParameterized> parameterizedMap, final String group) {
-        String uniqueKey = getUniqueKey(currentTestCaseInfo.getDbType(), currentTestCaseInfo.getRunningAdaptor(), transactionType, provider, group);
-        parameterizedMap.putIfAbsent(uniqueKey, new TransactionParameterized(getSqlDatabaseType(currentTestCaseInfo.getDbType()), currentTestCaseInfo.getRunningAdaptor(), transactionType, provider,
+        String uniqueKey = getUniqueKey(currentTestCaseInfo.getDbType(), currentTestCaseInfo.getRunningAdaptor(), transactionTypes, providers, group);
+        parameterizedMap.putIfAbsent(uniqueKey, new TransactionParameterized(getSqlDatabaseType(currentTestCaseInfo.getDbType()), currentTestCaseInfo.getRunningAdaptor(), transactionTypes, providers,
                 getDockerImageName(currentTestCaseInfo.getDbType(), version), group, new LinkedList<>()));
         parameterizedMap.get(uniqueKey).getTransactionTestCaseClasses().add(caseClass);
     }
     
-    private static String getUniqueKey(final String dbType, final String runningAdapter, final TransactionType transactionType, final String provider, final String group) {
-        return dbType + File.separator + runningAdapter + File.separator + transactionType + File.separator + provider + File.separator + group;
+    private static String getUniqueKey(final String dbType, final String runningAdapter, final List<TransactionType> transactionTypes, final List<String> providers, final String group) {
+        return dbType + File.separator + runningAdapter + File.separator + transactionTypes + File.separator + providers + File.separator + group;
     }
     
     private static DatabaseType getSqlDatabaseType(final String databaseType) {
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/base/BaseTransactionITCase.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/base/BaseTransactionITCase.java
index 84d7a22fd82..a83a0d1bf93 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/base/BaseTransactionITCase.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/base/BaseTransactionITCase.java
@@ -23,6 +23,7 @@ import org.apache.shardingsphere.data.pipeline.core.util.ThreadUtil;
 import org.apache.shardingsphere.integration.transaction.cases.base.BaseTransactionTestCase;
 import org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
 import org.apache.shardingsphere.integration.transaction.framework.param.TransactionParameterized;
+import org.apache.shardingsphere.test.integration.env.container.atomic.constants.AdapterContainerConstants;
 import org.apache.shardingsphere.transaction.core.TransactionType;
 
 import javax.sql.DataSource;
@@ -30,6 +31,7 @@ import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Objects;
@@ -211,7 +213,36 @@ public abstract class BaseTransactionITCase extends BaseITCase {
         return result;
     }
     
+    @SneakyThrows
     protected void callTestCases(final TransactionParameterized parameterized) {
+        if (AdapterContainerConstants.PROXY.equalsIgnoreCase(parameterized.getAdapter())) {
+            for (TransactionType each : parameterized.getTransactionTypes()) {
+                if (TransactionType.LOCAL.equals(each)) {
+                    log.info("Call transaction IT {}, alter transaction rule {}.", parameterized, "");
+                    alterTransactionRule(each, "");
+                    doCallTestCases(parameterized, each, "");
+                } else if (TransactionType.XA.equals(each)) {
+                    for (String eachProvider : parameterized.getProviders()) {
+                        log.info("Call transaction IT {}, alter transaction rule {}.", parameterized, eachProvider);
+                        alterTransactionRule(each, eachProvider);
+                        doCallTestCases(parameterized, each, eachProvider);
+                    }
+                }
+            }
+        } else {
+            doCallTestCases(parameterized);
+        }
+    }
+    
+    private void alterTransactionRule(final TransactionType transactionType, final String each) throws SQLException {
+        if (Objects.equals(transactionType, TransactionType.LOCAL)) {
+            alterLocalTransactionRule();
+        } else if (Objects.equals(transactionType, TransactionType.XA)) {
+            alterXaTransactionRule(each);
+        }
+    }
+    
+    private void doCallTestCases(final TransactionParameterized parameterized) {
         for (Class<? extends BaseTransactionTestCase> each : parameterized.getTransactionTestCaseClasses()) {
             log.info("Transaction IT {} -> {} test begin.", parameterized, each.getSimpleName());
             try {
@@ -229,4 +260,26 @@ public abstract class BaseTransactionITCase extends BaseITCase {
             }
         }
     }
+    
+    private void doCallTestCases(final TransactionParameterized parameterized, final TransactionType transactionType, final String provider) {
+        for (Class<? extends BaseTransactionTestCase> each : parameterized.getTransactionTestCaseClasses()) {
+            if (!Arrays.asList(each.getAnnotation(TransactionTestCase.class).transactionTypes()).contains(transactionType)) {
+                return;
+            }
+            log.info("Call transaction IT {} -> {} -> {} -> {} test begin.", parameterized, transactionType, provider, each.getSimpleName());
+            try {
+                each.getConstructor(BaseTransactionITCase.class, DataSource.class).newInstance(this, getDataSource()).execute();
+                // CHECKSTYLE:OFF
+            } catch (final Exception ex) {
+                // CHECKSTYLE:ON
+                log.error(String.format("Transaction IT %s -> %s test failed", parameterized, each.getSimpleName()), ex);
+                throw new RuntimeException(ex);
+            }
+            log.info("Call transaction IT {} -> {} -> {} -> {} test end.", parameterized, transactionType, provider, each.getSimpleName());
+            try {
+                getDataSource().close();
+            } catch (final SQLException ignored) {
+            }
+        }
+    }
 }
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/mysql/MySQLProxyTransactionIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/mysql/MySQLProxyTransactionIT.java
index e50f36b8cdb..319bf2f9a26 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/mysql/MySQLProxyTransactionIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/mysql/MySQLProxyTransactionIT.java
@@ -21,10 +21,7 @@ import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.shardingsphere.integration.transaction.engine.base.BaseTransactionITCase;
 import org.apache.shardingsphere.integration.transaction.framework.param.TransactionParameterized;
-import org.apache.shardingsphere.test.integration.env.container.atomic.constants.AdapterContainerConstants;
-import org.apache.shardingsphere.transaction.core.TransactionType;
 import org.junit.After;
-import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -32,7 +29,6 @@ import org.junit.runners.Parameterized.Parameters;
 
 import java.sql.SQLException;
 import java.util.Collection;
-import java.util.Objects;
 
 /**
  * MySQL general transaction test case with proxy container, includes multiple cases.
@@ -54,18 +50,6 @@ public final class MySQLProxyTransactionIT extends BaseTransactionITCase {
         return getTransactionParameterizedList(MySQLProxyTransactionIT.class);
     }
     
-    @Before
-    @SneakyThrows(SQLException.class)
-    public void before() {
-        if (AdapterContainerConstants.PROXY.equalsIgnoreCase(parameterized.getAdapter())) {
-            if (Objects.equals(parameterized.getTransactionType(), TransactionType.LOCAL)) {
-                alterLocalTransactionRule();
-            } else if (Objects.equals(parameterized.getTransactionType(), TransactionType.XA)) {
-                alterXaTransactionRule(parameterized.getProvider());
-            }
-        }
-    }
-    
     @After
     @SneakyThrows(SQLException.class)
     public void after() {
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/opengauss/OpenGaussProxyTransactionIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/opengauss/OpenGaussProxyTransactionIT.java
index 8670f0a6052..51df809922c 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/opengauss/OpenGaussProxyTransactionIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/opengauss/OpenGaussProxyTransactionIT.java
@@ -21,10 +21,7 @@ import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.shardingsphere.integration.transaction.engine.base.BaseTransactionITCase;
 import org.apache.shardingsphere.integration.transaction.framework.param.TransactionParameterized;
-import org.apache.shardingsphere.test.integration.env.container.atomic.constants.AdapterContainerConstants;
-import org.apache.shardingsphere.transaction.core.TransactionType;
 import org.junit.After;
-import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -32,7 +29,6 @@ import org.junit.runners.Parameterized.Parameters;
 
 import java.sql.SQLException;
 import java.util.Collection;
-import java.util.Objects;
 
 /**
  * OpenGauss general transaction test case with proxy container, includes multiple cases.
@@ -54,18 +50,6 @@ public final class OpenGaussProxyTransactionIT extends BaseTransactionITCase {
         return getTransactionParameterizedList(OpenGaussProxyTransactionIT.class);
     }
     
-    @Before
-    @SneakyThrows(SQLException.class)
-    public void before() {
-        if (AdapterContainerConstants.PROXY.equalsIgnoreCase(parameterized.getAdapter())) {
-            if (Objects.equals(parameterized.getTransactionType(), TransactionType.LOCAL)) {
-                alterLocalTransactionRule();
-            } else if (Objects.equals(parameterized.getTransactionType(), TransactionType.XA)) {
-                alterXaTransactionRule(parameterized.getProvider());
-            }
-        }
-    }
-    
     @After
     @SneakyThrows(SQLException.class)
     public void after() {
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/postgresql/PostgreSQLProxyTransactionIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/postgresql/PostgreSQLProxyTransactionIT.java
index 812d8e0e761..7a5fc50cb97 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/postgresql/PostgreSQLProxyTransactionIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/postgresql/PostgreSQLProxyTransactionIT.java
@@ -21,10 +21,7 @@ import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.shardingsphere.integration.transaction.engine.base.BaseTransactionITCase;
 import org.apache.shardingsphere.integration.transaction.framework.param.TransactionParameterized;
-import org.apache.shardingsphere.test.integration.env.container.atomic.constants.AdapterContainerConstants;
-import org.apache.shardingsphere.transaction.core.TransactionType;
 import org.junit.After;
-import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -32,7 +29,6 @@ import org.junit.runners.Parameterized.Parameters;
 
 import java.sql.SQLException;
 import java.util.Collection;
-import java.util.Objects;
 
 /**
  * PostgreSQL general transaction test case with proxy container, includes multiple cases.
@@ -54,18 +50,6 @@ public final class PostgreSQLProxyTransactionIT extends BaseTransactionITCase {
         return getTransactionParameterizedList(PostgreSQLProxyTransactionIT.class);
     }
     
-    @Before
-    @SneakyThrows(SQLException.class)
-    public void before() {
-        if (AdapterContainerConstants.PROXY.equalsIgnoreCase(parameterized.getAdapter())) {
-            if (Objects.equals(parameterized.getTransactionType(), TransactionType.LOCAL)) {
-                alterLocalTransactionRule();
-            } else if (Objects.equals(parameterized.getTransactionType(), TransactionType.XA)) {
-                alterXaTransactionRule(parameterized.getProvider());
-            }
-        }
-    }
-    
     @After
     @SneakyThrows(SQLException.class)
     public void after() {
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/compose/DockerContainerComposer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/compose/DockerContainerComposer.java
index 445e13238b9..1443a264e87 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/compose/DockerContainerComposer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/compose/DockerContainerComposer.java
@@ -75,7 +75,8 @@ public final class DockerContainerComposer extends BaseContainerComposer {
     
     private String getShardingSphereConfigResource(final TransactionParameterized parameterized) {
         String result = String.format("env/%s/%s/config-sharding-%s%s.yaml", parameterized.getAdapter().toLowerCase(),
-                parameterized.getDatabaseType().getType().toLowerCase(), parameterized.getTransactionType().toString().toLowerCase(), getTransactionProvider(parameterized.getProvider()));
+                parameterized.getDatabaseType().getType().toLowerCase(), parameterized.getTransactionTypes().get(0).toString().toLowerCase(),
+                getTransactionProvider(parameterized.getProviders().get(0)));
         log.info("Transaction IT tests use the configuration file: {}", result);
         return result;
     }
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/param/TransactionParameterized.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/param/TransactionParameterized.java
index af22a613aa7..c201b983355 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/param/TransactionParameterized.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/param/TransactionParameterized.java
@@ -24,6 +24,7 @@ import org.apache.shardingsphere.integration.transaction.cases.base.BaseTransact
 import org.apache.shardingsphere.transaction.core.TransactionType;
 
 import java.util.Collection;
+import java.util.List;
 
 /**
  * Transaction test parameters.
@@ -36,9 +37,9 @@ public final class TransactionParameterized {
     
     private final String adapter;
     
-    private final TransactionType transactionType;
+    private final List<TransactionType> transactionTypes;
     
-    private final String provider;
+    private final List<String> providers;
     
     private final String dockerImageName;
     
@@ -48,6 +49,6 @@ public final class TransactionParameterized {
     
     @Override
     public String toString() {
-        return String.format("%s -> %s -> %s -> %s -> %s -> %s", databaseType.getType(), adapter, transactionType, provider, dockerImageName, group);
+        return String.format("%s -> %s -> %s -> %s -> %s -> %s", databaseType.getType(), adapter, transactionTypes, providers, dockerImageName, group);
     }
 }