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

dataroaring 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 59d25a53a48 [fix](test) Rewrite `test_show_data_warehouse` case due to 
not stable (#34492)
59d25a53a48 is described below

commit 59d25a53a48893729a63c8c44e9cf4718e25dd23
Author: Lei Zhang <27994433+swjtu-zhang...@users.noreply.github.com>
AuthorDate: Wed May 8 09:45:16 2024 +0800

    [fix](test) Rewrite `test_show_data_warehouse` case due to not stable 
(#34492)
---
 .../suites/show_p0/test_show_data_warehouse.groovy | 179 +++++++++++----------
 1 file changed, 91 insertions(+), 88 deletions(-)

diff --git a/regression-test/suites/show_p0/test_show_data_warehouse.groovy 
b/regression-test/suites/show_p0/test_show_data_warehouse.groovy
index 97835dc97aa..fb9af927f0b 100644
--- a/regression-test/suites/show_p0/test_show_data_warehouse.groovy
+++ b/regression-test/suites/show_p0/test_show_data_warehouse.groovy
@@ -16,93 +16,96 @@
 // under the License.
 
 suite("test_show_data_warehouse") {
-  sql """ DROP DATABASE IF EXISTS SHOW_DATA_1; """
-  sql """ DROP DATABASE IF EXISTS SHOW_DATA_2; """
-  sql """ CREATE DATABASE SHOW_DATA_1; """
-  sql """ CREATE DATABASE SHOW_DATA_2; """
-
-  sql """ USE SHOW_DATA_1; """
-
-  sql """ CREATE TABLE `table` (
-    `siteid` int(11) NOT NULL COMMENT "",
-    `citycode` int(11) NOT NULL COMMENT "",
-    `userid` int(11) NOT NULL COMMENT "",
-    `pv` int(11) NOT NULL COMMENT ""
-  ) ENGINE=OLAP
-  DUPLICATE KEY(`siteid`)
-  COMMENT "OLAP"
-  DISTRIBUTED BY HASH(`siteid`) BUCKETS 1
-  PROPERTIES("replication_num" = "1"); """
-
-  sql """ insert into `table` values
-        (9,10,11,12),
-        (9,10,11,12),
-        (1,2,3,4),
-        (13,21,22,16),
-        (13,14,15,16),
-        (17,18,19,20),
-        (1,2,3,4),
-        (13,21,22,16),
-        (13,14,15,16),
-        (17,18,19,20),
-        (5,6,7,8),
-        (5,6,7,8); """
-
-  sql """ USE SHOW_DATA_2; """
-
-  sql """ CREATE TABLE `table` (
-  `siteid` int(11) NOT NULL COMMENT "",
-  `citycode` int(11) NOT NULL COMMENT "",
-  `userid` int(11) NOT NULL COMMENT "",
-  `pv` int(11) NOT NULL COMMENT ""
-  ) ENGINE=OLAP
-  DUPLICATE KEY(`siteid`)
-  COMMENT "OLAP"
-  DISTRIBUTED BY HASH(`siteid`) BUCKETS 1
-  PROPERTIES("replication_num" = "1"); """
-
-  sql """ insert into `table` values
-        (9,10,11,12),
-        (9,10,11,12),
-        (1,2,3,4),
-        (13,21,22,16),
-        (13,14,15,16); """
-  
-  // wait for heartbeat
-
-  long start = System.currentTimeMillis()
-  long dataSize = 0
-  long current = -1
-  do {
-    current = System.currentTimeMillis()
-    def res = sql """ show data 
properties("entire_warehouse"="true","db_names"="SHOW_DATA_1"); """
-    for (row : res) {
-      print row
-      if (row[0].toString() == "SHOW_DATA_1") {
-        dataSize = row[1].toInteger()
-      }
-    }
-    sleep(2000)
-  } while (dataSize == 0 && current - start < 600000)
-
-  qt_show_1 """ show data 
properties("entire_warehouse"="true","db_names"="SHOW_DATA_1"); """
-
-  qt_show_2 """ show data 
properties("entire_warehouse"="true","db_names"="SHOW_DATA_2"); """
-
-  qt_show_3 """ show data 
properties("entire_warehouse"="true","db_names"="SHOW_DATA_1,SHOW_DATA_2"); """
-
-  def result = sql """show data properties("entire_warehouse"="true")"""
-
-  assertTrue(result.size() >= 3)
-
-  sql """ DROP DATABASE IF EXISTS SHOW_DATA_1; """
-  result = sql """show data properties("entire_warehouse"="true")"""
-  assertTrue(result.size() > 0)
-  for (row : result) {
-    if (row[0].toString().equalsIgnoreCase("total")) {
-      assertTrue(row[2].toInteger() > 0)
+    def db1Name = "SHOW_DATA_1"
+    def db2Name = "SHOW_DATA_2"
+    try {
+        log.info("db1Name:${db1Name}, db2Name:${db2Name}");
+        sql """ DROP DATABASE IF EXISTS ${db1Name}; """
+        sql """ DROP DATABASE IF EXISTS ${db2Name}; """
+        sql """ CREATE DATABASE ${db1Name}; """
+        sql """ CREATE DATABASE ${db2Name}; """
+
+        sql """ USE ${db1Name}; """
+
+        sql """ CREATE TABLE `table` (
+            `siteid` int(11) NOT NULL COMMENT "",
+            `citycode` int(11) NOT NULL COMMENT "",
+            `userid` int(11) NOT NULL COMMENT "",
+            `pv` int(11) NOT NULL COMMENT ""
+        ) ENGINE=OLAP
+        DUPLICATE KEY(`siteid`)
+        COMMENT "OLAP"
+        DISTRIBUTED BY HASH(`siteid`) BUCKETS 1
+        PROPERTIES("replication_num" = "1"); """
+
+        sql """ insert into `table` values
+                (9,10,11,12),
+                (9,10,11,12),
+                (1,2,3,4),
+                (13,21,22,16),
+                (13,14,15,16),
+                (17,18,19,20),
+                (1,2,3,4),
+                (13,21,22,16),
+                (13,14,15,16),
+                (17,18,19,20),
+                (5,6,7,8),
+                (5,6,7,8); """
+
+        sql """ USE ${db2Name}; """
+
+        sql """ CREATE TABLE `table` (
+        `siteid` int(11) NOT NULL COMMENT "",
+        `citycode` int(11) NOT NULL COMMENT "",
+        `userid` int(11) NOT NULL COMMENT "",
+        `pv` int(11) NOT NULL COMMENT ""
+        ) ENGINE=OLAP
+        DUPLICATE KEY(`siteid`)
+        COMMENT "OLAP"
+        DISTRIBUTED BY HASH(`siteid`) BUCKETS 1
+        PROPERTIES("replication_num" = "1"); """
+
+        sql """ insert into `table` values
+                (9,10,11,12),
+                (9,10,11,12),
+                (1,2,3,4),
+                (13,21,22,16),
+                (13,14,15,16); """
+    
+        // wait for heartbeat
+
+        long start = System.currentTimeMillis()
+        long dataSize = 0
+        long current = -1
+        do {
+            current = System.currentTimeMillis()
+            def res = sql """ show data 
properties("entire_warehouse"="true","db_names"="${db1Name},${db2Name}"); """
+            if (res[0][1].toInteger() > 0 && res[1][1].toInteger() > 0) {
+                break;
+            }
+            sleep(30000)
+        } while (current - start < 600000)
+
+        qt_show_1 """ show data 
properties("entire_warehouse"="true","db_names"="${db1Name}"); """
+
+        qt_show_2 """ show data 
properties("entire_warehouse"="true","db_names"="${db2Name}"); """
+
+        qt_show_3 """ show data 
properties("entire_warehouse"="true","db_names"="${db1Name},${db2Name}"); """
+
+        def result = sql """show data properties("entire_warehouse"="true")"""
+
+        assertTrue(result.size() >= 3)
+
+        sql """ DROP DATABASE IF EXISTS ${db1Name}; """
+        result = sql """show data properties("entire_warehouse"="true")"""
+        assertTrue(result.size() > 0)
+        for (row : result) {
+            if (row[0].toString().equalsIgnoreCase("total")) {
+                assertTrue(row[2].toInteger() > 0)
+            }
+        }
+    } finally {
+        sql """ DROP DATABASE IF EXISTS ${db1Name} FORCE;"""
+        sql """ DROP DATABASE IF EXISTS ${db2Name} FORCE;"""
     }
-  }
-
-
 }


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

Reply via email to