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

hellostephen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 2de1e4fd341 [regression-test](framework) fix bug when getErrorInfo 
throw exception (#50482)
2de1e4fd341 is described below

commit 2de1e4fd341a1d1a13b4edaf2d77d0ab09a130a7
Author: shuke <sh...@selectdb.com>
AuthorDate: Tue Apr 29 20:45:44 2025 +0800

    [regression-test](framework) fix bug when getErrorInfo throw exception 
(#50482)
    
    ### What problem does this PR solve?
    when exception thrown from getErrorInfo, failure message will not be
    send to teamcity, which causing tests treated as success.
---
 .../doris/regression/util/LoggerUtils.groovy       | 32 ++++++++++++----------
 .../suites/account_p0/test_property_session.groovy |  4 +--
 .../suites/auth_p0/test_backends_auth.groovy       |  4 +--
 .../suites/auth_p0/test_catalogs_auth.groovy       |  4 +--
 .../suites/auth_p0/test_frontends_auth.groovy      |  4 +--
 .../auth_p0/test_frontends_disks_auth.groovy       |  4 +--
 .../suites/auth_p0/test_mtmv_auth.groovy           |  4 +--
 .../suites/auth_p0/test_partitions_auth.groovy     |  4 +--
 .../suites/auth_p0/test_query_tvf_auth.groovy      |  4 +--
 .../suites/auth_p0/test_select_count_auth.groovy   |  6 ++--
 .../test_backup_restore_colocate.groovy            |  4 +--
 .../metrics_p0/test_delete_bitmap_metrics.groovy   | 12 ++++----
 .../query_profile/test_execute_by_frontend.groovy  |  2 +-
 .../suites/statistics/test_drop_analyze_job.groovy |  2 +-
 .../suites/temp_table_p0/test_temp_table.groovy    |  4 +--
 .../test_temp_table_with_restart.groovy            |  2 +-
 16 files changed, 50 insertions(+), 46 deletions(-)

diff --git 
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/LoggerUtils.groovy
 
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/LoggerUtils.groovy
index bcb04e8e9ea..cdb0739d21a 100644
--- 
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/LoggerUtils.groovy
+++ 
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/LoggerUtils.groovy
@@ -21,22 +21,26 @@ import com.google.common.collect.Sets
 
 class LoggerUtils {
     static Tuple2<Integer, String> getErrorInfo(Throwable t, File file) {
-        if (file.name.endsWith(".groovy")) {
-            def st = findRootErrorStackTrace(t, Sets.newLinkedHashSet(), file)
-            int lineNumber = -1
-            if (!st.is(null)) {
-                lineNumber = st.getLineNumber()
-            }
-            if (lineNumber == -1) {
+        try {
+            if (file.name.endsWith(".groovy")) {
+                def st = findRootErrorStackTrace(t, Sets.newLinkedHashSet(), 
file)
+                int lineNumber = -1
+                if (!st.is(null)) {
+                    lineNumber = st.getLineNumber()
+                }
+                if (lineNumber == -1) {
+                    return new Tuple2<Integer, String>(null, null)
+                }
+
+                List<String> lines = file.text.split("\n").toList()
+                String errorPrefixText = lines.subList(Math.max(0, lineNumber 
- 10), lineNumber).join("\n")
+                String errorSuffixText = lines.subList(lineNumber, 
Math.min(lines.size(), lineNumber + 10)).join("\n")
+                String errorText = 
"${errorPrefixText}\n^^^^^^^^^^^^^^^^^^^^^^^^^^ERROR 
LINE^^^^^^^^^^^^^^^^^^^^^^^^^^\n${errorSuffixText}".toString()
+                return new Tuple2<Integer, String>(lineNumber, errorText)
+            } else {
                 return new Tuple2<Integer, String>(null, null)
             }
-
-            List<String> lines = file.text.split("\n").toList()
-            String errorPrefixText = lines.subList(Math.max(0, lineNumber - 
10), lineNumber).join("\n")
-            String errorSuffixText = lines.subList(lineNumber, 
Math.min(lines.size(), lineNumber + 10)).join("\n")
-            String errorText = 
"${errorPrefixText}\n^^^^^^^^^^^^^^^^^^^^^^^^^^ERROR 
LINE^^^^^^^^^^^^^^^^^^^^^^^^^^\n${errorSuffixText}".toString()
-            return new Tuple2<Integer, String>(lineNumber, errorText)
-        } else {
+        } catch (Exception e) {
             return new Tuple2<Integer, String>(null, null)
         }
     }
diff --git a/regression-test/suites/account_p0/test_property_session.groovy 
b/regression-test/suites/account_p0/test_property_session.groovy
index 57b2dad747b..9715fe1d89b 100644
--- a/regression-test/suites/account_p0/test_property_session.groovy
+++ b/regression-test/suites/account_p0/test_property_session.groovy
@@ -32,7 +32,7 @@ suite("test_property_session") {
         sql """GRANT USAGE_PRIV ON CLUSTER `${validCluster}` TO ${userName}""";
     }
     sql """GRANT select_PRIV ON *.*.* TO ${userName}""";
-    connect(user=userName, password="${pwd}", url=context.config.jdbcUrl) {
+    connect(userName, "${pwd}", context.config.jdbcUrl) {
         sql """
               set query_timeout=1;
           """
@@ -46,7 +46,7 @@ suite("test_property_session") {
 
     // the priority of property should be higher than session
     sql """set property for '${userName}' 'query_timeout' = '10';"""
-    connect(user=userName, password="${pwd}", url=context.config.jdbcUrl) {
+    connect(userName, "${pwd}", context.config.jdbcUrl) {
         sql """
             select sleep(3);
         """
diff --git a/regression-test/suites/auth_p0/test_backends_auth.groovy 
b/regression-test/suites/auth_p0/test_backends_auth.groovy
index db76b2740fc..9725f6d433d 100644
--- a/regression-test/suites/auth_p0/test_backends_auth.groovy
+++ b/regression-test/suites/auth_p0/test_backends_auth.groovy
@@ -34,7 +34,7 @@ suite("test_backends_auth","p0,auth") {
 
     sql """grant select_priv on regression_test to ${user}"""
 
-    connect(user=user, password="${pwd}", url=context.config.jdbcUrl) {
+    connect(user, "${pwd}", context.config.jdbcUrl) {
         test {
               sql """
                   show backends;
@@ -51,7 +51,7 @@ suite("test_backends_auth","p0,auth") {
 
     sql """grant admin_priv on *.*.* to ${user}"""
 
-    connect(user=user, password="${pwd}", url=context.config.jdbcUrl) {
+    connect(user, "${pwd}", context.config.jdbcUrl) {
          sql """
               show backends;
           """
diff --git a/regression-test/suites/auth_p0/test_catalogs_auth.groovy 
b/regression-test/suites/auth_p0/test_catalogs_auth.groovy
index 1b67282d8fe..ec9b64f0be4 100644
--- a/regression-test/suites/auth_p0/test_catalogs_auth.groovy
+++ b/regression-test/suites/auth_p0/test_catalogs_auth.groovy
@@ -41,7 +41,7 @@ suite("test_catalogs_auth","p0,auth") {
 
     sql """grant select_priv on regression_test to ${user}"""
 
-    connect(user=user, password="${pwd}", url=context.config.jdbcUrl) {
+    connect(user, "${pwd}", context.config.jdbcUrl) {
         def showRes = sql """show catalogs;"""
         logger.info("showRes: " + showRes.toString())
         assertFalse(showRes.toString().contains("${catalogName}"))
@@ -53,7 +53,7 @@ suite("test_catalogs_auth","p0,auth") {
 
     sql """grant select_priv on ${catalogName}.*.* to ${user}"""
 
-    connect(user=user, password="${pwd}", url=context.config.jdbcUrl) {
+    connect(user, "${pwd}", context.config.jdbcUrl) {
         def showRes = sql """show catalogs;"""
         logger.info("showRes: " + showRes.toString())
         assertTrue(showRes.toString().contains("${catalogName}"))
diff --git a/regression-test/suites/auth_p0/test_frontends_auth.groovy 
b/regression-test/suites/auth_p0/test_frontends_auth.groovy
index 0ac96e5c653..83e2f1eda7a 100644
--- a/regression-test/suites/auth_p0/test_frontends_auth.groovy
+++ b/regression-test/suites/auth_p0/test_frontends_auth.groovy
@@ -34,7 +34,7 @@ suite("test_frontends_auth","p0,auth") {
 
     sql """grant select_priv on regression_test to ${user}"""
 
-    connect(user=user, password="${pwd}", url=context.config.jdbcUrl) {
+    connect(user, "${pwd}", context.config.jdbcUrl) {
         test {
               sql """
                   show frontends;
@@ -51,7 +51,7 @@ suite("test_frontends_auth","p0,auth") {
 
     sql """grant admin_priv on *.*.* to ${user}"""
 
-    connect(user=user, password="${pwd}", url=context.config.jdbcUrl) {
+    connect(user, "${pwd}", context.config.jdbcUrl) {
          sql """
               show frontends;
           """
diff --git a/regression-test/suites/auth_p0/test_frontends_disks_auth.groovy 
b/regression-test/suites/auth_p0/test_frontends_disks_auth.groovy
index f46ead3256a..935e00c976b 100644
--- a/regression-test/suites/auth_p0/test_frontends_disks_auth.groovy
+++ b/regression-test/suites/auth_p0/test_frontends_disks_auth.groovy
@@ -34,7 +34,7 @@ suite("test_frontends_disks_auth","p0,auth") {
 
     sql """grant select_priv on regression_test to ${user}"""
 
-    connect(user=user, password="${pwd}", url=context.config.jdbcUrl) {
+    connect(user, "${pwd}", context.config.jdbcUrl) {
         test {
               sql """
                   select * from frontends_disks();
@@ -45,7 +45,7 @@ suite("test_frontends_disks_auth","p0,auth") {
 
     sql """grant admin_priv on *.*.* to ${user}"""
 
-    connect(user=user, password="${pwd}", url=context.config.jdbcUrl) {
+    connect(user, "${pwd}", context.config.jdbcUrl) {
          sql """
              select * from frontends_disks();
          """
diff --git a/regression-test/suites/auth_p0/test_mtmv_auth.groovy 
b/regression-test/suites/auth_p0/test_mtmv_auth.groovy
index a190edaa022..11934aed7c3 100644
--- a/regression-test/suites/auth_p0/test_mtmv_auth.groovy
+++ b/regression-test/suites/auth_p0/test_mtmv_auth.groovy
@@ -63,7 +63,7 @@ suite("test_mtmv_auth","p0,auth") {
 
     sql """grant select_priv on regression_test to ${user}"""
 
-    connect(user=user, password="${pwd}", url=context.config.jdbcUrl) {
+    connect(user, "${pwd}", context.config.jdbcUrl) {
         def mvsRes = sql """select * from mv_infos("database"="${dbName}");"""
         logger.info("mvsRes: " + mvsRes.toString())
         assertFalse(mvsRes.toString().contains("${mvName}"))
@@ -80,7 +80,7 @@ suite("test_mtmv_auth","p0,auth") {
 
     sql """grant select_priv on ${dbName}.${mvName} to ${user}"""
 
-    connect(user=user, password="${pwd}", url=context.config.jdbcUrl) {
+    connect(user, "${pwd}", context.config.jdbcUrl) {
        def mvsRes = sql """select * from mv_infos("database"="${dbName}");"""
        logger.info("mvsRes: " + mvsRes.toString())
        assertTrue(mvsRes.toString().contains("${mvName}"))
diff --git a/regression-test/suites/auth_p0/test_partitions_auth.groovy 
b/regression-test/suites/auth_p0/test_partitions_auth.groovy
index 1a398b84b4e..2406930671f 100644
--- a/regression-test/suites/auth_p0/test_partitions_auth.groovy
+++ b/regression-test/suites/auth_p0/test_partitions_auth.groovy
@@ -53,7 +53,7 @@ suite("test_partitions_auth","p0,auth") {
 
     sql """grant select_priv on regression_test to ${user}"""
 
-    connect(user=user, password="${pwd}", url=context.config.jdbcUrl) {
+    connect(user, "${pwd}", context.config.jdbcUrl) {
         test {
               sql """
                  show partitions from ${dbName}.${tableName};
@@ -70,7 +70,7 @@ suite("test_partitions_auth","p0,auth") {
 
     sql """grant select_priv on ${dbName}.${tableName} to ${user}"""
 
-    connect(user=user, password="${pwd}", url=context.config.jdbcUrl) {
+    connect(user, "${pwd}", context.config.jdbcUrl) {
         sql """
              show partitions from ${dbName}.${tableName};
           """
diff --git a/regression-test/suites/auth_p0/test_query_tvf_auth.groovy 
b/regression-test/suites/auth_p0/test_query_tvf_auth.groovy
index 6353ca142a9..d46c9f10b6a 100644
--- a/regression-test/suites/auth_p0/test_query_tvf_auth.groovy
+++ b/regression-test/suites/auth_p0/test_query_tvf_auth.groovy
@@ -53,7 +53,7 @@ suite("test_query_tvf_auth", 
"p0,auth,external,external_docker") {
 
         sql """grant select_priv on regression_test to ${dorisuser}"""
 
-        connect(user=dorisuser, password="${dorispwd}", 
url=context.config.jdbcUrl) {
+        connect(dorisuser, "${dorispwd}", context.config.jdbcUrl) {
             test {
                   sql """
                      select * from query('catalog' = '${catalog_name}', 
'query' = 'select * from doris_test.all_types');
@@ -62,7 +62,7 @@ suite("test_query_tvf_auth", 
"p0,auth,external,external_docker") {
             }
         }
         sql """grant select_priv on ${catalog_name}.*.* to ${dorisuser}"""
-        connect(user=dorisuser, password="${dorispwd}", 
url=context.config.jdbcUrl) {
+        connect(dorisuser, "${dorispwd}", context.config.jdbcUrl) {
           sql """
              select * from query('catalog' = '${catalog_name}', 'query' = 
'select * from doris_test.all_types');
           """
diff --git a/regression-test/suites/auth_p0/test_select_count_auth.groovy 
b/regression-test/suites/auth_p0/test_select_count_auth.groovy
index 47a199aaca2..859aa5b1372 100644
--- a/regression-test/suites/auth_p0/test_select_count_auth.groovy
+++ b/regression-test/suites/auth_p0/test_select_count_auth.groovy
@@ -34,7 +34,7 @@ suite("test_select_count_auth","p0,auth") {
 
     sql """grant select_priv on regression_test to ${user}"""
 
-    connect(user=user, password="${pwd}", url=context.config.jdbcUrl) {
+    connect(user, "${pwd}", context.config.jdbcUrl) {
         test {
               sql """
                   select count(*) from __internal_schema.audit_log;
@@ -57,7 +57,7 @@ suite("test_select_count_auth","p0,auth") {
 
     sql """grant select_priv(query_id) on __internal_schema.audit_log to 
${user}"""
 
-    connect(user=user, password="${pwd}", url=context.config.jdbcUrl) {
+    connect(user, "${pwd}", context.config.jdbcUrl) {
         test {
               sql """
                   select count(*) from __internal_schema.audit_log;
@@ -77,7 +77,7 @@ suite("test_select_count_auth","p0,auth") {
 
     sql """grant select_priv on __internal_schema.audit_log to ${user}"""
 
-    connect(user=user, password="${pwd}", url=context.config.jdbcUrl) {
+    connect(user, "${pwd}", context.config.jdbcUrl) {
         sql """
               select count(*) from __internal_schema.audit_log;
           """
diff --git 
a/regression-test/suites/backup_restore/test_backup_restore_colocate.groovy 
b/regression-test/suites/backup_restore/test_backup_restore_colocate.groovy
index 7247deb6d32..31bbe642643 100644
--- a/regression-test/suites/backup_restore/test_backup_restore_colocate.groovy
+++ b/regression-test/suites/backup_restore/test_backup_restore_colocate.groovy
@@ -35,7 +35,7 @@ suite("test_backup_restore_colocate", "backup_restore") {
     }
 
     def checkColocateTabletHealth = { db_name ->
-        result = showTabletHealth.call(db_name)
+        def result = showTabletHealth.call(db_name)
         log.info(result as String)
         assertNotNull(result)
         assertTrue(result.ColocateMismatchNum as int == 0)
@@ -370,7 +370,7 @@ suite("test_backup_restore_colocate_with_partition", 
"backup_restore") {
     }
 
     def checkColocateTabletHealth = { db_name ->
-        result = showTabletHealth.call(db_name)
+        def result = showTabletHealth.call(db_name)
         log.info(result as String)
         assertNotNull(result)
         assertTrue(result.ColocateMismatchNum as int == 0)
diff --git 
a/regression-test/suites/metrics_p0/test_delete_bitmap_metrics.groovy 
b/regression-test/suites/metrics_p0/test_delete_bitmap_metrics.groovy
index 9d0e9b2956b..3861586057a 100644
--- a/regression-test/suites/metrics_p0/test_delete_bitmap_metrics.groovy
+++ b/regression-test/suites/metrics_p0/test_delete_bitmap_metrics.groovy
@@ -72,9 +72,9 @@ suite("test_delete_bitmap_metrics", "p0") {
 
         String command = sb.toString()
         logger.info(command)
-        process = command.execute()
-        code = process.waitFor()
-        out = process.getText()
+        def process = command.execute()
+        def code = process.waitFor()
+        def out = process.getText()
         logger.info("Get local delete bitmap count status:  =" + code + ", 
out=" + out)
         assertEquals(code, 0)
         def deleteBitmapStatus = parseJson(out.trim())
@@ -90,9 +90,9 @@ suite("test_delete_bitmap_metrics", "p0") {
 
         String command = sb.toString()
         logger.info(command)
-        process = command.execute()
-        code = process.waitFor()
-        out = process.getText()
+        def process = command.execute()
+        def code = process.waitFor()
+        def out = process.getText()
         logger.info("Get ms delete bitmap count status:  =" + code + ", out=" 
+ out)
         assertEquals(code, 0)
         def deleteBitmapStatus = parseJson(out.trim())
diff --git 
a/regression-test/suites/query_profile/test_execute_by_frontend.groovy 
b/regression-test/suites/query_profile/test_execute_by_frontend.groovy
index 2b2d867f73b..c166dfdcee9 100644
--- a/regression-test/suites/query_profile/test_execute_by_frontend.groovy
+++ b/regression-test/suites/query_profile/test_execute_by_frontend.groovy
@@ -57,7 +57,7 @@ suite('test_execute_by_frontend') {
     sql "set enable_profile=true"
     def simpleSql1 = "select * from test_execute_by_frontend"
     sql "${simpleSql1}"
-    simpleSql2 = """select  cast("1"  as  Int)"""
+    def simpleSql2 = """select  cast("1"  as  Int)"""
     sql "${simpleSql2}"
     def isRecorded = false
     def wholeString = getProfileList()
diff --git a/regression-test/suites/statistics/test_drop_analyze_job.groovy 
b/regression-test/suites/statistics/test_drop_analyze_job.groovy
index f77509ac165..b9ad04ff89f 100644
--- a/regression-test/suites/statistics/test_drop_analyze_job.groovy
+++ b/regression-test/suites/statistics/test_drop_analyze_job.groovy
@@ -41,7 +41,7 @@ suite("test_drop_analyze_job") {
     assertEquals(1, result.size())
        
        result = sql """show analyze drop_analyze_job_test"""
-       jobId0 = result[0][0]
+       def jobId0 = result[0][0]
        
        sql """drop analyze job ${jobId0}"""
        
diff --git a/regression-test/suites/temp_table_p0/test_temp_table.groovy 
b/regression-test/suites/temp_table_p0/test_temp_table.groovy
index 8821fcef975..4e192bf3234 100644
--- a/regression-test/suites/temp_table_p0/test_temp_table.groovy
+++ b/regression-test/suites/temp_table_p0/test_temp_table.groovy
@@ -170,7 +170,7 @@ suite('test_temp_table', 'p0') {
 
     // truncate
     sql "truncate table t_test_temp_table2"
-    select_result3 = sql "select * from t_test_temp_table2"
+    def select_result3 = sql "select * from t_test_temp_table2"
     assertEquals(select_result3.size(), 0)
     sql "truncate table t_test_temp_table1"
     select_result3 = sql "select * from t_test_temp_table1"
@@ -428,7 +428,7 @@ suite('test_temp_table', 'p0') {
         assertEquals(show_result3.size(), 1)
         assertFalse(show_result3[0][1].contains("CREATE TEMPORARY TABLE"))
 
-        def select_result3 = sql "select * from t_test_temp_table1"
+        select_result3 = sql "select * from t_test_temp_table1"
         assertEquals(select_result3.size(), 0)
 
         // can create a temp table which have same name with other temp table 
which is created in another session in the same db
diff --git 
a/regression-test/suites/temp_table_p0/test_temp_table_with_restart.groovy 
b/regression-test/suites/temp_table_p0/test_temp_table_with_restart.groovy
index eeae3b44a47..fd1089785c5 100644
--- a/regression-test/suites/temp_table_p0/test_temp_table_with_restart.groovy
+++ b/regression-test/suites/temp_table_p0/test_temp_table_with_restart.groovy
@@ -18,7 +18,7 @@
 import org.apache.doris.regression.suite.ClusterOptions
 
 suite('test_temp_table_with_restart', 'p0,docker') {
-    options = new ClusterOptions()
+    def options = new ClusterOptions()
     options.setFeNum(2)
     options.setBeNum(1)
     options.connectToFollower = true


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to