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

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


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new a3580a610d9 branch-3.0: [fix](regression test) Fix S3 load profile 
test failed in multi-frontends environment. #47330 (#47442)
a3580a610d9 is described below

commit a3580a610d9c3d34be757a98cd8872c260ed90dd
Author: zhiqiang <hezhiqi...@selectdb.com>
AuthorDate: Sun Jan 26 09:39:39 2025 +0800

    branch-3.0: [fix](regression test) Fix S3 load profile test failed in 
multi-frontends environment. #47330 (#47442)
    
    cherry pick from #47330
---
 .../query_profile/s3_load_profile_test.groovy      | 53 ++++++++++++++++++----
 1 file changed, 43 insertions(+), 10 deletions(-)

diff --git a/regression-test/suites/query_profile/s3_load_profile_test.groovy 
b/regression-test/suites/query_profile/s3_load_profile_test.groovy
index 6405afdf954..258fbf4fe7b 100644
--- a/regression-test/suites/query_profile/s3_load_profile_test.groovy
+++ b/regression-test/suites/query_profile/s3_load_profile_test.groovy
@@ -17,15 +17,26 @@
 
 import groovy.json.JsonSlurper
 
-def getProfile = { id ->
-        def dst = 'http://' + context.config.feHttpAddress
-        def conn = new URL(dst + 
"/api/profile/text/?query_id=$id").openConnection()
-        conn.setRequestMethod("GET")
-        def encoding = 
Base64.getEncoder().encodeToString((context.config.feHttpUser + ":" + 
-                (context.config.feHttpPassword == null ? "" : 
context.config.feHttpPassword)).getBytes("UTF-8"))
-        conn.setRequestProperty("Authorization", "Basic ${encoding}")
-        return conn.getInputStream().getText()
-    }
+def getProfileList = { masterHTTPAddr ->
+    def dst = 'http://' + masterHTTPAddr
+    def conn = new URL(dst + "/rest/v1/query_profile").openConnection()
+    conn.setRequestMethod("GET")
+    def encoding = 
Base64.getEncoder().encodeToString((context.config.feHttpUser + ":" + 
+            (context.config.feHttpPassword == null ? "" : 
context.config.feHttpPassword)).getBytes("UTF-8"))
+    conn.setRequestProperty("Authorization", "Basic ${encoding}")
+    return conn.getInputStream().getText()
+}
+
+
+def getProfile = { masterHTTPAddr, id ->
+    def dst = 'http://' + masterHTTPAddr
+    def conn = new URL(dst + 
"/api/profile/text/?query_id=$id").openConnection()
+    conn.setRequestMethod("GET")
+    def encoding = 
Base64.getEncoder().encodeToString((context.config.feHttpUser + ":" + 
+            (context.config.feHttpPassword == null ? "" : 
context.config.feHttpPassword)).getBytes("UTF-8"))
+    conn.setRequestProperty("Authorization", "Basic ${encoding}")
+    return conn.getInputStream().getText()
+}
 
 // ref 
https://github.com/apache/doris/blob/3525a03815814f66ec78aa2ad6bbd9225b0e7a6b/regression-test/suites/load_p0/broker_load/test_s3_load.groovy
 suite('s3_load_profile_test') {
@@ -171,7 +182,29 @@ PROPERTIES (
     Thread.sleep(5000)
     qt_select """ select count(*) from $loadAttribute.dataDesc.tableName """
     logger.info("jobId: " + jobId)
-    def profileString = getProfile(jobId)
+
+    def allFrontends = sql """show frontends;"""
+    logger.info("allFrontends: " + allFrontends)
+    /*
+     - allFrontends: [[fe_2457d42b_68ad_43c4_a888_b3558a365be2, 127.0.0.1, 
6917, 5937, 6937, 5927, -1, FOLLOWER, true, 1523277282, true, true, 13436, 
2025-01-22 16:39:05, 2025-01-22 21:43:49, true, , doris-0.0.0--03faad7da5, Yes]]
+    */
+    def frontendCounts = allFrontends.size()
+    def masterIP = ""
+    def masterHTTPPort = ""
+
+    for (def i = 0; i < frontendCounts; i++) {
+        def currentFrontend = allFrontends[i]
+        def isMaster = currentFrontend[8]
+        if (isMaster == "true") {
+            masterIP = allFrontends[i][1]
+            masterHTTPPort = allFrontends[i][3]
+            break
+        }
+    }
+    def masterAddress = masterIP + ":" + masterHTTPPort
+    logger.info("masterIP:masterHTTPPort is:${masterAddress}")
+
+    def profileString = getProfile(masterAddress, jobId)
     logger.info("profileDataString:" + profileString)
     assertTrue(profileString.contains("NumScanners"))
     assertTrue(profileString.contains("RowsProduced"))


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

Reply via email to