You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by su...@apache.org on 2023/06/21 07:04:20 UTC

[shardingsphere] branch master updated: Fix the issue with e2e. (#26388)

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

sunnianjun 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 cf392baf152 Fix the issue with e2e. (#26388)
cf392baf152 is described below

commit cf392baf1520cdc1c75be0244920dbf63bee68a8
Author: Cong Hu <ia...@qq.com>
AuthorDate: Wed Jun 21 15:04:12 2023 +0800

    Fix the issue with e2e. (#26388)
    
    * Fix the issue where JdbcStandaloneTestParameterGenerator always uses H2 as the database type.
    
    * Fix e2e failure caused by sqlCommentParseEnabled not being enabled.
    
    * Fix the problem of getAssertionTestParameter not filtering by env adapter.
    
    * Fix e2e failure caused by sqlCommentParseEnabled not being enabled.
    
    * Fix code format.
---
 .../test/e2e/framework/param/array/E2ETestParameterGenerator.java | 2 +-
 .../param/array/JdbcStandaloneTestParameterGenerator.java         | 8 ++------
 .../resources/env/scenario/tbl/proxy/conf/mysql/config-tbl.yaml   | 3 +++
 test/e2e/sql/src/test/resources/env/scenario/tbl/rules.yaml       | 4 ++++
 4 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/E2ETestParameterGenerator.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/E2ETestParameterGenerator.java
index dd58d80575d..6a019f05bed 100644
--- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/E2ETestParameterGenerator.java
+++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/E2ETestParameterGenerator.java
@@ -105,7 +105,7 @@ public final class E2ETestParameterGenerator {
                                                                          final IntegrationTestCaseAssertion assertion, final SQLCommandType sqlCommandType) {
         Collection<AssertionTestParameter> result = new LinkedList<>();
         for (String each : getEnvAdapters(testCaseContext.getTestCase().getAdapters())) {
-            if (sqlCommandType.getRunningAdaptors().contains(each)) {
+            if (sqlCommandType.getRunningAdaptors().contains(each) && envAdapters.contains(each)) {
                 result.addAll(getAssertionTestParameter(testCaseContext, assertion, each, databaseType, sqlExecuteType, sqlCommandType));
             }
         }
diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/JdbcStandaloneTestParameterGenerator.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/JdbcStandaloneTestParameterGenerator.java
index c7d38d5867e..7340056f88b 100644
--- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/JdbcStandaloneTestParameterGenerator.java
+++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/JdbcStandaloneTestParameterGenerator.java
@@ -19,8 +19,6 @@ package org.apache.shardingsphere.test.e2e.framework.param.array;
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPILoader;
 import org.apache.shardingsphere.test.e2e.cases.SQLCommandType;
 import org.apache.shardingsphere.test.e2e.env.container.atomic.enums.AdapterType;
 import org.apache.shardingsphere.test.e2e.env.container.atomic.enums.AdapterMode;
@@ -39,8 +37,6 @@ public final class JdbcStandaloneTestParameterGenerator {
     
     private static final Collection<String> ADAPTERS = Collections.singleton(AdapterType.JDBC.getValue());
     
-    private static final Collection<DatabaseType> DATABASE_TYPES = Collections.singleton(TypedSPILoader.getService(DatabaseType.class, "H2"));
-    
     private static final IntegrationTestEnvironment ENV = IntegrationTestEnvironment.getInstance();
     
     /**
@@ -50,7 +46,7 @@ public final class JdbcStandaloneTestParameterGenerator {
      * @return assertion test parameter
      */
     public static Collection<AssertionTestParameter> getAssertionTestParameter(final SQLCommandType sqlCommandType) {
-        return new E2ETestParameterGenerator(ADAPTERS, ENV.getScenarios(), AdapterMode.STANDALONE.getValue(), DATABASE_TYPES).getAssertionTestParameter(sqlCommandType);
+        return new E2ETestParameterGenerator(ADAPTERS, ENV.getScenarios(), AdapterMode.STANDALONE.getValue(), ENV.getClusterEnvironment().getDatabaseTypes()).getAssertionTestParameter(sqlCommandType);
     }
     
     /**
@@ -60,6 +56,6 @@ public final class JdbcStandaloneTestParameterGenerator {
      * @return case test parameter
      */
     public static Collection<E2ETestParameter> getCaseTestParameter(final SQLCommandType sqlCommandType) {
-        return new E2ETestParameterGenerator(ADAPTERS, ENV.getScenarios(), AdapterMode.STANDALONE.getValue(), DATABASE_TYPES).getCaseTestParameter(sqlCommandType);
+        return new E2ETestParameterGenerator(ADAPTERS, ENV.getScenarios(), AdapterMode.STANDALONE.getValue(), ENV.getClusterEnvironment().getDatabaseTypes()).getCaseTestParameter(sqlCommandType);
     }
 }
diff --git a/test/e2e/sql/src/test/resources/env/scenario/tbl/proxy/conf/mysql/config-tbl.yaml b/test/e2e/sql/src/test/resources/env/scenario/tbl/proxy/conf/mysql/config-tbl.yaml
index 8bce1037bed..f85c9ab262d 100644
--- a/test/e2e/sql/src/test/resources/env/scenario/tbl/proxy/conf/mysql/config-tbl.yaml
+++ b/test/e2e/sql/src/test/resources/env/scenario/tbl/proxy/conf/mysql/config-tbl.yaml
@@ -108,3 +108,6 @@ rules:
   tables:
     - t_broadcast_table
     - t_broadcast_table_for_ddl
+  
+- !SQL_PARSER
+  sqlCommentParseEnabled: true
diff --git a/test/e2e/sql/src/test/resources/env/scenario/tbl/rules.yaml b/test/e2e/sql/src/test/resources/env/scenario/tbl/rules.yaml
index 663ee240a1e..a68f3785291 100644
--- a/test/e2e/sql/src/test/resources/env/scenario/tbl/rules.yaml
+++ b/test/e2e/sql/src/test/resources/env/scenario/tbl/rules.yaml
@@ -101,3 +101,7 @@ sqlFederation:
   executionPlanCache:
     initialCapacity: 2000
     maximumSize: 65535
+    
+sqlParser:
+  sqlCommentParseEnabled: true
+