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

morningman 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 ae3e47632d0 [fix](test) fix unstable jdbc ddl case (#46697) (#46745)
ae3e47632d0 is described below

commit ae3e47632d01169e96b84d7e729d2e8cc9dbd750
Author: Mingyu Chen (Rayner) <morning...@163.com>
AuthorDate: Fri Jan 10 13:21:52 2025 +0800

    [fix](test) fix unstable jdbc ddl case (#46697) (#46745)
    
    cherry-pick #46697
---
 .../jdbc/test_jdbc_catalog_ddl.groovy               | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git 
a/regression-test/suites/external_table_p0/jdbc/test_jdbc_catalog_ddl.groovy 
b/regression-test/suites/external_table_p0/jdbc/test_jdbc_catalog_ddl.groovy
index 3735fe53053..1750f732baf 100644
--- a/regression-test/suites/external_table_p0/jdbc/test_jdbc_catalog_ddl.groovy
+++ b/regression-test/suites/external_table_p0/jdbc/test_jdbc_catalog_ddl.groovy
@@ -15,6 +15,9 @@
 // specific language governing permissions and limitations
 // under the License.
 
+import java.util.concurrent.TimeUnit;
+import org.awaitility.Awaitility;
+
 suite("test_jdbc_catalog_ddl", 
"p0,external,mysql,external_docker,external_docker_mysql") {
 
     String enabled = context.config.otherConfigs.get("enableJdbcTest")
@@ -23,6 +26,18 @@ suite("test_jdbc_catalog_ddl", 
"p0,external,mysql,external_docker,external_docke
     String bucket = getS3BucketName()
     String driver_url = 
"https://${bucket}.${s3_endpoint}/regression/jdbc_driver/mysql-connector-java-5.1.49.jar";
     String mysql_port = context.config.otherConfigs.get("mysql_57_port");
+
+    def wait_db_sync = { String ctl ->
+        Awaitility.await().atMost(10, TimeUnit.SECONDS).pollInterval(1, 
TimeUnit.SECONDS).until{
+            try {
+                def res = sql "show databases from ${ctl}"
+                return res.size() > 0;
+            } catch (Exception e) {
+                e.printStackTrace();
+                return false;
+            }
+        }
+    }
     // String driver_url = "mysql-connector-java-5.1.49.jar"
     if (enabled != null && enabled.equalsIgnoreCase("true")) {
         String catalog_name = "test_jdbc_catalog_ddl";
@@ -38,6 +53,11 @@ suite("test_jdbc_catalog_ddl", 
"p0,external,mysql,external_docker,external_docke
                 "driver_class" = "com.mysql.jdbc.Driver",
                 "use_meta_cache" = "${useMetaCache}"
             );"""
+
+            if (useMetaCache.equals("false")) {
+                wait_db_sync("${catalog_name}")
+            }
+
             def res = sql(""" show databases from ${catalog_name}; 
""").collect {x -> x[0] as String}
             println("show databases result " + res);
             def containedDb = ['mysql', 'doris_test', 'information_schema']
@@ -68,6 +88,7 @@ suite("test_jdbc_catalog_ddl", 
"p0,external,mysql,external_docker,external_docke
 
             if (useMetaCache.equals("false")) {
                 sql """refresh catalog ${catalog_name}"""
+                wait_db_sync("${catalog_name}")
             }
             sql "use ${catalog_name}.temp_database"
             qt_sql01 """select * from temp_table"""


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

Reply via email to