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

zhaojinchao 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 8175967f993 Fixing ExternalSQLParserIT not reporting correctly. 
(#26433)
8175967f993 is described below

commit 8175967f993c98b7829a6913fa86b069df4aafb6
Author: Cong Hu <[email protected]>
AuthorDate: Mon Jun 19 18:07:16 2023 +0800

    Fixing ExternalSQLParserIT not reporting correctly. (#26433)
---
 .../test/it/sql/parser/external/ExternalSQLParserIT.java         | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git 
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/external/ExternalSQLParserIT.java
 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/external/ExternalSQLParserIT.java
index 77441d39d8d..fb837fd7b75 100644
--- 
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/external/ExternalSQLParserIT.java
+++ 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/external/ExternalSQLParserIT.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.test.it.sql.parser.external;
 
 import com.google.common.base.Preconditions;
 import lombok.SneakyThrows;
-import 
org.apache.shardingsphere.infra.util.exception.external.ShardingSphereExternalException;
 import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPILoader;
 import org.apache.shardingsphere.sql.parser.api.CacheOption;
 import org.apache.shardingsphere.sql.parser.api.SQLParserEngine;
@@ -51,17 +50,17 @@ public abstract class ExternalSQLParserIT {
     @EnabledIf("isEnabled")
     @ArgumentsSource(TestCaseArgumentsProvider.class)
     void assertParseSQL(final String sqlCaseId, final String databaseType, 
final String sql, final String reportType) throws IOException {
-        boolean isSuccess = true;
+        boolean isSuccess = false;
         try (
                 SQLParseResultReporter resultReporter = 
TypedSPILoader.getService(SQLParseResultReporterCreator.class, reportType)
                         .create(databaseType, 
SQLParserExternalITEnvironment.getInstance().getResultPath())) {
             try {
                 ParseASTNode parseASTNode = new SQLParserEngine(databaseType, 
new CacheOption(128, 1024L)).parse(sql, false);
                 new SQLStatementVisitorEngine(databaseType, 
true).visit(parseASTNode);
-            } catch (final ShardingSphereExternalException | 
ClassCastException | NullPointerException | IllegalArgumentException | 
IndexOutOfBoundsException ignore) {
-                isSuccess = false;
+                isSuccess = true;
+            } finally {
+                resultReporter.printResult(sqlCaseId, databaseType, isSuccess, 
sql);
             }
-            resultReporter.printResult(sqlCaseId, databaseType, isSuccess, 
sql);
         }
     }
     

Reply via email to