Skip to content

Commit

Permalink
branch-3.0: [fix](regression test) Fix S3 load profile test failed in…
Browse files Browse the repository at this point in the history
… multi-frontends environment. #47330 (#47442)

cherry pick from #47330
  • Loading branch information
zhiqiang-hhhh authored Jan 26, 2025
1 parent 4d5b371 commit a3580a6
Showing 1 changed file with 43 additions and 10 deletions.
53 changes: 43 additions & 10 deletions regression-test/suites/query_profile/s3_load_profile_test.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -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"))
Expand Down

0 comments on commit a3580a6

Please sign in to comment.