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

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


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 78eb9d8e333 [case](restart_fe) add demo case for restart_fe test 
(#37091) (#37313)
78eb9d8e333 is described below

commit 78eb9d8e333a331ee98df7f34fe91c77484b7b9d
Author: Dongyang Li <[email protected]>
AuthorDate: Mon Jul 15 19:42:20 2024 +0800

    [case](restart_fe) add demo case for restart_fe test (#37091) (#37313)
    
    pick from master #37091
    
    Co-authored-by: stephen <[email protected]>
---
 regression-test/README.md                          | 11 ++++
 regression-test/data/javaudf_p0/null/test.out      | 26 ++++++++
 regression-test/suites/auth_up_down_p0/load.groovy |  3 +-
 .../auth_up_down_p0/test_grant_revoke_auth.groovy  |  2 +-
 regression-test/suites/javaudf_p0/null/load.groovy | 66 ++++++++++++++++++++
 regression-test/suites/javaudf_p0/null/test.groovy | 24 ++++++++
 .../suites/javaudf_p0/test_javaudf_null.groovy     | 71 ----------------------
 7 files changed, 129 insertions(+), 74 deletions(-)

diff --git a/regression-test/README.md b/regression-test/README.md
index 849fc3681e7..f856f2141a6 100644
--- a/regression-test/README.md
+++ b/regression-test/README.md
@@ -19,6 +19,7 @@ under the License.
 
 # 新加case注意事项
 
+## 常规 case
 1. 变量名前要写 def,否则是全局变量,并行跑的 case 的时候可能被其他 case 影响。
 
     Problematic code:
@@ -65,3 +66,13 @@ under the License.
     sql """sync"""
     sql """select count(*) from table """
     ```
+
+6. UDF 的 case,需要把对应的 jar 包拷贝到所有 BE 机器上。
+
+    
[示例](https://github.com/apache/doris/blob/master/regression-test/suites/javaudf_p0/test_javaudf_case.groovy#L27)
+
+
+## 兼容性 case
+指重启 FE 测试或升级测试中,在初始集群上创建的资源或规则,在集群重启或升级后也能正常使用,比如权限、UDF等。
+这些 case 需要拆分成两个文件,load.groovy 和 xxxx.groovy,放到一个文件夹中并加上 `restart_fe` 
组标签,[示例](https://github.com/apache/doris/pull/37118)。
+
diff --git a/regression-test/data/javaudf_p0/null/test.out 
b/regression-test/data/javaudf_p0/null/test.out
new file mode 100644
index 00000000000..dc59ed24afd
--- /dev/null
+++ b/regression-test/data/javaudf_p0/null/test.out
@@ -0,0 +1,26 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !select_default --
+1
+2
+3
+4
+5
+6
+7
+8
+9
+
+-- !select --
+\N
+
+-- !select --
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+
diff --git a/regression-test/suites/auth_up_down_p0/load.groovy 
b/regression-test/suites/auth_up_down_p0/load.groovy
index b4178fa7a48..71e08656159 100644
--- a/regression-test/suites/auth_up_down_p0/load.groovy
+++ b/regression-test/suites/auth_up_down_p0/load.groovy
@@ -15,7 +15,7 @@
 // specific language governing permissions and limitations
 // under the License.
 
-suite("test_upgrade_downgrade_prepare_auth","p0,auth") {
+suite("test_upgrade_downgrade_prepare_auth","p0,auth,restart_fe") {
 
     String user1 = 'test_upgrade_downgrade_compatibility_auth_user1'
     String user2 = 'test_upgrade_downgrade_compatibility_auth_user2'
@@ -45,7 +45,6 @@ suite("test_upgrade_downgrade_prepare_auth","p0,auth") {
     sql """CREATE ROLE ${role1}"""
     sql """CREATE ROLE ${role2}"""
 
-
     try_sql """drop table if exists ${dbName}.${tableName1}"""
     sql """drop database if exists ${dbName}"""
     sql """create database ${dbName}"""
diff --git 
a/regression-test/suites/auth_up_down_p0/test_grant_revoke_auth.groovy 
b/regression-test/suites/auth_up_down_p0/test_grant_revoke_auth.groovy
index af620e647de..1d79d9fb066 100644
--- a/regression-test/suites/auth_up_down_p0/test_grant_revoke_auth.groovy
+++ b/regression-test/suites/auth_up_down_p0/test_grant_revoke_auth.groovy
@@ -15,7 +15,7 @@
 // specific language governing permissions and limitations
 // under the License.
 
-suite("test_upgrade_downgrade_compatibility_auth","p0,auth") {
+suite("test_upgrade_downgrade_compatibility_auth","p0,auth,restart_fe") {
 
     sql """ADMIN SET FRONTEND CONFIG ('experimental_enable_workload_group' = 
'true');"""
     sql """set experimental_enable_pipeline_engine = true;"""
diff --git a/regression-test/suites/javaudf_p0/null/load.groovy 
b/regression-test/suites/javaudf_p0/null/load.groovy
new file mode 100644
index 00000000000..add19203bb7
--- /dev/null
+++ b/regression-test/suites/javaudf_p0/null/load.groovy
@@ -0,0 +1,66 @@
+// 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.
+
+import org.codehaus.groovy.runtime.IOGroovyMethods
+
+import java.nio.charset.StandardCharsets
+import java.nio.file.Files
+import java.nio.file.Paths
+
+suite('test_javaudf_null_load', 'p0,restart_fe') {
+    // In order to cover the scenario that udf can be used normally after fe 
restart.
+    // We devided the origin case test_javaudf_null.groovy into two parts, 
load and query, this case is the first part.
+    // run load and query -> restart fe -> run query again,
+    // by this way, we can cover the scenario.
+    def tableName = 'test_javaudf_null'
+    def jarPath = 
"""${context.file.parent}/../jars/java-udf-case-jar-with-dependencies.jar"""
+    scp_udf_file_to_all_be(jarPath)
+
+    log.info("Jar path: ${jarPath}".toString())
+    sql """ DROP TABLE IF EXISTS ${tableName} """
+    sql """DROP FUNCTION IF EXISTS java_udf_null_test(int);"""
+    sql """
+    CREATE TABLE IF NOT EXISTS ${tableName} (
+        `user_id`     INT         NOT NULL COMMENT ""
+        )
+        DISTRIBUTED BY HASH(user_id) PROPERTIES("replication_num" = "1");
+    """
+    StringBuilder sb = new StringBuilder()
+    int i = 1
+    for (; i < 9; i ++) {
+        sb.append("""
+            (${i}),
+        """)
+    }
+    sb.append("""
+            (${i})
+        """)
+    sql """ INSERT INTO ${tableName} VALUES
+            ${sb.toString()}
+        """
+
+    File path = new File(jarPath)
+    if (!path.exists()) {
+        throw new IllegalStateException("""${jarPath} doesn't exist! """)
+    }
+
+    sql """ CREATE FUNCTION java_udf_null_test(int) RETURNS int PROPERTIES (
+        "file"="file://${jarPath}",
+        "symbol"="org.apache.doris.udf.NullTest",
+        "type"="JAVA_UDF"
+    ); """
+}
diff --git a/regression-test/suites/javaudf_p0/null/test.groovy 
b/regression-test/suites/javaudf_p0/null/test.groovy
new file mode 100644
index 00000000000..2c67c3e7ead
--- /dev/null
+++ b/regression-test/suites/javaudf_p0/null/test.groovy
@@ -0,0 +1,24 @@
+// 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.
+
+suite('test_javaudf_null_query', 'p0,restart_fe') {
+    def tableName = 'test_javaudf_null'
+    qt_select_default """ SELECT * FROM ${tableName} t ORDER BY user_id; """
+
+    qt_select ''' SELECT java_udf_null_test(1) result; '''
+    qt_select """ SELECT java_udf_null_test(user_id) result FROM ${tableName} 
ORDER BY result; """
+}
diff --git a/regression-test/suites/javaudf_p0/test_javaudf_null.groovy 
b/regression-test/suites/javaudf_p0/test_javaudf_null.groovy
deleted file mode 100644
index a710b1cb932..00000000000
--- a/regression-test/suites/javaudf_p0/test_javaudf_null.groovy
+++ /dev/null
@@ -1,71 +0,0 @@
-// 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.
-
-import org.codehaus.groovy.runtime.IOGroovyMethods
-
-import java.nio.charset.StandardCharsets
-import java.nio.file.Files
-import java.nio.file.Paths
-
-suite("test_javaudf_null") {
-    def tableName = "test_javaudf_null"
-    def jarPath = 
"""${context.file.parent}/jars/java-udf-case-jar-with-dependencies.jar"""
-    scp_udf_file_to_all_be(jarPath)
-
-    log.info("Jar path: ${jarPath}".toString())
-    try {
-        sql """ DROP TABLE IF EXISTS ${tableName} """
-        sql """
-        CREATE TABLE IF NOT EXISTS ${tableName} (
-            `user_id`     INT         NOT NULL COMMENT ""
-            )
-            DISTRIBUTED BY HASH(user_id) PROPERTIES("replication_num" = "1");
-        """
-        StringBuilder sb = new StringBuilder()
-        int i = 1
-        for (; i < 9; i ++) {
-            sb.append("""
-                (${i}),
-            """)
-        }
-        sb.append("""
-                (${i})
-            """)
-        sql """ INSERT INTO ${tableName} VALUES
-             ${sb.toString()}
-            """
-        qt_select_default """ SELECT * FROM ${tableName} t ORDER BY user_id; 
"""
-
-        File path = new File(jarPath)
-        if (!path.exists()) {
-            throw new IllegalStateException("""${jarPath} doesn't exist! """)
-        }
-
-        sql """ CREATE FUNCTION java_udf_null_test(int) RETURNS int PROPERTIES 
(
-            "file"="file://${jarPath}",
-            "symbol"="org.apache.doris.udf.NullTest",
-            "type"="JAVA_UDF"
-        ); """
-
-        qt_select """ SELECT java_udf_null_test(1) result; """
-        qt_select """ SELECT java_udf_null_test(user_id) result FROM 
${tableName} ORDER BY result; """
-
-    } finally {
-        try_sql("DROP FUNCTION IF EXISTS java_udf_null_test(int);")
-        try_sql("DROP TABLE IF EXISTS ${tableName}")
-    }
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to