You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2025/12/11 10:22:53 UTC
(doris) branch branch-4.0 updated: [test](mtls)test framwork support tls (#5874) (#58368) (#58838)
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new 468b3f6dbb5 [test](mtls)test framwork support tls (#5874) (#58368) (#58838)
468b3f6dbb5 is described below
commit 468b3f6dbb5d29efef1d2aa299d6789bb21b3257
Author: chunping <zh...@selectdb.com>
AuthorDate: Thu Dec 11 18:22:45 2025 +0800
[test](mtls)test framwork support tls (#5874) (#58368) (#58838)
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [x] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [x] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [x] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [x] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
---
regression-test/conf/regression-conf.groovy | 13 ++
.../org/apache/doris/regression/Config.groovy | 66 +++++-
.../doris/regression/action/HttpCliAction.groovy | 223 ++++++++++-----------
.../doris/regression/action/ProfileAction.groovy | 66 ++++++
.../regression/action/StreamLoadAction.groovy | 211 ++++++++++++++++---
.../org/apache/doris/regression/suite/Suite.groovy | 14 +-
.../doris/regression/suite/SuiteContext.groovy | 19 ++
.../org/apache/doris/regression/util/Http.groovy | 78 +++++++
.../plugins/cloud_compaction_plugin.groovy | 16 +-
.../plugins/cloud_show_data_plugin.groovy | 3 +
.../plugins/plugin_curl_requester.groovy | 66 +++++-
.../plugins/plugin_query_timeout_debugger.groovy | 103 +++++++++-
.../auth_call/test_dml_stream_load_auth.groovy | 8 +-
...est_bloom_filter_hit_with_renamed_column.groovy | 69 ++-----
.../cloud_p0/balance/test_balance_warm_up.groovy | 3 +
.../test_balance_warm_up_use_peer_cache.groovy | 3 +
...e_warm_up_with_compaction_use_peer_cache.groovy | 3 +
.../balance/test_peer_read_async_warmup.groovy | 3 +
.../cache/compaction/test_stale_rowset.groovy | 9 +-
.../cluster/test_immediate_warmup_basic.groovy | 3 +
.../test_immediate_warmup_multi_segments.groovy | 12 +-
.../cluster/test_warm_up_cluster_event.groovy | 3 +
.../test_warm_up_cluster_event_add_new_be.groovy | 3 +
...test_warm_up_cluster_event_cancel_active.groovy | 3 +
...est_warm_up_cluster_event_cancel_passive.groovy | 3 +
.../test_warm_up_cluster_event_compaction.groovy | 3 +
...rm_up_cluster_event_compaction_sync_wait.groovy | 12 +-
...uster_event_compaction_sync_wait_timeout.groovy | 12 +-
.../test_warm_up_cluster_event_rename.groovy | 3 +
...est_warm_up_cluster_event_restart_all_be.groovy | 3 +
..._warm_up_cluster_event_restart_master_fe.groovy | 3 +
...test_warm_up_cluster_event_schema_change.groovy | 3 +
.../cluster/test_warm_up_cluster_periodic.groovy | 3 +
...test_warm_up_cluster_periodic_add_new_be.groovy | 3 +
.../test_warm_up_cluster_periodic_and_event.groovy | 3 +
.../test_warm_up_cluster_periodic_rename.groovy | 3 +
...rm_up_cluster_periodic_restart_master_fe.groovy | 3 +
.../test_warm_up_cluster_periodic_slow_job.groovy | 3 +
.../test_mow_agg_delete_bitmap.groovy | 36 +++-
.../test_enable_prefer_cached_rowset.groovy | 3 +
.../test_query_freshness_tolerance.groovy | 3 +
..._warmup_delay_compaction_query_tolerance.groovy | 12 +-
.../test_warmup_delay_idx_query_tolerance.groovy | 12 +-
.../test_warmup_delay_sc_query_tolerance.groovy | 12 +-
...delay_timeout_compaction_query_tolerance.groovy | 12 +-
.../warmup/test_warmup_download_fail.groovy | 12 +-
.../cloud_p0/test_read_cluster_var_property.groovy | 3 +
.../test_compaction_fail_release_lock.groovy | 22 +-
...test_compaction_update_big_delete_bitmap.groovy | 22 +-
...e_compaction_and_read_stale_cloud_docker.groovy | 22 +-
...ultisegments_and_read_stale_cloud_docker.groovy | 13 +-
.../test_filecache_with_base_compaction.groovy | 22 +-
...ilecache_with_base_compaction_thresthold.groovy | 22 +-
.../test_mow_compact_multi_segments.groovy | 13 +-
...paction_agg_and_remove_pre_delete_bitmap.groovy | 22 +-
.../test_mow_compaction_and_read_stale.groovy | 22 +-
...w_compaction_and_read_stale_cloud_docker.groovy | 22 +-
...test_mow_compaction_and_rowset_not_exist.groovy | 22 +-
.../test_mow_compaction_and_schema_change.groovy | 22 +-
.../test_mow_delete_unused_rowset_dm_docker.groovy | 22 +-
.../test_mow_stale_rowset_delete_bitmap.groovy | 22 +-
.../test_single_compaction_fault_injection.groovy | 22 +-
...e_compaction_with_variant_inverted_index.groovy | 22 +-
.../test_single_replica_compaction.groovy | 22 +-
.../import-way/group-commit-manual.md.groovy | 15 +-
.../doc/table-design/auto-increment.md.groovy | 11 +-
.../dynamic-partitioning.md.groovy | 10 +-
.../index/ngram-bloomfilter-index.md.groovy | 8 +-
.../suites/export/test_array_export.groovy | 7 +-
.../suites/export/test_map_export.groovy | 7 +-
.../suites/export/test_struct_export.groovy | 7 +-
.../outfile/parquet/test_outfile_parquet.groovy | 8 +-
.../suites/export_p0/test_export_basic.groovy | 8 +-
.../suites/export_p0/test_export_csv.groovy | 7 +-
.../export_p0/test_export_data_consistency.groovy | 7 +-
.../export_p0/test_export_delete_disallow.groovy | 7 +-
.../export_p0/test_export_empty_table.groovy | 7 +-
.../test_export_table_with_label_retry.groovy | 7 +-
.../suites/export_p0/test_export_view.groovy | 7 +-
.../suites/export_p0/test_outfile.groovy | 8 +-
.../export_p0/test_outfile_csv_with_names.groovy | 8 +-
.../test_outfile_csv_with_names_and_types.groovy | 7 +-
.../test_outfile_csv_with_success_prefix.groovy | 7 +-
.../suites/export_p0/test_outfile_expr.groovy | 7 +-
.../suites/export_p0/test_outfile_separator.groovy | 7 +-
.../suites/export_p2/test_export_big_data.groovy | 7 +-
.../export/test_export_external_table.groovy | 7 +-
.../test_cloud_mow_delete_bitmap_lock_case.groovy | 22 +-
.../test_delete_bitmap_lock_with_restart.groovy | 9 +-
.../flink_connector_response.groovy | 11 +-
.../http_rest_api/get/test_schema_api.groovy | 14 ++
.../http_rest_api/post/test_query_stmt.groovy | 54 ++++-
..._index_change_with_cumulative_compaction.groovy | 12 +-
.../test_index_change_with_full_compaction.groovy | 12 +-
...est_cumulative_compaction_with_format_v2.groovy | 12 +-
.../test_mor_table_with_format_v2.groovy | 13 +-
.../test_mow_table_with_format_v2.groovy | 53 +++--
...single_replica_compaction_with_format_v2.groovy | 12 +-
.../test_arrayInvertedIdx_profile.groovy | 14 +-
.../stream_load/test_get_stream_load_state.groovy | 8 +-
...t_stream_load_with_nonexist_db_and_table.groovy | 3 +
.../stream_load/test_group_commit_wal_limit.groovy | 6 +
.../load_p0/stream_load/test_json_load.groovy | 2 +-
.../test_load_with_transfer_encoding.groovy | 3 +
.../stream_load/test_publish_timeout.groovy | 9 +-
.../test_s3_bytes_written_metrics.groovy | 3 +
.../load_p0/stream_load/test_stream_load.groovy | 175 ++++++++--------
.../stream_load/test_stream_load_2pc.groovy | 16 +-
.../test_stream_load_2pc_with_schema_change.groovy | 3 +
.../test_stream_load_err_log_limit.groovy | 9 +-
.../stream_load/test_stream_load_properties.groovy | 2 +-
.../suites/manager/test_manager_interface_1.groovy | 10 +-
.../metrics_p0/test_delete_bitmap_metrics.groovy | 3 +
.../mysql_ssl_p0/test_mysql_connection.groovy | 40 ++--
.../nereids_p0/aggregate/window_funnel.groovy | 3 +
.../authorization/column_authorization.groovy | 7 +-
.../authorization/view_authorization.groovy | 7 +-
.../suites/nereids_p0/outfile/test_outfile.groovy | 7 +-
.../outfile/test_outfile_csv_with_names.groovy | 10 +-
.../nereids_p0/outfile/test_outfile_expr.groovy | 7 +-
.../nereids_p0/outfile/test_outfile_parquet.groovy | 10 +-
.../outfile/test_outfile_separator.groovy | 7 +-
...ptive_pipeline_task_serial_read_on_limit.groovy | 39 +---
.../query_profile/s3_load_profile_test.groovy | 25 +--
.../suites/query_profile/scanner_profile.groovy | 70 ++-----
.../query_profile/test_execute_by_frontend.groovy | 31 +--
.../suites/query_profile/test_profile.groovy | 28 +--
127 files changed, 1865 insertions(+), 618 deletions(-)
diff --git a/regression-test/conf/regression-conf.groovy b/regression-test/conf/regression-conf.groovy
index a984c24b937..005af215627 100644
--- a/regression-test/conf/regression-conf.groovy
+++ b/regression-test/conf/regression-conf.groovy
@@ -295,3 +295,16 @@ hudiEmrCatalog = ""
icebergS3TablesCatalog=""
icebergS3TablesCatalogGlueRest=""
+// The path of the cert configuration file for the testing framework
+// is consistent with the path of the cert file for the cluster
+enableTLS=false
+tlsVerifyMode="strict"
+keyStorePath="/your/keystore.p12"
+keyStorePassword="yourPwd"
+keyStoreType="PKCS12"
+trustStorePath="/your/truststore.p12"
+trustStorePassword="yourPwd"
+trustStoreType="PKCS12"
+trustCert="/your/certificate.crt"
+trustCACert="/your/ca.crt"
+trustCAKey="/your/certificate.key"
diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/Config.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/Config.groovy
index 3cc4ba72b71..b9d684adae9 100644
--- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/Config.groovy
+++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/Config.groovy
@@ -1043,7 +1043,24 @@ class Config {
}
void createDefaultDb() {
+ boolean enableTLS = (otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+
+ def buildUrl = { String db ->
+ enableTLS ?
+ buildUrlWithDb(
+ jdbcUrl, db,
+ otherConfigs.get("keyStorePath").toString(),
+ otherConfigs.get("keyStorePassword").toString(),
+ otherConfigs.get("trustStorePath").toString(),
+ otherConfigs.get("trustStorePassword").toString()
+ )
+ : buildUrlWithDb(jdbcUrl, db)
+ }
+
+ // init URL without dbName
String dbName = null
+ jdbcUrl = buildUrl(dbName)
+
try {
tryCreateDbIfNotExist(defaultDb)
dbName = defaultDb
@@ -1053,11 +1070,13 @@ class Config {
// Infact, only mainly auth_xxx cases use defaultDb, and they just use jdbcUrl in connect function.
// And they can avoid using defaultDb too. But modify all these cases take a lot work.
// We better delete all the usage of defaultDb in suites later, and all suites should use their own db, not the defaultDb.
- log.warn("create default db failed ${defaultDb}".toString())
+ log.warn("create default db failed ${defaultDb}")
}
- jdbcUrl = buildUrlWithDb(jdbcUrl, dbName)
- log.info("Reset jdbcUrl to ${jdbcUrl}".toString())
+ // final URL with dbName
+ jdbcUrl = buildUrl(dbName)
+
+ log.info("Reset jdbcUrl to ${jdbcUrl}")
}
void tryCreateDbIfNotExist(String dbName) {
@@ -1156,6 +1175,18 @@ class Config {
return DriverManager.getConnection(jdbcUrl, 'root', '')
}
+ Connection getConnectionByDbName(String dbName) {
+ String dbUrl = getConnectionUrlByDbName(dbName)
+ tryCreateDbIfNotExist(dbName)
+ log.info("connect to ${dbUrl}".toString())
+ return DriverManager.getConnection(dbUrl, jdbcUser, jdbcPassword)
+ }
+
+ String getConnectionUrlByDbName(String dbName) {
+ def connection = buildUrlWithDb(jdbcUrl, dbName)
+ return connection
+ }
+
Connection getConnectionByArrowFlightSqlDbName(String dbName) {
Class.forName("org.apache.arrow.driver.jdbc.ArrowFlightJdbcDriver")
String arrowFlightSqlHost = otherConfigs.get("extArrowFlightSqlHost")
@@ -1269,6 +1300,13 @@ class Config {
return urlWithDb
}
+ public static String buildUrlWithDb (String jdbcUrl, String dbName, String keyStorePath, String keyStorePassword, String trustStorePath, String trustStorePassword) {
+ String urlWithDb = buildUrlWithDbImpl(jdbcUrl, dbName);
+ urlWithDb = addTlsUrl(urlWithDb, keyStorePath, keyStorePassword, trustStorePath, trustStorePassword);
+ urlWithDb = addTimeoutUrl(urlWithDb);
+ return urlWithDb
+ }
+
public static String buildUrlWithDb(String host, int queryPort, String dbName) {
def url = String.format(
"jdbc:mysql://%s:%s/?useLocalSessionState=true&allowLoadLocalInfile=false",
@@ -1299,6 +1337,28 @@ class Config {
}
}
+ private static String addTlsUrl(String url, String keyStorePath, String keyStorePassword, String trustStorePath, String trustStorePassword) {
+ // ssl-mode = PREFERRED
+ String useSsl = "true"
+ String requireSsl = "true"
+ String useSslconfig = "useSSL=" + useSsl + "&requireSSL=" + requireSsl + "&verifyServerCertificate=true"
+ String clientCAKey = "clientCertificateKeyStoreUrl=file:" + keyStorePath
+ String clientCAPwd = "clientCertificateKeyStorePassword=" + keyStorePassword
+ String trustCAKey = "trustCertificateKeyStoreUrl=file:" + trustStorePath
+ String trustCAPwd = "trustCertificateKeyStorePassword=" + trustStorePassword
+ String tlsUrl = useSslconfig + "&" + clientCAKey + "&" + clientCAPwd + "&" + trustCAKey + "&" + trustCAPwd
+ // e.g: jdbc:mysql://locahost:8080/dbname?
+ if (url.charAt(url.length() - 1) == '?') {
+ return url + tlsUrl
+ // e.g: jdbc:mysql://locahost:8080/dbname?a=b
+ } else if (url.contains('?')) {
+ return url + '&' + tlsUrl
+ // e.g: jdbc:mysql://locahost:8080/dbname
+ } else {
+ return url + '?' + tlsUrl
+ }
+ }
+
private static String addTimeoutUrl(String url) {
if (url.contains("connectTimeout=") || url.contains("socketTimeout="))
{
diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/action/HttpCliAction.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/action/HttpCliAction.groovy
index b156a315151..b5b88089fb6 100644
--- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/action/HttpCliAction.groovy
+++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/action/HttpCliAction.groovy
@@ -24,16 +24,24 @@ import groovy.util.logging.Slf4j
import org.apache.doris.regression.suite.SuiteContext
import org.apache.http.client.methods.HttpDelete
import org.apache.http.client.methods.HttpGet
+import org.apache.http.client.methods.HttpPost
import org.apache.http.entity.StringEntity
import org.apache.http.entity.ContentType
+import org.apache.http.impl.client.CloseableHttpClient
import org.apache.http.impl.client.DefaultHttpClient
import org.apache.http.impl.client.HttpClients
import org.apache.http.impl.client.LaxRedirectStrategy
+import org.apache.http.conn.ssl.NoopHostnameVerifier
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory
+import org.apache.http.impl.client.HttpClientBuilder
+import org.apache.http.ssl.SSLContexts
import org.apache.http.util.EntityUtils
-import org.apache.http.client.methods.HttpPost
-import org.apache.tools.ant.taskdefs.condition.Http;
import org.junit.Assert
+import javax.net.ssl.HostnameVerifier
+import javax.net.ssl.SSLContext
+import java.security.KeyStore
+
@Slf4j
class HttpCliAction implements SuiteAction {
private String endpoint
@@ -46,147 +54,138 @@ class HttpCliAction implements SuiteAction {
private boolean printResponse = true
SuiteContext context
- HttpCliAction(SuiteContext context) {
- this.context = context
- }
-
- void endpoint(Closure<String> endpointSupplier) {
- this.endpoint = endpointSupplier.call()
- }
+ static Boolean enableTls = false
+ static String tlsVerifyMode = "none" // none/ca/strict
+ static String trustStorePath = null
+ static String trustStorePassword = null
+ static String keyStorePath = null
+ static String keyStorePassword = null
+ static String keyStoreType = null
+ static String trustStoreType = null
- void endpoint(String endpoint) {
- this.endpoint = endpoint
- }
- void uri(Closure<String> uriSupplier) {
- this.uri = uriSupplier.call()
- }
+ private SSLConnectionSocketFactory sslSocketFactory
+ private CloseableHttpClient httpClient
- void uri(String uri) {
- this.uri = uri
+ HttpCliAction(SuiteContext context) {
+ this.context = context
+ this.enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ this.tlsVerifyMode = context.config.otherConfigs.get("tlsVerifyMode")?.toString()?.toLowerCase() ?: "none"
+ this.trustStorePath = context.config.otherConfigs.get("trustStorePath")?.toString() ?: null
+ this.trustStorePassword = context.config.otherConfigs.get("trustStorePassword")?.toString() ?: null
+ this.trustStoreType = context.config.otherConfigs.get("trustStoreType") ?: 'JKS'
+ this.keyStorePath = context.config.otherConfigs.get("keyStorePath")?.toString() ?: null
+ this.keyStorePassword = context.config.otherConfigs.get("keyStorePassword")?.toString() ?: null
+ this.keyStoreType = context.config.otherConfigs.get("keyStoreType")?.toString() ?: 'PKCS12'
+
+ if (this.enableTls) {
+ initSSLContext()
+ } else {
+ this.httpClient = HttpClients.custom()
+ .setRedirectStrategy(new LaxRedirectStrategy())
+ .build()
+ }
}
- void header(String key, String value) {
- this.headers.put(key, value)
- }
+ void endpoint(Closure<String> endpointSupplier) { this.endpoint = endpointSupplier.call() }
+ void endpoint(String endpoint) { this.endpoint = endpoint }
+ void uri(Closure<String> uriSupplier) { this.uri = uriSupplier.call() }
+ void uri(String uri) { this.uri = uri }
+ void header(String key, String value) { this.headers.put(key, value) }
void basicAuthorization(String user, String password) {
String credentials = user + ":" + (password.is(null) ? "" : password)
String encodedCredentials = Base64.getEncoder().encodeToString(credentials.getBytes())
- String headerValue = "Basic " + encodedCredentials;
- headers.put("Authorization", headerValue)
- }
-
- void body(Closure<String> bodySupplier) {
- this.body = bodySupplier.call()
- }
-
- void body(String body) {
- this.body = body
- }
-
- void op(Closure<String> opSupplier) {
- this.op = bodySupplier.call()
- }
-
- void op(String op) {
- this.op = op
- }
+ headers.put("Authorization", "Basic " + encodedCredentials)
+ }
+
+ void body(Closure<String> bodySupplier) { this.body = bodySupplier.call() }
+ void body(String body) { this.body = body }
+ void op(Closure<String> opSupplier) {this.op = opSupplier.call()}
+ void op(String op) { this.op = op }
+ void result(Object result) { this.result = result }
+ void printResponse(boolean printResponse) { this.printResponse = printResponse }
+
+ void initSSLContext() {
+ def sslContextBuilder = SSLContexts.custom()
+
+ if (this.tlsVerifyMode == "none") {
+ sslContextBuilder.loadTrustMaterial({ chain, authType -> true })
+ } else {
+ if (this.trustStorePath) {
+ KeyStore trustStore = KeyStore.getInstance(this.trustStoreType)
+ trustStore.load(new FileInputStream(this.trustStorePath), this.trustStorePassword.toCharArray())
+ sslContextBuilder.loadTrustMaterial(trustStore, null)
+ }
+ if (this.tlsVerifyMode == "strict" && this.keyStorePath) {
+ KeyStore keyStore = KeyStore.getInstance(this.keyStoreType)
+ keyStore.load(new FileInputStream(this.keyStorePath), this.keyStorePassword.toCharArray())
+ sslContextBuilder.loadKeyMaterial(keyStore, this.keyStorePassword.toCharArray())
+ }
+ }
- void result(Object result) {
- this.result = result
- }
+ SSLContext sslContext = sslContextBuilder.build()
+ HostnameVerifier hostnameVerifier = this.tlsVerifyMode == "none" ? NoopHostnameVerifier.INSTANCE : SSLConnectionSocketFactory.getDefaultHostnameVerifier()
- void printResponse(boolean printResponse) {
- this.printResponse = printResponse
+ this.sslSocketFactory = new SSLConnectionSocketFactory(sslContext, hostnameVerifier)
+ this.httpClient = HttpClients.custom()
+ .setSSLSocketFactory(this.sslSocketFactory)
+ .setRedirectStrategy(new LaxRedirectStrategy())
+ .build()
}
@Override
void run() {
try {
- def result = HttpClients.custom()
- .setRedirectStrategy(new LaxRedirectStrategy()) // allow redirect to fe master
- .build()
- .withCloseable { client ->
- uri = "http://$endpoint" + uri
- log.info("url : " + uri)
- log.info("body: " + body)
- log.info("op: " + op)
-
- if (op == "get") {
- HttpGet httpGet = new HttpGet(uri)
- for (final def header in headers.entrySet()) {
- httpGet.setHeader(header.getKey(), header.getValue())
- }
-
- client.execute(httpGet).withCloseable { resp ->
- resp.withCloseable {
- String respJson = EntityUtils.toString(resp.getEntity())
- def respCode = resp.getStatusLine().getStatusCode()
- if (printResponse) {
- log.info("respCode: ${respCode}, respJson: ${respJson}")
- }
- return new ActionResult(respCode, respJson)
- }
- }
- } else if (op == "delete") {
- HttpDelete httpDelete = new HttpDelete(uri)
- for (final def header in headers.entrySet()) {
- httpDelete.setHeader(header.getKey(), header.getValue())
- }
- client.execute(httpDelete).withCloseable { resp ->
- resp.withCloseable {
- String respJson = EntityUtils.toString(resp.getEntity())
- def respCode = resp.getStatusLine().getStatusCode()
- if (printResponse) {
- log.info("respCode: ${respCode}, respJson: ${respJson}")
- }
- return new ActionResult(respCode, respJson)
- }
- }
- }
- else {
- HttpPost httpPost = new HttpPost(uri)
- for (final def header in headers.entrySet()) {
- httpPost.setHeader(header.getKey(), header.getValue())
- }
- StringEntity requestEntity = new StringEntity(
- body,
- ContentType.APPLICATION_JSON);
- httpPost.setEntity(requestEntity)
-
- client.execute(httpPost).withCloseable { resp ->
- resp.withCloseable {
- String respJson = EntityUtils.toString(resp.getEntity())
- def respCode = resp.getStatusLine().getStatusCode()
- if (printResponse) {
- log.info("respCode: ${respCode}, respJson: ${respJson}")
- }
- return new ActionResult(respCode, respJson)
- }
- }
- }
+ def protocol = this.enableTls ? "https" : "http"
+ uri = "${protocol}://${endpoint}${uri}"
+ log.info("url : $uri")
+ log.info("body: $body")
+ log.info("op: $op")
+
+ def result
+ if (op == "get") {
+ HttpGet httpGet = new HttpGet(uri)
+ headers.each { k, v -> httpGet.setHeader(k, v) }
+ result = executeRequest(httpGet)
+ } else if (op == "delete") {
+ HttpDelete httpDelete = new HttpDelete(uri)
+ headers.each { k, v -> httpDelete.setHeader(k, v) }
+ result = executeRequest(httpDelete)
+ } else {
+ HttpPost httpPost = new HttpPost(uri)
+ headers.each { k, v -> httpPost.setHeader(k, v) }
+ httpPost.setEntity(new StringEntity(body, ContentType.APPLICATION_JSON))
+ result = executeRequest(httpPost)
}
+
if (printResponse) {
log.info("result:${result}".toString())
- log.info("this.result:${this.result}".toString())
}
if (check != null) {
check.call(result.respCode, result.body)
- } else {
- if (this.result != null) {
- Assert.assertEquals(this.result, result)
- }
+ } else if (this.result != null) {
+ Assert.assertEquals(this.result, result)
}
} catch (Throwable t) {
throw new IllegalStateException("HttpCliAction failed, uri:${uri}", t)
}
}
+ private ActionResult executeRequest(request) {
+ this.httpClient.execute(request).withCloseable { resp ->
+ String respJson = EntityUtils.toString(resp.getEntity())
+ def respCode = resp.getStatusLine().getStatusCode()
+ if (printResponse) {
+ log.info("respCode: ${respCode}, respJson: ${respJson}")
+ }
+ return new ActionResult(respCode, respJson)
+ }
+ }
+
class ActionResult {
String body
int respCode
-
ActionResult(int respCode, String body) {
this.body = body
this.respCode = respCode
diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/action/ProfileAction.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/action/ProfileAction.groovy
index 824ac4098e1..d4985d0fe4f 100644
--- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/action/ProfileAction.groovy
+++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/action/ProfileAction.groovy
@@ -36,6 +36,11 @@ class ProfileAction implements SuiteAction {
this.tag = Objects.requireNonNull(tag, "tag can not be null")
}
+ ProfileAction(SuiteContext context) {
+ this.context = context
+ this.tag = null
+ }
+
void run(@ClosureParams(value = FromString, options = []) Runnable run) {
runCallback = run
}
@@ -45,6 +50,67 @@ class ProfileAction implements SuiteAction {
this.check = check
}
+ List getProfileList() {
+ def httpCli = new HttpCliAction(context)
+ def addr = context.getFeHttpAddress()
+ httpCli.endpoint("${addr.hostString}:${addr.port}")
+ httpCli.uri("/rest/v1/query_profile")
+ httpCli.op("get")
+ httpCli.printResponse(false)
+
+ if (context.config.isCloudMode()) {
+ httpCli.basicAuthorization(context.config.feCloudHttpUser, context.config.feCloudHttpPassword)
+ } else {
+ httpCli.basicAuthorization(context.config.feHttpUser, context.config.feHttpPassword)
+ }
+ List profileData = []
+ httpCli.check { code, body ->
+ if (code != 200) {
+ throw new IllegalStateException("Get profile list failed, code: ${code}, body:\n${body}")
+ }
+
+ def jsonSlurper = new JsonSlurper()
+ profileData = jsonSlurper.parseText(body).data.rows
+ }
+ httpCli.run()
+ return profileData
+ }
+
+ String getProfile(String profileId) {
+ def profileCli = new HttpCliAction(context)
+ def addr = context.getFeHttpAddress()
+ profileCli.endpoint("${addr.hostString}:${addr.port}")
+ profileCli.uri("/rest/v1/query_profile/${profileId}")
+ profileCli.op("get")
+ profileCli.printResponse(false)
+
+ if (context.config.isCloudMode()) {
+ profileCli.basicAuthorization(context.config.feCloudHttpUser, context.config.feCloudHttpPassword)
+ } else {
+ profileCli.basicAuthorization(context.config.feHttpUser, context.config.feHttpPassword)
+ }
+ def result = [text: ""]
+ profileCli.check { profileCode, profileResp ->
+ if (profileCode != 200) {
+ throw new IllegalStateException("Get profile failed, url: ${"/rest/v1/query_profile/${profileId}"}, code: ${profileCode}, body:\n${profileResp}")
+ }
+
+ def jsonSlurper2 = new JsonSlurper()
+ def profileText = jsonSlurper2.parseText(profileResp).data
+ // Convert HTML entities and actual NBSPs to regular spaces,
+ // retain line breaks, and then compress multiple consecutive spaces into a single space
+ profileText = profileText.replace(" ", " ")
+ profileText = profileText.replace("</br>", "\n")
+ // Replace the actual NBSP characters with regular spaces
+ profileText = profileText.replace('\u00A0' as char, ' ' as char)
+ // Compress two or more consecutive regular spaces into a single space (without affecting line breaks)
+ profileText = profileText.replaceAll(" {2,}", " ")
+ result.text = profileText
+ }
+ profileCli.run()
+ return result.text
+ }
+
@Override
void run() {
if (runCallback.is(null)) {
diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/action/StreamLoadAction.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/action/StreamLoadAction.groovy
index 207bfdbfedd..c7024d5a5be 100644
--- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/action/StreamLoadAction.groovy
+++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/action/StreamLoadAction.groovy
@@ -36,6 +36,7 @@ import org.apache.http.entity.InputStreamEntity
import org.apache.http.entity.StringEntity
import org.apache.http.impl.client.CloseableHttpClient
import org.apache.http.impl.client.HttpClients
+import org.apache.http.impl.client.HttpClientBuilder
import org.apache.http.util.EntityUtils
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager
import org.apache.http.config.ConnectionConfig
@@ -45,6 +46,15 @@ import org.junit.Assert
import java.io.InputStream
import java.io.IOException
+import javax.net.ssl.HostnameVerifier
+import org.apache.http.conn.ssl.NoopHostnameVerifier
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory
+import org.apache.http.ssl.SSLContexts
+import javax.net.ssl.*
+import java.security.KeyStore
+import java.security.SecureRandom
+import java.security.cert.X509Certificate
+
@Slf4j
class StreamLoadAction implements SuiteAction {
public InetSocketAddress address
@@ -65,6 +75,21 @@ class StreamLoadAction implements SuiteAction {
boolean twoPhaseCommit = false
boolean enableUtf8Encoding = false // 新增:UTF-8编码支持开关
+ boolean enableTLS = false
+ String keyStorePath
+ String keyStorePassword
+ String keyStoreType = "PKCS12"
+ String trustStorePath
+ String trustStorePassword
+ String trustStoreType = "PKCS12"
+ boolean sslHostnameVerify = false
+ String tlsVerifyMode = "strict"
+
+ // HTTP client timeout settings (in milliseconds)
+ int connectTimeout = 0 // 0 means use default (no explicit timeout)
+ int socketTimeout = 0 // 0 means use default (no explicit timeout)
+ int connectionRequestTimeout = 0 // 0 means use default (no explicit timeout)
+
StreamLoadAction(SuiteContext context) {
this.address = context.getFeHttpAddress()
this.user = context.config.feHttpUser
@@ -76,6 +101,17 @@ class StreamLoadAction implements SuiteAction {
this.context = context
this.headers = new LinkedHashMap<>()
this.headers.put('label', UUID.randomUUID().toString())
+
+ def oc = context.config.otherConfigs ?: [:]
+ this.enableTLS = (oc.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ this.keyStorePath = oc.get("keyStorePath")
+ this.keyStorePassword = oc.get("keyStorePassword")
+ this.keyStoreType = oc.get("keyStoreType") ?: 'PKCS12'
+ this.trustStorePath = oc.get("trustStorePath")
+ this.trustStorePassword = oc.get("trustStorePassword")
+ this.trustStoreType = oc.get("trustStoreType") ?: 'PKCS12'
+ this.tlsVerifyMode = oc.get("tlsVerifyMode") ?: 'strict'
+ this.sslHostnameVerify = ('none'.equalsIgnoreCase(this.tlsVerifyMode)) ? false : true
}
void db(String db) {
@@ -191,54 +227,183 @@ class StreamLoadAction implements SuiteAction {
headers.remove(key)
}
+ // Methods to dynamically set TLS configuration
+ void enableTLS(boolean enable) {
+ this.enableTLS = enable
+ }
+
+ void keyStorePath(String path) {
+ this.keyStorePath = path
+ }
+
+ void keyStorePassword(String password) {
+ this.keyStorePassword = password
+ }
+
+ void keyStoreType(String type) {
+ this.keyStoreType = type
+ }
+
+ void trustStorePath(String path) {
+ this.trustStorePath = path
+ }
+
+ void trustStorePassword(String password) {
+ this.trustStorePassword = password
+ }
+
+ void trustStoreType(String type) {
+ this.trustStoreType = type
+ }
+
+ void tlsVerifyMode(String mode) {
+ this.tlsVerifyMode = mode
+ this.sslHostnameVerify = ('none'.equalsIgnoreCase(mode)) ? false : true
+ }
+
+ void sslHostnameVerify(boolean verify) {
+ this.sslHostnameVerify = verify
+ }
+
+ void connectTimeout(int timeout) {
+ this.connectTimeout = timeout
+ }
+
+ void socketTimeout(int timeout) {
+ this.socketTimeout = timeout
+ }
+
+ void connectionRequestTimeout(int timeout) {
+ this.connectionRequestTimeout = timeout
+ }
+
+ void timeout(int timeout) {
+ this.connectTimeout = timeout
+ this.socketTimeout = timeout
+ this.connectionRequestTimeout = timeout
+ }
+
@Override
void run() {
String responseText = null
Throwable ex = null
long startTime = System.currentTimeMillis()
def isHttpStream = headers.containsKey("version")
+ def httpType = enableTLS ? "https" : "http"
try {
def uri = ""
if (isHttpStream) {
- uri = "http://${address.hostString}:${address.port}/api/_http_stream"
+ uri = "${httpType}://${address.hostString}:${address.port}/api/_http_stream"
} else if (twoPhaseCommit) {
- uri = "http://${address.hostString}:${address.port}/api/${db}/_stream_load_2pc"
+ uri = "${httpType}://${address.hostString}:${address.port}/api/${db}/_stream_load_2pc"
} else {
- uri = "http://${address.hostString}:${address.port}/api/${db}/${table}/_stream_load"
+ uri = "${httpType}://${address.hostString}:${address.port}/api/${db}/${table}/_stream_load"
}
- def client
- if (enableUtf8Encoding) {
- // set UTF-8
- def connConfig = ConnectionConfig.custom()
- .setCharset(StandardCharsets.UTF_8)
- .setMalformedInputAction(CodingErrorAction.REPLACE)
- .setUnmappableInputAction(CodingErrorAction.REPLACE)
- .build()
- def cm = new PoolingHttpClientConnectionManager()
- cm.setDefaultConnectionConfig(connConfig)
- client = HttpClients.custom().setConnectionManager(cm).build()
- log.info("Stream load using UTF-8 encoding for headers")
- } else {
- // default:ISO-8859-1
- client = HttpClients.createDefault()
- }
- client.withCloseable { httpClient ->
+
+ buildHttpClient().withCloseable { client ->
RequestBuilder requestBuilder = prepareRequestHeader(RequestBuilder.put(uri))
- HttpEntity httpEntity = prepareHttpEntity(httpClient)
+ HttpEntity httpEntity = prepareHttpEntity(client)
if (!directToBe) {
- String beLocation = streamLoadToFe(httpClient, requestBuilder)
+ String beLocation = streamLoadToFe(client, requestBuilder)
log.info("Redirect stream load to ${beLocation}".toString())
requestBuilder.setUri(beLocation)
}
requestBuilder.setEntity(httpEntity)
- responseText = streamLoadToBe(httpClient, requestBuilder)
+ responseText = streamLoadToBe(client, requestBuilder)
}
} catch (Throwable t) {
ex = t
}
+ long endTime = System.currentTimeMillis()
+
+ log.info("Stream load elapsed ${endTime - startTime} ms, is http stream: ${isHttpStream}, " +
+ " response: ${responseText}" + ex.toString())
checkResult(isHttpStream, responseText, ex, startTime, System.currentTimeMillis())
}
+ private CloseableHttpClient buildHttpClient() {
+ // Build request config if any timeout is configured
+ def requestConfig = null
+ if (connectTimeout > 0 || socketTimeout > 0 || connectionRequestTimeout > 0) {
+ def builder = org.apache.http.client.config.RequestConfig.custom()
+ if (connectTimeout > 0) {
+ builder.setConnectTimeout(connectTimeout)
+ }
+ if (socketTimeout > 0) {
+ builder.setSocketTimeout(socketTimeout)
+ }
+ if (connectionRequestTimeout > 0) {
+ builder.setConnectionRequestTimeout(connectionRequestTimeout)
+ }
+ requestConfig = builder.build()
+ }
+
+ def cm = null
+ if (enableUtf8Encoding) {
+ // set UTF-8
+ def connConfig = ConnectionConfig.custom()
+ .setCharset(StandardCharsets.UTF_8)
+ .setMalformedInputAction(CodingErrorAction.REPLACE)
+ .setUnmappableInputAction(CodingErrorAction.REPLACE)
+ .build()
+ cm = new PoolingHttpClientConnectionManager()
+ cm.setDefaultConnectionConfig(connConfig)
+ log.info("Stream load using UTF-8 encoding for headers")
+ }
+
+ if (!enableTLS) {
+ if (cm == null && requestConfig == null) {
+ return HttpClients.createDefault();
+ }
+ HttpClientBuilder builder = HttpClients.custom();
+ if (cm != null) {
+ builder.setConnectionManager(cm);
+ }
+ if (requestConfig != null) {
+ builder.setDefaultRequestConfig(requestConfig);
+ }
+ return builder.build();
+ }
+
+ KeyStore ts = null
+ KeyStore ks = null
+ if (tlsVerifyMode == 'none') {
+ ts = [ [ checkClientTrusted: { c, a -> },
+ checkServerTrusted: { c, a -> },
+ getAcceptedIssuers: { [] as X509Certificate[] } ] as X509TrustManager ] as TrustManager[]
+ } else {
+ // 载入客户端 keystore(含私钥+客户端证书链)
+ ts = KeyStore.getInstance(trustStoreType)
+ ts.load(new FileInputStream(trustStorePath), trustStorePassword?.toCharArray())
+ if (tlsVerifyMode == 'strict') {
+ // 载入 truststore(含 CA/中间证书,用于校验服务端证书链)
+ ks = KeyStore.getInstance(keyStoreType)
+ ks.load(new FileInputStream(keyStorePath), keyStorePassword?.toCharArray())
+ }
+ }
+
+ SSLContext sslContext = SSLContexts.custom()
+ .loadKeyMaterial(ks, keyStorePassword?.toCharArray())
+ .loadTrustMaterial(ts, null)
+ .build()
+
+ HostnameVerifier verifier = sslHostnameVerify ? SSLConnectionSocketFactory.getDefaultHostnameVerifier()
+ : NoopHostnameVerifier.INSTANCE
+
+ SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
+ sslContext,
+ new String[] {"TLSv1.2", "TLSv1.3"},
+ null,
+ verifier
+ )
+
+ def clientBuilder = HttpClients.custom().setSSLSocketFactory(sslsf)
+ if (requestConfig != null) {
+ clientBuilder.setDefaultRequestConfig(requestConfig)
+ }
+ return clientBuilder.build()
+ }
+
private String httpGetString(CloseableHttpClient client, String url) {
return client.execute(RequestBuilder.get(url).build()).withCloseable { resp ->
EntityUtils.toString(resp.getEntity())
diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
index d94e25e5caf..d1d3fa5cbb6 100644
--- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
+++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
@@ -1714,8 +1714,17 @@ class Suite implements GroovyInterceptable {
// e.g: jdbc:mysql://locahost:8080
sql_port = urlWithoutSchema.substring(urlWithoutSchema.indexOf(":") + 1)
}
+ String tlsUrl = ""
// set server side prepared statement url
- return "jdbc:mysql://" + sql_ip + ":" + sql_port + "/" + database + "?&useServerPrepStmts=true"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ String useSslconfig = "useSSL=true&requireSSL=true&verifyServerCertificate=true"
+ String clientCAKey = "clientCertificateKeyStoreUrl=file:" + context.config.otherConfigs.get("keyStorePath")
+ String clientCAPwd = "clientCertificateKeyStorePassword=" + context.config.otherConfigs.get("keyStorePassword")
+ String trustCAKey = "trustCertificateKeyStoreUrl=file:" + context.config.otherConfigs.get("trustStorePath")
+ String trustCAPwd = "trustCertificateKeyStorePassword=" + context.config.otherConfigs.get("trustStorePassword")
+ tlsUrl = "&" + useSslconfig + "&" + clientCAKey + "&" + clientCAPwd + "&" + trustCAKey + "&" + trustCAPwd
+ }
+ return "jdbc:mysql://" + sql_ip + ":" + sql_port + "/" + database + "?&useServerPrepStmts=true" + tlsUrl
}
DebugPoint GetDebugPoint() {
@@ -3148,6 +3157,9 @@ class Suite implements GroovyInterceptable {
logger.info("tablet: $tablet_info")
def compact_url = tablet_info.get("CompactionStatus")
String command = "curl ${compact_url}"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
Process process = command.execute()
def code = process.waitFor()
def err = IOGroovyMethods.getText(new BufferedReader(new InputStreamReader(process.getErrorStream())));
diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SuiteContext.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SuiteContext.groovy
index b303d1fbcd6..f511e402b8f 100644
--- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SuiteContext.groovy
+++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SuiteContext.groovy
@@ -335,6 +335,25 @@ class SuiteContext implements Closeable {
public <T> T connect(String user, String password, String url, Closure<T> actionSupplier) {
def originConnection = threadLocalConn.get()
+ if ((config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ String useSslconfig = "useSSL=true&requireSSL=true&verifyServerCertificate=true"
+ String clientCAKey = "clientCertificateKeyStoreUrl=file:" + config.otherConfigs.get("keyStorePath")
+ String clientCAPwd = "clientCertificateKeyStorePassword=" + config.otherConfigs.get("keyStorePassword")
+ String trustCAKey = "trustCertificateKeyStoreUrl=file:" + config.otherConfigs.get("trustStorePath")
+ String trustCAPwd = "trustCertificateKeyStorePassword=" + config.otherConfigs.get("trustStorePassword")
+ String tlsUrl = useSslconfig + "&" + clientCAKey + "&" + clientCAPwd + "&" + trustCAKey + "&" + trustCAPwd
+ if (!url.contains("clientCertificateKeyStoreUrl")){
+ if (url.charAt(url.length() - 1) == '?') {
+ return url + tlsUrl
+ // e.g: jdbc:mysql://locahost:8080/dbname?a=b
+ } else if (url.contains('?')) {
+ return url + '&' + tlsUrl
+ // e.g: jdbc:mysql://locahost:8080/dbname
+ } else {
+ return url + '?' + tlsUrl
+ }
+ }
+ }
try {
log.info("Create new connection for user '${user}' to '${url}'")
return DriverManager.getConnection(url, user, password).withCloseable { newConn ->
diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/Http.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/Http.groovy
index e8535cae917..8ee33b5ecba 100644
--- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/Http.groovy
+++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/Http.groovy
@@ -34,11 +34,74 @@ import groovy.util.logging.Slf4j
import java.nio.charset.Charset
+import javax.net.ssl.*
+import java.security.KeyStore
+import java.security.SecureRandom
+import java.security.cert.X509Certificate
+
+import org.apache.doris.regression.suite.SuiteContext
+
@Slf4j
class Http {
final static Logger logger = LoggerFactory.getLogger(this.class)
+ static Boolean enableTls = false
+ static String tlsVerifyMode = "strict"
+ static String trustStorePath = null
+ static String trustStorePassword = null
+ static String trustStoreType = null
+ static String keyStorePath = null
+ static String keyStorePassword = null
+ static String keyStoreType = null
+
+ static void configure(Boolean enableTLS=false, String mode = "strict",
+ String caPath = null, String caPassword = null, String caStoreType = null,
+ String keyPath = null, String keyPassword = null, String keystoreType = null) {
+ enableTls = enableTLS
+ tlsVerifyMode = mode
+ trustStorePath = caPath
+ trustStorePassword = caPassword
+ trustStoreType = caStoreType
+ keyStorePath = keyPath
+ keyStorePassword = keyPassword
+ keyStoreType = keystoreType
+ initSSLContext()
+ }
+
+ private static void initSSLContext() {
+ SSLContext sslContext = SSLContext.getInstance("TLS")
+ def trustManagers = null
+ def keyManagers = null
+ if (tlsVerifyMode == "none") {
+ // 跳过证书校验
+ trustManagers = [ [ checkClientTrusted: { c, a -> },
+ checkServerTrusted: { c, a -> },
+ getAcceptedIssuers: { [] as X509Certificate[] } ] as X509TrustManager ] as TrustManager[]
+ } else {
+ def trustStore = KeyStore.getInstance(trustStoreType)
+ trustStore.load(new FileInputStream(trustStorePath), trustStorePassword.toCharArray())
+ def tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm())
+ tmf.init(trustStore)
+ trustManagers = tmf.trustManagers
+
+ if(tlsVerifyMode == "strict" && keyStorePath) {
+ def keyStore = KeyStore.getInstance(keyStoreType)
+ keyStore.load(new FileInputStream(keyStorePath), keyStorePassword.toCharArray())
+ def kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm())
+ kmf.init(keyStore, keyStorePassword.toCharArray())
+ keyManagers = kmf.keyManagers
+ }
+ }
+ sslContext.init(keyManagers, trustManagers, new SecureRandom())
+ HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.socketFactory)
+
+ if (tlsVerifyMode == 'none') {
+ // 关闭 Hostname 验证
+ HttpsURLConnection.setDefaultHostnameVerifier({ hostname, session -> true })
+ }
+ }
+
static void checkHttpResult(Object result, NodeType type) {
if (type == NodeType.FE) {
assert result.code == 0 : result.toString()
@@ -48,6 +111,9 @@ class Http {
}
static Object GET(url, isJson = false, printText = true) {
+ if (enableTls) {
+ url = url.replace("http://", "https://")
+ }
def conn = new URL(url).openConnection()
conn.setRequestMethod('GET')
conn.setRequestProperty('Authorization', 'Basic cm9vdDo=') //token for root
@@ -69,6 +135,9 @@ class Http {
}
static Object POST(url, data = null, isJson = false) {
+ if (enableTls) {
+ url = url.replace("http://", "https://")
+ }
def conn = new URL(url).openConnection()
conn.setRequestMethod('POST')
conn.setRequestProperty('Authorization', 'Basic cm9vdDo=') //token for root
@@ -104,6 +173,9 @@ class Http {
BufferedWriter out = null
BufferedReader inB = null
try {
+ if (enableTls) {
+ url = url.replace("http://", "https://")
+ }
conn = (HttpURLConnection) (new URL(url.replaceAll('/','/'))).openConnection()
conn.setRequestMethod('POST')
conn.setDoOutput(true)
@@ -138,6 +210,9 @@ class Http {
BufferedReader inB = null
StringBuilder result = new StringBuilder('')
try {
+ if (enableTls) {
+ url = url.replace("http://", "https://")
+ }
URL realUrl = new URL(url)
URLConnection conn = realUrl.openConnection()
conn.setRequestProperty('Content-Type', 'application/json;charset=UTF-8')
@@ -167,6 +242,9 @@ class Http {
CloseableHttpClient httpClient = null
CloseableHttpResponse response = null
try {
+ if (enableTls) {
+ url = url.replace("http://", "https://")
+ }
httpClient = HttpClients.createDefault()
HttpPost httppost = new HttpPost(url)
httppost.setHeader('Content-Type', 'application/json;charset=UTF-8')
diff --git a/regression-test/plugins/cloud_compaction_plugin.groovy b/regression-test/plugins/cloud_compaction_plugin.groovy
index 8381fd28a8e..f1beb0a8e22 100644
--- a/regression-test/plugins/cloud_compaction_plugin.groovy
+++ b/regression-test/plugins/cloud_compaction_plugin.groovy
@@ -52,17 +52,24 @@ Suite.metaClass.doCloudCompaction = { String tableName /* param */ ->
String[][] tablets = sql """ show tablets from ${tableName}; """
def doCompaction = { backend_id, compact_type ->
// trigger compactions for all tablets in ${tableName}
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
for (String[] tablet in tablets) {
Thread.sleep(10)
String tablet_id = tablet[0]
StringBuilder sb = new StringBuilder();
- sb.append("curl -X POST http://")
+ sb.append("curl -X POST ${protocol}://")
sb.append(backendIdToBackendIP.get(backend_id))
sb.append(":")
sb.append(backendIdToBackendHttpPort.get(backend_id))
sb.append("/api/compaction/run?tablet_id=")
sb.append(tablet_id)
sb.append("&compact_type=${compact_type}")
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
process = command.execute()
@@ -82,12 +89,17 @@ Suite.metaClass.doCloudCompaction = { String tableName /* param */ ->
Thread.sleep(1000)
String tablet_id = tablet[0]
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://")
+ sb.append("curl -X GET ${protocol}://")
sb.append(backendIdToBackendIP.get(backend_id))
sb.append(":")
sb.append(backendIdToBackendHttpPort.get(backend_id))
sb.append("/api/compaction/run_status?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/plugins/cloud_show_data_plugin.groovy b/regression-test/plugins/cloud_show_data_plugin.groovy
index 25019937ced..2dc810cbc8b 100644
--- a/regression-test/plugins/cloud_show_data_plugin.groovy
+++ b/regression-test/plugins/cloud_show_data_plugin.groovy
@@ -80,6 +80,9 @@ import org.codehaus.groovy.runtime.IOGroovyMethods
sb.append(tablet["CompactionStatus"])
String command = sb.toString()
logger.info(command)
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def process = command.execute()
def code = process.waitFor()
def err = IOGroovyMethods.getText(new BufferedReader(new InputStreamReader(process.getErrorStream())));
diff --git a/regression-test/plugins/plugin_curl_requester.groovy b/regression-test/plugins/plugin_curl_requester.groovy
index c1aece2db60..a0a813fb800 100644
--- a/regression-test/plugins/plugin_curl_requester.groovy
+++ b/regression-test/plugins/plugin_curl_requester.groovy
@@ -25,8 +25,19 @@ import org.apache.http.util.EntityUtils
import org.apache.http.client.config.RequestConfig
import org.apache.http.conn.ConnectTimeoutException
import org.apache.http.conn.HttpHostConnectException
+import org.apache.http.impl.client.CloseableHttpClient
+import org.apache.http.impl.client.HttpClients
+import org.apache.http.ssl.SSLContextBuilder
import org.codehaus.groovy.runtime.IOGroovyMethods
+import java.security.KeyStore
+import java.security.cert.CertificateFactory
+import java.security.cert.X509Certificate
+import java.security.PrivateKey
+import java.security.spec.PKCS8EncodedKeySpec
+import java.security.KeyFactory
+import java.util.Base64
+import javax.net.ssl.SSLContext
Suite.metaClass.http_client = { String method, String url /* param */ ->
Suite suite = delegate as Suite
@@ -44,9 +55,32 @@ Suite.metaClass.http_client = { String method, String url /* param */ ->
logger.info("HTTP request: ${method} ${url}")
- CloseableHttpClient httpClient = HttpClients.custom()
- .setRetryHandler(new DefaultHttpRequestRetryHandler(3, true))
- .build()
+ CloseableHttpClient httpClient
+ if ((suite.context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false ) {
+ url = url.replace("http://", "https://")
+ //如果url没有https开头,那加上
+ if (!url.toLowerCase().startsWith("https://")) {
+ url="https://${url}"
+ }
+ KeyStore ks = KeyStore.getInstance(suite.context.config.otherConfigs.get("keyStoreType"))
+ ks.load(new FileInputStream(suite.context.config.otherConfigs.get("keyStorePath")?.toString()),
+ context.config.otherConfigs.get("keyStorePassword")?.toCharArray())
+ KeyStore ts = KeyStore.getInstance(suite.context.config.otherConfigs.get("trustStoreType"))
+ ts.load(new FileInputStream(suite.context.config.otherConfigs.get("trustStorePath")?.toString()),
+ suite.context.config.otherConfigs.get("trustStorePassword")?.toCharArray())
+ SSLContext sslContext = SSLContextBuilder.create()
+ .loadKeyMaterial(ks, suite.context.config.otherConfigs.get("keyStorePassword")?.toCharArray())
+ .loadTrustMaterial(ts, null)
+ .build()
+ httpClient = HttpClients.custom()
+ .setRetryHandler(new DefaultHttpRequestRetryHandler(3, true))
+ .setSSLContext(sslContext)
+ .build()
+ } else {
+ httpClient = HttpClients.custom()
+ .setRetryHandler(new DefaultHttpRequestRetryHandler(3, true))
+ .build()
+ }
int code
String err
@@ -130,12 +164,20 @@ Suite.metaClass.curl = { String method, String url, String body = null, Integer
auth = String.format("-u%s:%s", user, pwd).toString();
}
String cmd
+ if (!url.toLowerCase().startsWith("http://") && !url.toLowerCase().startsWith("https://")) {
+ url="http://${url}"
+ }
if (method == "POST" && body != null) {
cmd = String.format("curl %s --max-time %d -X %s -H Content-Type:application/json -d %s %s", auth, timeoutSec, method, body, url).toString()
} else {
cmd = String.format("curl %s --max-time %d -X %s %s", auth, timeoutSec, method, url).toString()
}
-
+ if ((suite.context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ if (!cmd.contains("https")){
+ cmd = cmd.replace("http://", "https://")
+ }
+ cmd += String.format(" --cert %s --key %s --cacert %s", suite.context.config.otherConfigs.get("trustCert"), suite.context.config.otherConfigs.get("trustCAKey"), suite.context.config.otherConfigs.get("trustCACert"))
+ }
logger.info("curl cmd: " + cmd)
def process
int code
@@ -175,24 +217,36 @@ Suite.metaClass.curl = { String method, String url, String body = null, Integer
logger.info("Added 'curl' function to Suite")
Suite.metaClass.show_be_config = { String ip, String port /*param */ ->
+ Suite suite = delegate as Suite
+ if ((suite.context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false ) {
+ return curl("GET", String.format("https://%s:%s/api/show_config", ip, port))
+ }
return curl("GET", String.format("http://%s:%s/api/show_config", ip, port))
}
logger.info("Added 'show_be_config' function to Suite")
Suite.metaClass.update_be_config = { String ip, String port, String key, String value /*param */ ->
+ Suite suite = delegate as Suite
+ if ((suite.context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false ) {
+ return curl("POST", String.format("https://%s:%s/api/update_config?%s=%s", ip, port, key, value))
+ }
return curl("POST", String.format("http://%s:%s/api/update_config?%s=%s", ip, port, key, value))
}
logger.info("Added 'update_be_config' function to Suite")
Suite.metaClass.update_all_be_config = { String key, Object value ->
+ Suite suite = delegate as Suite
def backendId_to_backendIP = [:]
def backendId_to_backendHttpPort = [:]
getBackendIpHttpPort(backendId_to_backendIP, backendId_to_backendHttpPort);
backendId_to_backendIP.each { beId, beIp ->
def port = backendId_to_backendHttpPort.get(beId)
def url = "http://${beIp}:${port}/api/update_config?${key}=${value}"
+ if ((suite.context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false ) {
+ url = "https://${beIp}:${port}/api/update_config?${key}=${value}"
+ }
def result = Http.POST(url, null, true)
assert result.size() == 1, result.toString()
assert result[0].status == "OK", result.toString()
@@ -202,7 +256,11 @@ Suite.metaClass.update_all_be_config = { String key, Object value ->
logger.info("Added 'update_all_be_config' function to Suite")
Suite.metaClass._be_report = { String ip, int port, String reportName ->
+ Suite suite = delegate as Suite
def url = "http://${ip}:${port}/api/report/${reportName}"
+ if ((suite.context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false ) {
+ url = "https://${ip}:${port}/api/report/${reportName}"
+ }
def result = Http.GET(url, true)
Http.checkHttpResult(result, NodeType.BE)
}
diff --git a/regression-test/plugins/plugin_query_timeout_debugger.groovy b/regression-test/plugins/plugin_query_timeout_debugger.groovy
index 743582419ee..f71ae41a5f1 100644
--- a/regression-test/plugins/plugin_query_timeout_debugger.groovy
+++ b/regression-test/plugins/plugin_query_timeout_debugger.groovy
@@ -23,6 +23,19 @@ import org.apache.doris.regression.suite.Suite
import org.apache.doris.regression.util.JdbcUtils
import org.slf4j.Logger
+import org.apache.http.impl.client.CloseableHttpClient
+import org.apache.http.impl.client.HttpClients
+import org.apache.http.ssl.SSLContextBuilder
+
+import org.apache.http.conn.ssl.NoopHostnameVerifier
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory
+
+import javax.net.ssl.*
+import java.security.KeyStore
+import java.io.FileInputStream
+import java.util.Scanner
+import org.apache.http.ssl.SSLContexts
+
// make sure PluginQueryTimeoutDebugger quit gracefully
class PluginQueryTimeoutDebuggerHolder {
static final PluginQueryTimeoutDebugger staticResource = new PluginQueryTimeoutDebugger()
@@ -40,6 +53,14 @@ PluginQueryTimeoutDebugger.jdbcPassword = context.config.jdbcPassword
PluginQueryTimeoutDebugger.skip = !context.config.excludeDockerTest
PluginQueryTimeoutDebugger.logger = logger
PluginQueryTimeoutDebuggerHolder.staticResource.startWorker()
+PluginQueryTimeoutDebugger.enableTLS = context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true") ?: false
+PluginQueryTimeoutDebugger.tlsVerifyMode = context.config.otherConfigs.get("tlsVerifyMode")?.toString()?.toLowerCase() ?: "none"
+PluginQueryTimeoutDebugger.trustStorePath = context.config.otherConfigs.get("trustStorePath")?.toString()
+PluginQueryTimeoutDebugger.trustStorePassword = context.config.otherConfigs.get("trustStorePassword")?.toString() ?: ""
+PluginQueryTimeoutDebugger.trustStoreType = context.config.otherConfigs.get("trustStoreType")?.toString() ?: 'PKCS12'
+PluginQueryTimeoutDebugger.keyStorePath = context.config.otherConfigs.get("keyStorePath")?.toString()
+PluginQueryTimeoutDebugger.keyStorePassword = context.config.otherConfigs.get("keyStorePassword")?.toString() ?: ""
+PluginQueryTimeoutDebugger.keyStoreType = context.config.otherConfigs.get("keyStoreType")?.toString() ?: 'PKCS12'
/**
* print pipeline tasks every 1 minutes to help debugging query timeout.
@@ -55,7 +76,17 @@ class PluginQueryTimeoutDebugger {
static public String jdbcUser
static public String jdbcPassword
static public Logger logger
+
static public Boolean skip
+
+ static public Boolean enableTLS
+ static public String tlsVerifyMode
+ static public String trustStorePath
+ static public String trustStorePassword
+ static public String trustStoreType
+ static public String keyStorePath
+ static public String keyStorePassword
+ static public String keyStoreType
private ScheduledExecutorService scheduler
private List<String> backendUrls = []
@@ -142,20 +173,72 @@ class PluginQueryTimeoutDebugger {
String curl(String urlStr) {
HttpURLConnection connection = null
+
try {
- URL url = new URL(urlStr)
- connection = url.openConnection() as HttpURLConnection
- connection.requestMethod = "GET"
- connection.connectTimeout = HTTP_TIMEOUT
- connection.readTimeout = HTTP_TIMEOUT
-
- if (connection.responseCode == 200) {
- return connection.inputStream.text
+ if (enableTLS) {
+ if (urlStr.startsWith("http://")) {
+ urlStr = urlStr.replace("http://", "https://")
+ }
+
+ def sslContextBuilder = SSLContext.getInstance("TLSv1.2")
+
+ KeyManager[] keyManagers = null
+ TrustManager[] trustManagers = null
+
+ // 客户端证书
+ if (keyStorePath) {
+ KeyStore keyStore = KeyStore.getInstance(keyStoreType)
+ keyStore.load(new FileInputStream(keyStorePath), keyStorePassword.toCharArray())
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm())
+ kmf.init(keyStore, keyStorePassword.toCharArray())
+ keyManagers = kmf.getKeyManagers()
+ }
+
+ // 服务端信任证书
+ if (tlsVerifyMode == "none") {
+ trustManagers = [ [ checkClientTrusted:{ a,b->}, checkServerTrusted:{ a,b->}, getAcceptedIssuers:{ [] as java.security.cert.X509Certificate[] } ] as X509TrustManager ]
+ } else if (trustStorePath) {
+ KeyStore trustStore = KeyStore.getInstance(trustStoreType)
+ trustStore.load(new FileInputStream(trustStorePath), trustStorePassword.toCharArray())
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm())
+ tmf.init(trustStore)
+ trustManagers = tmf.getTrustManagers()
+ }
+
+ sslContextBuilder.init(keyManagers, trustManagers, new java.security.SecureRandom())
+ SSLContext sslContext = sslContextBuilder
+
+ def sslSocketFactory = sslContext.getSocketFactory()
+ connection = (HttpsURLConnection) new URL(urlStr).openConnection()
+ connection.setSSLSocketFactory(sslSocketFactory)
+
+ // 如果 tlsVerifyMode == none,跳过主机名验证
+ if (tlsVerifyMode == "none") {
+ (connection as HttpsURLConnection).setHostnameVerifier({ h, s -> true } as HostnameVerifier)
+ }
} else {
- throw new Exception("curl ${urlStr} failed, code: ${connection.responseCode}")
+ connection = (HttpURLConnection) new URL(urlStr).openConnection()
}
+
+ connection.setRequestMethod("GET")
+ connection.setConnectTimeout(10000)
+ connection.setReadTimeout(30000)
+
+ int responseCode = connection.getResponseCode()
+ boolean success = (200..<300).contains(responseCode)
+
+ def stream = success ? connection.getInputStream() : connection.getErrorStream()
+ def responseBody = stream ? new Scanner(stream).useDelimiter("\\A").next() : ""
+ int exitcode = success ? 0 : -1
+ def err = success ? "" : "HTTP ${responseCode}"
+
+ return [exitcode, responseBody, err]
+
+ } catch (Exception e) {
+ logger.error("mycurl TLS request failed: ${e.message}", e)
+ return [-1, "", e.message]
} finally {
connection?.disconnect()
}
}
-}
+}
\ No newline at end of file
diff --git a/regression-test/suites/auth_call/test_dml_stream_load_auth.groovy b/regression-test/suites/auth_call/test_dml_stream_load_auth.groovy
index ba075682389..6c8eb9f57bb 100644
--- a/regression-test/suites/auth_call/test_dml_stream_load_auth.groovy
+++ b/regression-test/suites/auth_call/test_dml_stream_load_auth.groovy
@@ -58,7 +58,13 @@ suite("test_dml_stream_load_auth","p0,auth_call") {
def path_file = "${context.file.parent}/../../data/auth_call/stream_load_data.csv"
def load_path = "${context.file.parent}/../../data/auth_call/stream_load_cm.sh"
- def cm = """curl -v --location-trusted -u ${user}:${pwd} -H "column_separator:," -T ${path_file} http://${sql_ip}:${http_port}/api/${dbName}/${tableName}/_stream_load"""
+ def tlsInfo = null
+ def protocol = "http"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ tlsInfo = " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ protocol = "https"
+ }
+ def cm = """curl --location-trusted -u ${user}:${pwd} -H "column_separator:," -T ${path_file} ${protocol}://${sql_ip}:${http_port}/api/${dbName}/${tableName}/_stream_load ${tlsInfo}"""
logger.info("cm: " + cm)
write_to_file(load_path, cm)
cm = "bash " + load_path
diff --git a/regression-test/suites/bloom_filter_p0/test_bloom_filter_hit_with_renamed_column.groovy b/regression-test/suites/bloom_filter_p0/test_bloom_filter_hit_with_renamed_column.groovy
index 831af590660..b951bd1aa7d 100644
--- a/regression-test/suites/bloom_filter_p0/test_bloom_filter_hit_with_renamed_column.groovy
+++ b/regression-test/suites/bloom_filter_p0/test_bloom_filter_hit_with_renamed_column.groovy
@@ -16,6 +16,7 @@
// under the License.
import groovy.json.JsonSlurper
+import org.apache.doris.regression.action.ProfileAction
suite("test_bloom_filter_hit_with_renamed_column") {
def tableName = "test_bloom_filter_hit_with_renamed_column"
@@ -80,32 +81,6 @@ suite("test_bloom_filter_hit_with_renamed_column") {
}
}
- def httpGet = { url ->
- def dst = 'http://' + context.config.feHttpAddress
- def conn = new URL(dst + url).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}")
- conn.setRequestProperty("Cache-Control", "no-cache")
- conn.setRequestProperty("Pragma", "no-cache")
- conn.setConnectTimeout(10000) // 10 seconds
- conn.setReadTimeout(10000) // 10 seconds
-
- int responseCode = conn.getResponseCode()
- log.info("HTTP response status: " + responseCode)
-
- if (responseCode == 200) {
- InputStream inputStream = conn.getInputStream()
- String response = inputStream.text
- inputStream.close()
- return response
- } else {
- log.error("HTTP request failed with response code: " + responseCode)
- return null
- }
- }
-
// rename column with bloom filter
sql """ ALTER TABLE ${tableName} RENAME COLUMN C_COMMENT C_COMMENT_NEW; """
wait_for_latest_op_on_table_finish(tableName, timeout)
@@ -117,34 +92,33 @@ suite("test_bloom_filter_hit_with_renamed_column") {
//sql """ select C_COMMENT_NEW from ${tableName} where C_COMMENT_NEW='OK' """
// get and check profile with retry logic
- def getProfileIdWithRetry = { query, maxRetries, waitSeconds ->
- def profileUrl = '/rest/v1/query_profile/'
+ def getProfileIdWithRetry = { query, maxRetries, waitSeconds, pattern ->
def profiles = null
def profileId = null
+ def profileData = null
int attempt = 0
+ def profileAction = new ProfileAction(context)
while (attempt < maxRetries) {
sql "sync"
sql """ ${query} """
- profiles = httpGet(profileUrl)
- log.info("profiles attempt ${attempt + 1}: {}", profiles)
- if (profiles == null) {
+ profiles = profileAction.getProfileList()
+ if (profiles.size() == 0) {
log.warn("Failed to fetch profiles on attempt ${attempt + 1}")
- } else {
- def jsonProfiles = new JsonSlurper().parseText(profiles)
- if (jsonProfiles.code == 0) {
- for (def profile in jsonProfiles["data"]["rows"]) {
- if (profile["Sql Statement"].contains(query)) {
- profileId = profile["Profile ID"]
- break
- }
- }
- } else {
- log.warn("Profile response code is not 0 on attempt ${attempt + 1}")
+ continue
+ }
+ for (def profile in profiles) {
+ if (profile["Sql Statement"].contains(query)) {
+ profileId = profile["Profile ID"]
+ log.info("profileId:{}", profileId)
+ profileData = profileAction.getProfile(profileId)
+ log.info(profileData)
+ break;
}
}
if (profileId != null) {
+ assertTrue(profileData.contains("${pattern}"))
break
} else {
attempt++
@@ -154,18 +128,13 @@ suite("test_bloom_filter_hit_with_renamed_column") {
}
}
}
-
- assertTrue(profileId != null, "Failed to retrieve profileId after ${maxRetries} attempts")
- return profileId
+ assertTrue(attempt < maxRetries || profileId != null)
}
sql "set profile_level=2;"
def query = """select C_COMMENT_NEW from ${tableName} where C_COMMENT_NEW='OK'"""
- def profileId = getProfileIdWithRetry(query, 3, 30)
- log.info("profileId:{}", profileId)
- def profileDetail = httpGet("/rest/v1/query_profile/" + profileId)
- log.info("profileDetail:{}", profileDetail)
- assertTrue(profileDetail.contains("BloomFilterFiltered: 15.0K (15000)"))
+ def pattern = """BloomFilterFiltered: 15.0K (15000)"""
+ def profileId = getProfileIdWithRetry(query, 3, 30, pattern)
//———————— clean table and disable profile ————————
sql """ SET enable_profile = false """
diff --git a/regression-test/suites/cloud_p0/balance/test_balance_warm_up.groovy b/regression-test/suites/cloud_p0/balance/test_balance_warm_up.groovy
index 37eb309d866..db28efafad8 100644
--- a/regression-test/suites/cloud_p0/balance/test_balance_warm_up.groovy
+++ b/regression-test/suites/cloud_p0/balance/test_balance_warm_up.groovy
@@ -46,6 +46,9 @@ suite('test_balance_warm_up', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/cloud_p0/balance/test_balance_warm_up_use_peer_cache.groovy b/regression-test/suites/cloud_p0/balance/test_balance_warm_up_use_peer_cache.groovy
index e2209931a93..f9202e702ed 100644
--- a/regression-test/suites/cloud_p0/balance/test_balance_warm_up_use_peer_cache.groovy
+++ b/regression-test/suites/cloud_p0/balance/test_balance_warm_up_use_peer_cache.groovy
@@ -55,6 +55,9 @@ suite('test_balance_warm_up_use_peer_cache', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/cloud_p0/balance/test_balance_warm_up_with_compaction_use_peer_cache.groovy b/regression-test/suites/cloud_p0/balance/test_balance_warm_up_with_compaction_use_peer_cache.groovy
index a232a14dea1..be120221019 100644
--- a/regression-test/suites/cloud_p0/balance/test_balance_warm_up_with_compaction_use_peer_cache.groovy
+++ b/regression-test/suites/cloud_p0/balance/test_balance_warm_up_with_compaction_use_peer_cache.groovy
@@ -56,6 +56,9 @@ suite('test_balance_warm_up_with_compaction_use_peer_cache', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/cloud_p0/balance/test_peer_read_async_warmup.groovy b/regression-test/suites/cloud_p0/balance/test_peer_read_async_warmup.groovy
index 8ce71606542..38aa4367878 100644
--- a/regression-test/suites/cloud_p0/balance/test_peer_read_async_warmup.groovy
+++ b/regression-test/suites/cloud_p0/balance/test_peer_read_async_warmup.groovy
@@ -52,6 +52,9 @@ suite('test_peer_read_async_warmup', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/cloud_p0/cache/compaction/test_stale_rowset.groovy b/regression-test/suites/cloud_p0/cache/compaction/test_stale_rowset.groovy
index 2c189126fa7..bc65e78584a 100644
--- a/regression-test/suites/cloud_p0/cache/compaction/test_stale_rowset.groovy
+++ b/regression-test/suites/cloud_p0/cache/compaction/test_stale_rowset.groovy
@@ -52,11 +52,18 @@ suite("test_stale_rowset") {
backend_id = backendId_to_backendIP.keySet()[0]
StringBuilder showConfigCommand = new StringBuilder();
- showConfigCommand.append("curl -X GET http://")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ showConfigCommand.append("curl -X GET ${protocol}://")
showConfigCommand.append(backendId_to_backendIP.get(backend_id))
showConfigCommand.append(":")
showConfigCommand.append(backendId_to_backendHttpPort.get(backend_id))
showConfigCommand.append("/api/show_config")
+ if (enableTls) {
+ showConfigCommand.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ showConfigCommand.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ showConfigCommand.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
logger.info(showConfigCommand.toString())
def process = showConfigCommand.toString().execute()
int code = process.waitFor()
diff --git a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_immediate_warmup_basic.groovy b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_immediate_warmup_basic.groovy
index 7bbe3f01895..319f9f557ec 100644
--- a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_immediate_warmup_basic.groovy
+++ b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_immediate_warmup_basic.groovy
@@ -70,6 +70,9 @@ suite('test_immediate_warmup_basic', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_immediate_warmup_multi_segments.groovy b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_immediate_warmup_multi_segments.groovy
index fc1416984d2..3fe09c7e882 100644
--- a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_immediate_warmup_multi_segments.groovy
+++ b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_immediate_warmup_multi_segments.groovy
@@ -76,6 +76,9 @@ suite('test_immediate_warmup_multi_segments', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
@@ -114,9 +117,16 @@ suite('test_immediate_warmup_multi_segments', 'docker') {
def ip = be[1]
def port = be[4]
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${ip}:${port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${ip}:${port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event.groovy b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event.groovy
index 60ae1819395..7ccda1ec126 100644
--- a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event.groovy
+++ b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event.groovy
@@ -56,6 +56,9 @@ suite('test_warm_up_cluster_event', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_add_new_be.groovy b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_add_new_be.groovy
index 3bb78723b23..69a8f7797ec 100644
--- a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_add_new_be.groovy
+++ b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_add_new_be.groovy
@@ -56,6 +56,9 @@ suite('test_warm_up_cluster_event_add_new_be', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_cancel_active.groovy b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_cancel_active.groovy
index 65ef46be4c8..c16fb623ba9 100644
--- a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_cancel_active.groovy
+++ b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_cancel_active.groovy
@@ -56,6 +56,9 @@ suite('test_warm_up_cluster_event_cancel_active', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_cancel_passive.groovy b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_cancel_passive.groovy
index e4def0b7d30..02c405e5274 100644
--- a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_cancel_passive.groovy
+++ b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_cancel_passive.groovy
@@ -92,6 +92,9 @@ suite('test_warm_up_cluster_event_cancel_passive', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_compaction.groovy b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_compaction.groovy
index 697bffeabfa..3137381abb4 100644
--- a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_compaction.groovy
+++ b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_compaction.groovy
@@ -57,6 +57,9 @@ suite('test_warm_up_cluster_event_compaction', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_compaction_sync_wait.groovy b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_compaction_sync_wait.groovy
index 4879f83aab8..35266cf402f 100644
--- a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_compaction_sync_wait.groovy
+++ b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_compaction_sync_wait.groovy
@@ -63,6 +63,9 @@ suite('test_warm_up_cluster_event_compaction_sync_wait', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
@@ -177,9 +180,16 @@ suite('test_warm_up_cluster_event_compaction_sync_wait', 'docker') {
def getTabletStatus = { ip, port, tablet_id ->
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${ip}:${port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${ip}:${port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_compaction_sync_wait_timeout.groovy b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_compaction_sync_wait_timeout.groovy
index 64b72dfcec5..8a096603120 100644
--- a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_compaction_sync_wait_timeout.groovy
+++ b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_compaction_sync_wait_timeout.groovy
@@ -63,6 +63,9 @@ suite('test_warm_up_cluster_event_compaction_sync_wait_timeout', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
@@ -177,9 +180,16 @@ suite('test_warm_up_cluster_event_compaction_sync_wait_timeout', 'docker') {
def getTabletStatus = { ip, port, tablet_id ->
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${ip}:${port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${ip}:${port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_rename.groovy b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_rename.groovy
index 857eac205f2..de6e3776747 100644
--- a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_rename.groovy
+++ b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_rename.groovy
@@ -57,6 +57,9 @@ suite('test_warm_up_cluster_event_rename', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_restart_all_be.groovy b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_restart_all_be.groovy
index 1e2178af1fb..ee06d7b3d9b 100644
--- a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_restart_all_be.groovy
+++ b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_restart_all_be.groovy
@@ -56,6 +56,9 @@ suite('test_warm_up_cluster_event_restart_all_be', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_restart_master_fe.groovy b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_restart_master_fe.groovy
index f96c0f0b413..a7401f2aab3 100644
--- a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_restart_master_fe.groovy
+++ b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_restart_master_fe.groovy
@@ -57,6 +57,9 @@ suite('test_warm_up_cluster_event_restart_master_fe', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_schema_change.groovy b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_schema_change.groovy
index a4df5e38696..13a5435b104 100644
--- a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_schema_change.groovy
+++ b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_event_schema_change.groovy
@@ -57,6 +57,9 @@ suite('test_warm_up_cluster_event_schema_change', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic.groovy b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic.groovy
index cc6609081b7..0b1f25c76ae 100644
--- a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic.groovy
+++ b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic.groovy
@@ -57,6 +57,9 @@ suite('test_warm_up_cluster_periodic', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic_add_new_be.groovy b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic_add_new_be.groovy
index 764327c72bf..fa476e80ba6 100644
--- a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic_add_new_be.groovy
+++ b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic_add_new_be.groovy
@@ -58,6 +58,9 @@ suite('test_warm_up_cluster_periodic_add_new_be', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic_and_event.groovy b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic_and_event.groovy
index 156c3e1697a..d3f4ac6b694 100644
--- a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic_and_event.groovy
+++ b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic_and_event.groovy
@@ -57,6 +57,9 @@ suite('test_warm_up_cluster_periodic_and_event', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic_rename.groovy b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic_rename.groovy
index 53f65605a43..6691a9a3d08 100644
--- a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic_rename.groovy
+++ b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic_rename.groovy
@@ -57,6 +57,9 @@ suite('test_warm_up_cluster_periodic_rename', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic_restart_master_fe.groovy b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic_restart_master_fe.groovy
index d7f49d3fc82..9d40d4efe8b 100644
--- a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic_restart_master_fe.groovy
+++ b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic_restart_master_fe.groovy
@@ -58,6 +58,9 @@ suite('test_warm_up_cluster_periodic_restart_master_fe', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic_slow_job.groovy b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic_slow_job.groovy
index 5e64dddbbe0..c26c6539d6f 100644
--- a/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic_slow_job.groovy
+++ b/regression-test/suites/cloud_p0/cache/multi_cluster/warm_up/cluster/test_warm_up_cluster_periodic_slow_job.groovy
@@ -122,6 +122,9 @@ suite('test_warm_up_cluster_periodic_slow_job', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/cloud_p0/multi_cluster/test_mow_agg_delete_bitmap.groovy b/regression-test/suites/cloud_p0/multi_cluster/test_mow_agg_delete_bitmap.groovy
index 9c2063d6ec1..57396d17088 100644
--- a/regression-test/suites/cloud_p0/multi_cluster/test_mow_agg_delete_bitmap.groovy
+++ b/regression-test/suites/cloud_p0/multi_cluster/test_mow_agg_delete_bitmap.groovy
@@ -65,9 +65,16 @@ suite('test_mow_agg_delete_bitmap', 'multi_cluster,docker') {
def be_host = backendId_to_backendIP[trigger_backend_id]
def be_http_port = backendId_to_backendHttpPort[trigger_backend_id]
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
@@ -89,9 +96,16 @@ suite('test_mow_agg_delete_bitmap', 'multi_cluster,docker') {
do {
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
sb.append("/api/compaction/run_status?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
@@ -113,9 +127,16 @@ suite('test_mow_agg_delete_bitmap', 'multi_cluster,docker') {
def be_http_port = backendId_to_backendHttpPort[trigger_backend_id]
boolean running = true
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
sb.append("/api/delete_bitmap/count_local?verbose=true&tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
@@ -135,9 +156,16 @@ suite('test_mow_agg_delete_bitmap', 'multi_cluster,docker') {
def be_http_port = backendId_to_backendHttpPort[trigger_backend_id]
boolean running = true
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
sb.append("/api/delete_bitmap/count_ms?verbose=true&tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/cloud_p0/read_cluster_cache/no_warmup/test_enable_prefer_cached_rowset.groovy b/regression-test/suites/cloud_p0/read_cluster_cache/no_warmup/test_enable_prefer_cached_rowset.groovy
index 34ca1d7e8a4..3d15cdfeb34 100644
--- a/regression-test/suites/cloud_p0/read_cluster_cache/no_warmup/test_enable_prefer_cached_rowset.groovy
+++ b/regression-test/suites/cloud_p0/read_cluster_cache/no_warmup/test_enable_prefer_cached_rowset.groovy
@@ -70,6 +70,9 @@ suite('test_enable_prefer_cached_rowset', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/cloud_p0/read_cluster_cache/no_warmup/test_query_freshness_tolerance.groovy b/regression-test/suites/cloud_p0/read_cluster_cache/no_warmup/test_query_freshness_tolerance.groovy
index 215e588137e..74fc25844a6 100644
--- a/regression-test/suites/cloud_p0/read_cluster_cache/no_warmup/test_query_freshness_tolerance.groovy
+++ b/regression-test/suites/cloud_p0/read_cluster_cache/no_warmup/test_query_freshness_tolerance.groovy
@@ -70,6 +70,9 @@ suite('test_query_freshness_tolerance', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/cloud_p0/read_cluster_cache/warmup/test_warmup_delay_compaction_query_tolerance.groovy b/regression-test/suites/cloud_p0/read_cluster_cache/warmup/test_warmup_delay_compaction_query_tolerance.groovy
index d8cacef24e3..a5a8a31165a 100644
--- a/regression-test/suites/cloud_p0/read_cluster_cache/warmup/test_warmup_delay_compaction_query_tolerance.groovy
+++ b/regression-test/suites/cloud_p0/read_cluster_cache/warmup/test_warmup_delay_compaction_query_tolerance.groovy
@@ -63,6 +63,9 @@ suite('test_warmup_delay_compaction_query_tolerance', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
@@ -149,9 +152,16 @@ suite('test_warmup_delay_compaction_query_tolerance', 'docker') {
def getTabletStatus = { ip, port, tablet_id ->
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${ip}:${port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${ip}:${port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/cloud_p0/read_cluster_cache/warmup/test_warmup_delay_idx_query_tolerance.groovy b/regression-test/suites/cloud_p0/read_cluster_cache/warmup/test_warmup_delay_idx_query_tolerance.groovy
index de4887624e4..ecfa093a7ad 100644
--- a/regression-test/suites/cloud_p0/read_cluster_cache/warmup/test_warmup_delay_idx_query_tolerance.groovy
+++ b/regression-test/suites/cloud_p0/read_cluster_cache/warmup/test_warmup_delay_idx_query_tolerance.groovy
@@ -63,6 +63,9 @@ suite('test_warmup_delay_idx_query_tolerance', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
@@ -149,9 +152,16 @@ suite('test_warmup_delay_idx_query_tolerance', 'docker') {
def getTabletStatus = { ip, port, tablet_id ->
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${ip}:${port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${ip}:${port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/cloud_p0/read_cluster_cache/warmup/test_warmup_delay_sc_query_tolerance.groovy b/regression-test/suites/cloud_p0/read_cluster_cache/warmup/test_warmup_delay_sc_query_tolerance.groovy
index 688aa5e4446..3e3c90cd410 100644
--- a/regression-test/suites/cloud_p0/read_cluster_cache/warmup/test_warmup_delay_sc_query_tolerance.groovy
+++ b/regression-test/suites/cloud_p0/read_cluster_cache/warmup/test_warmup_delay_sc_query_tolerance.groovy
@@ -63,6 +63,9 @@ suite('test_warmup_delay_sc_query_tolerance', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
@@ -149,9 +152,16 @@ suite('test_warmup_delay_sc_query_tolerance', 'docker') {
def getTabletStatus = { ip, port, tablet_id ->
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${ip}:${port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${ip}:${port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/cloud_p0/read_cluster_cache/warmup/test_warmup_delay_timeout_compaction_query_tolerance.groovy b/regression-test/suites/cloud_p0/read_cluster_cache/warmup/test_warmup_delay_timeout_compaction_query_tolerance.groovy
index b13609ed42e..6665f92afe8 100644
--- a/regression-test/suites/cloud_p0/read_cluster_cache/warmup/test_warmup_delay_timeout_compaction_query_tolerance.groovy
+++ b/regression-test/suites/cloud_p0/read_cluster_cache/warmup/test_warmup_delay_timeout_compaction_query_tolerance.groovy
@@ -64,6 +64,9 @@ suite('test_warmup_delay_timeout_compaction_query_tolerance', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
@@ -150,9 +153,16 @@ suite('test_warmup_delay_timeout_compaction_query_tolerance', 'docker') {
def getTabletStatus = { ip, port, tablet_id ->
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${ip}:${port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${ip}:${port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/cloud_p0/read_cluster_cache/warmup/test_warmup_download_fail.groovy b/regression-test/suites/cloud_p0/read_cluster_cache/warmup/test_warmup_download_fail.groovy
index ea1aafbc44c..1dac12e9df3 100644
--- a/regression-test/suites/cloud_p0/read_cluster_cache/warmup/test_warmup_download_fail.groovy
+++ b/regression-test/suites/cloud_p0/read_cluster_cache/warmup/test_warmup_download_fail.groovy
@@ -63,6 +63,9 @@ suite('test_warmup_download_fail', 'docker') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
@@ -123,9 +126,16 @@ suite('test_warmup_download_fail', 'docker') {
def getTabletStatus = { ip, port, tablet_id ->
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${ip}:${port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${ip}:${port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/cloud_p0/test_read_cluster_var_property.groovy b/regression-test/suites/cloud_p0/test_read_cluster_var_property.groovy
index 3305d4ce5db..df767e4409a 100644
--- a/regression-test/suites/cloud_p0/test_read_cluster_var_property.groovy
+++ b/regression-test/suites/cloud_p0/test_read_cluster_var_property.groovy
@@ -27,6 +27,9 @@ suite('test_read_cluster_var_property') {
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/compaction/test_compaction_fail_release_lock.groovy b/regression-test/suites/compaction/test_compaction_fail_release_lock.groovy
index 6ce52179436..969dd284172 100644
--- a/regression-test/suites/compaction/test_compaction_fail_release_lock.groovy
+++ b/regression-test/suites/compaction/test_compaction_fail_release_lock.groovy
@@ -81,9 +81,16 @@ suite("test_compaction_fail_release_lock", "nonConcurrent") {
boolean running = true
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("http://${be_host}:${be_http_port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
def (code, out, err) = curl('GET', command)
@@ -98,9 +105,16 @@ suite("test_compaction_fail_release_lock", "nonConcurrent") {
do {
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("http://${be_host}:${be_http_port}")
- sb.append("/api/compaction/run_status?tablet_id=")
- sb.append(tablet_id)
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
+ sb.append("/api/compaction/run_status?tablet_id=")
+ sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
def (code, out, err) = curl('GET', command)
diff --git a/regression-test/suites/compaction/test_compaction_update_big_delete_bitmap.groovy b/regression-test/suites/compaction/test_compaction_update_big_delete_bitmap.groovy
index 3310cbd5420..0a24e637cce 100644
--- a/regression-test/suites/compaction/test_compaction_update_big_delete_bitmap.groovy
+++ b/regression-test/suites/compaction/test_compaction_update_big_delete_bitmap.groovy
@@ -82,9 +82,16 @@ suite("test_compaction_update_big_delete_bitmap", "nonConcurrent") {
boolean running = true
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
@@ -102,9 +109,16 @@ suite("test_compaction_update_big_delete_bitmap", "nonConcurrent") {
do {
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
- sb.append("/api/compaction/run_status?tablet_id=")
- sb.append(tablet_id)
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
+ sb.append("/api/compaction/run_status?tablet_id=")
+ sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/compaction/test_filecache_compaction_and_read_stale_cloud_docker.groovy b/regression-test/suites/compaction/test_filecache_compaction_and_read_stale_cloud_docker.groovy
index 8673f249e1d..c4dc38f0cd9 100644
--- a/regression-test/suites/compaction/test_filecache_compaction_and_read_stale_cloud_docker.groovy
+++ b/regression-test/suites/compaction/test_filecache_compaction_and_read_stale_cloud_docker.groovy
@@ -65,9 +65,16 @@ suite("test_filecache_compaction_and_read_stale_cloud_docker", "docker") {
def be_host = backendId_to_backendIP[trigger_backend_id]
def be_http_port = backendId_to_backendHttpPort[trigger_backend_id]
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
@@ -89,9 +96,16 @@ suite("test_filecache_compaction_and_read_stale_cloud_docker", "docker") {
do {
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
- sb.append("/api/compaction/run_status?tablet_id=")
- sb.append(tablet_id)
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
+ sb.append("/api/compaction/run_status?tablet_id=")
+ sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/compaction/test_filecache_compaction_multisegments_and_read_stale_cloud_docker.groovy b/regression-test/suites/compaction/test_filecache_compaction_multisegments_and_read_stale_cloud_docker.groovy
index 4b661316090..63f97bde051 100644
--- a/regression-test/suites/compaction/test_filecache_compaction_multisegments_and_read_stale_cloud_docker.groovy
+++ b/regression-test/suites/compaction/test_filecache_compaction_multisegments_and_read_stale_cloud_docker.groovy
@@ -94,9 +94,16 @@ suite("test_filecache_compaction_multisegments_and_read_stale_cloud_docker", "do
do {
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
- sb.append("/api/compaction/run_status?tablet_id=")
- sb.append(tablet_id)
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
+ sb.append("/api/compaction/run_status?tablet_id=")
+ sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/compaction/test_filecache_with_base_compaction.groovy b/regression-test/suites/compaction/test_filecache_with_base_compaction.groovy
index 966da184792..b2f4af9356c 100644
--- a/regression-test/suites/compaction/test_filecache_with_base_compaction.groovy
+++ b/regression-test/suites/compaction/test_filecache_with_base_compaction.groovy
@@ -64,9 +64,16 @@ suite("test_filecache_with_base_compaction", "docker") {
def be_host = backendId_to_backendIP[trigger_backend_id]
def be_http_port = backendId_to_backendHttpPort[trigger_backend_id]
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
@@ -88,9 +95,16 @@ suite("test_filecache_with_base_compaction", "docker") {
do {
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
- sb.append("/api/compaction/run_status?tablet_id=")
- sb.append(tablet_id)
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
+ sb.append("/api/compaction/run_status?tablet_id=")
+ sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/compaction/test_filecache_with_base_compaction_thresthold.groovy b/regression-test/suites/compaction/test_filecache_with_base_compaction_thresthold.groovy
index 9e3ad4abde3..90a0053ce18 100644
--- a/regression-test/suites/compaction/test_filecache_with_base_compaction_thresthold.groovy
+++ b/regression-test/suites/compaction/test_filecache_with_base_compaction_thresthold.groovy
@@ -67,9 +67,16 @@ suite("test_filecache_with_base_compaction_thresthold", "docker") {
def be_host = backendId_to_backendIP[trigger_backend_id]
def be_http_port = backendId_to_backendHttpPort[trigger_backend_id]
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
@@ -91,9 +98,16 @@ suite("test_filecache_with_base_compaction_thresthold", "docker") {
do {
Thread.sleep(20000)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
- sb.append("/api/compaction/run_status?tablet_id=")
- sb.append(tablet_id)
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
+ sb.append("/api/compaction/run_status?tablet_id=")
+ sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/compaction/test_mow_compact_multi_segments.groovy b/regression-test/suites/compaction/test_mow_compact_multi_segments.groovy
index e6595cdfb13..09bb3c18a93 100644
--- a/regression-test/suites/compaction/test_mow_compact_multi_segments.groovy
+++ b/regression-test/suites/compaction/test_mow_compact_multi_segments.groovy
@@ -106,9 +106,16 @@ suite("test_mow_compact_multi_segments", "nonConcurrent") {
do {
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
- sb.append("/api/compaction/run_status?tablet_id=")
- sb.append(tablet_id)
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
+ sb.append("/api/compaction/run_status?tablet_id=")
+ sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/compaction/test_mow_compaction_agg_and_remove_pre_delete_bitmap.groovy b/regression-test/suites/compaction/test_mow_compaction_agg_and_remove_pre_delete_bitmap.groovy
index 246ba173e90..0c0fda5d1c2 100644
--- a/regression-test/suites/compaction/test_mow_compaction_agg_and_remove_pre_delete_bitmap.groovy
+++ b/regression-test/suites/compaction/test_mow_compaction_agg_and_remove_pre_delete_bitmap.groovy
@@ -90,9 +90,16 @@ suite("test_mow_compaction_agg_and_remove_pre_delete_bitmap", "nonConcurrent") {
def be_host = backendId_to_backendIP[trigger_backend_id]
def be_http_port = backendId_to_backendHttpPort[trigger_backend_id]
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
@@ -114,9 +121,16 @@ suite("test_mow_compaction_agg_and_remove_pre_delete_bitmap", "nonConcurrent") {
do {
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
- sb.append("/api/compaction/run_status?tablet_id=")
- sb.append(tablet_id)
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
+ sb.append("/api/compaction/run_status?tablet_id=")
+ sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/compaction/test_mow_compaction_and_read_stale.groovy b/regression-test/suites/compaction/test_mow_compaction_and_read_stale.groovy
index e4f7cb0b264..bfd1a41cf36 100644
--- a/regression-test/suites/compaction/test_mow_compaction_and_read_stale.groovy
+++ b/regression-test/suites/compaction/test_mow_compaction_and_read_stale.groovy
@@ -95,9 +95,16 @@ suite("test_mow_compaction_and_read_stale", "nonConcurrent") {
def be_host = backendId_to_backendIP[trigger_backend_id]
def be_http_port = backendId_to_backendHttpPort[trigger_backend_id]
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
@@ -119,9 +126,16 @@ suite("test_mow_compaction_and_read_stale", "nonConcurrent") {
do {
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
- sb.append("/api/compaction/run_status?tablet_id=")
- sb.append(tablet_id)
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
+ sb.append("/api/compaction/run_status?tablet_id=")
+ sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/compaction/test_mow_compaction_and_read_stale_cloud_docker.groovy b/regression-test/suites/compaction/test_mow_compaction_and_read_stale_cloud_docker.groovy
index 8028140ed84..1cad3818306 100644
--- a/regression-test/suites/compaction/test_mow_compaction_and_read_stale_cloud_docker.groovy
+++ b/regression-test/suites/compaction/test_mow_compaction_and_read_stale_cloud_docker.groovy
@@ -63,9 +63,16 @@ suite("test_mow_compaction_and_read_stale_cloud_docker", "docker") {
def be_host = backendId_to_backendIP[trigger_backend_id]
def be_http_port = backendId_to_backendHttpPort[trigger_backend_id]
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
@@ -87,9 +94,16 @@ suite("test_mow_compaction_and_read_stale_cloud_docker", "docker") {
do {
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
- sb.append("/api/compaction/run_status?tablet_id=")
- sb.append(tablet_id)
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
+ sb.append("/api/compaction/run_status?tablet_id=")
+ sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/compaction/test_mow_compaction_and_rowset_not_exist.groovy b/regression-test/suites/compaction/test_mow_compaction_and_rowset_not_exist.groovy
index a2a7913095f..8b563564bb2 100644
--- a/regression-test/suites/compaction/test_mow_compaction_and_rowset_not_exist.groovy
+++ b/regression-test/suites/compaction/test_mow_compaction_and_rowset_not_exist.groovy
@@ -102,9 +102,16 @@ suite("test_mow_compaction_and_rowset_not_exist", "nonConcurrent") {
def be_host = backendId_to_backendIP[trigger_backend_id]
def be_http_port = backendId_to_backendHttpPort[trigger_backend_id]
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
@@ -126,9 +133,16 @@ suite("test_mow_compaction_and_rowset_not_exist", "nonConcurrent") {
do {
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
- sb.append("/api/compaction/run_status?tablet_id=")
- sb.append(tablet_id)
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
+ sb.append("/api/compaction/run_status?tablet_id=")
+ sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/compaction/test_mow_compaction_and_schema_change.groovy b/regression-test/suites/compaction/test_mow_compaction_and_schema_change.groovy
index 6dcac2770ac..5c4dbbedd3f 100644
--- a/regression-test/suites/compaction/test_mow_compaction_and_schema_change.groovy
+++ b/regression-test/suites/compaction/test_mow_compaction_and_schema_change.groovy
@@ -92,9 +92,16 @@ suite("test_mow_compaction_and_schema_change", "nonConcurrent") {
def be_host = backendId_to_backendIP[trigger_backend_id]
def be_http_port = backendId_to_backendHttpPort[trigger_backend_id]
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
@@ -116,9 +123,16 @@ suite("test_mow_compaction_and_schema_change", "nonConcurrent") {
do {
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
- sb.append("/api/compaction/run_status?tablet_id=")
- sb.append(tablet_id)
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
+ sb.append("/api/compaction/run_status?tablet_id=")
+ sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/compaction/test_mow_delete_unused_rowset_dm_docker.groovy b/regression-test/suites/compaction/test_mow_delete_unused_rowset_dm_docker.groovy
index 53bc4f10e51..9002a6366f4 100644
--- a/regression-test/suites/compaction/test_mow_delete_unused_rowset_dm_docker.groovy
+++ b/regression-test/suites/compaction/test_mow_delete_unused_rowset_dm_docker.groovy
@@ -64,9 +64,16 @@ suite("test_mow_delete_unused_rowset_dm_docker", "docker") {
def be_host = backendId_to_backendIP[trigger_backend_id]
def be_http_port = backendId_to_backendHttpPort[trigger_backend_id]
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
@@ -88,9 +95,16 @@ suite("test_mow_delete_unused_rowset_dm_docker", "docker") {
do {
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
- sb.append("/api/compaction/run_status?tablet_id=")
- sb.append(tablet_id)
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
+ sb.append("/api/compaction/run_status?tablet_id=")
+ sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/compaction/test_mow_stale_rowset_delete_bitmap.groovy b/regression-test/suites/compaction/test_mow_stale_rowset_delete_bitmap.groovy
index 78a57f97bfd..1197fe24aa9 100644
--- a/regression-test/suites/compaction/test_mow_stale_rowset_delete_bitmap.groovy
+++ b/regression-test/suites/compaction/test_mow_stale_rowset_delete_bitmap.groovy
@@ -94,9 +94,16 @@ suite("test_mow_stale_rowset_delete_bitmap", "nonConcurrent") {
def be_host = backendId_to_backendIP[trigger_backend_id]
def be_http_port = backendId_to_backendHttpPort[trigger_backend_id]
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
@@ -118,9 +125,16 @@ suite("test_mow_stale_rowset_delete_bitmap", "nonConcurrent") {
do {
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
- sb.append("/api/compaction/run_status?tablet_id=")
- sb.append(tablet_id)
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
+ sb.append("/api/compaction/run_status?tablet_id=")
+ sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/compaction/test_single_compaction_fault_injection.groovy b/regression-test/suites/compaction/test_single_compaction_fault_injection.groovy
index a8f3da94470..5220d079143 100644
--- a/regression-test/suites/compaction/test_single_compaction_fault_injection.groovy
+++ b/regression-test/suites/compaction/test_single_compaction_fault_injection.groovy
@@ -84,9 +84,16 @@ suite("test_single_compaction_fault_injection", "p2, nonConcurrent") {
do {
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
- sb.append("/api/compaction/run_status?tablet_id=")
- sb.append(tablet_id)
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
+ sb.append("/api/compaction/run_status?tablet_id=")
+ sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
@@ -105,9 +112,16 @@ suite("test_single_compaction_fault_injection", "p2, nonConcurrent") {
boolean running = true
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/compaction/test_single_compaction_with_variant_inverted_index.groovy b/regression-test/suites/compaction/test_single_compaction_with_variant_inverted_index.groovy
index 37e7c3c4bbe..51b99b8878c 100644
--- a/regression-test/suites/compaction/test_single_compaction_with_variant_inverted_index.groovy
+++ b/regression-test/suites/compaction/test_single_compaction_with_variant_inverted_index.groovy
@@ -94,9 +94,16 @@ suite("test_single_compaction_with_variant_inverted", "p2, nonConcurrent") {
do {
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
- sb.append("/api/compaction/run_status?tablet_id=")
- sb.append(tablet_id)
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
+ sb.append("/api/compaction/run_status?tablet_id=")
+ sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
@@ -115,9 +122,16 @@ suite("test_single_compaction_with_variant_inverted", "p2, nonConcurrent") {
boolean running = true
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/compaction/test_single_replica_compaction.groovy b/regression-test/suites/compaction/test_single_replica_compaction.groovy
index 9cc9c9a9c0f..53f241dac31 100644
--- a/regression-test/suites/compaction/test_single_replica_compaction.groovy
+++ b/regression-test/suites/compaction/test_single_replica_compaction.groovy
@@ -87,9 +87,16 @@ suite("test_single_compaction_p2", "p2") {
do {
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
- sb.append("/api/compaction/run_status?tablet_id=")
- sb.append(tablet_id)
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
+ sb.append("/api/compaction/run_status?tablet_id=")
+ sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
@@ -108,9 +115,16 @@ suite("test_single_compaction_p2", "p2") {
boolean running = true
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/doc/data-operate/import/import-way/group-commit-manual.md.groovy b/regression-test/suites/doc/data-operate/import/import-way/group-commit-manual.md.groovy
index 2f082e12f88..aa72bc07b73 100644
--- a/regression-test/suites/doc/data-operate/import/import-way/group-commit-manual.md.groovy
+++ b/regression-test/suites/doc/data-operate/import/import-way/group-commit-manual.md.groovy
@@ -65,10 +65,17 @@ suite("docs/data-operate/import/import-way/group-commit-manual.md", "p0,nonConcu
"""
sql "set group_commit = off_mode;"
- cmd """curl --location-trusted -u ${context.config.jdbcUser}:${context.config.jdbcPassword} -T ${context.file.parent}/data.csv -H "group_commit:async_mode" -H "column_separator:," http://${context.config.feHttpAddress}/api/db/dt/_stream_load"""
- cmd """curl --location-trusted -u ${context.config.jdbcUser}:${context.config.jdbcPassword} -T ${context.file.parent}/data.csv -H "group_commit:sync_mode" -H "column_separator:," http://${context.config.feHttpAddress}/api/db/dt/_stream_load"""
- cmd """curl --location-trusted -u ${context.config.jdbcUser}:${context.config.jdbcPassword} -T ${context.file.parent}/data.csv -H "group_commit:async_mode" -H "sql:insert into db.dt select * from http_stream('column_separator'=',', 'format' = 'CSV')" http://${context.config.feHttpAddress}/api/_http_stream"""
- cmd """curl --location-trusted -u ${context.config.jdbcUser}:${context.config.jdbcPassword} -T ${context.file.parent}/data.csv -H "group_commit:sync_mode" -H "sql:insert into db.dt select * from http_stream('column_separator'=',', 'format' = 'CSV')" http://${context.config.feHttpAddress}/api/_http_stream"""
+ String tlsInfo = ""
+ String protocol = "http"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ tlsInfo = " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ protocol = "https"
+ }
+ logger.info("curl --location-trusted -u ${context.config.jdbcUser}:${context.config.jdbcPassword} -T ${context.file.parent}/data.csv -H \"group_commit:async_mode\" -H \"column_separator:,\" ${protocol}://${context.config.feHttpAddress}/api/db/dt/_stream_load ${tlsInfo}")
+ cmd """curl --location-trusted -u ${context.config.jdbcUser}:${context.config.jdbcPassword} -T ${context.file.parent}/data.csv -H "group_commit:async_mode" -H "column_separator:," ${protocol}://${context.config.feHttpAddress}/api/db/dt/_stream_load ${tlsInfo}"""
+ cmd """curl --location-trusted -u ${context.config.jdbcUser}:${context.config.jdbcPassword} -T ${context.file.parent}/data.csv -H "group_commit:sync_mode" -H "column_separator:," ${protocol}://${context.config.feHttpAddress}/api/db/dt/_stream_load ${tlsInfo}"""
+ cmd """curl --location-trusted -u ${context.config.jdbcUser}:${context.config.jdbcPassword} -T ${context.file.parent}/data.csv -H "group_commit:async_mode" -H "sql:insert into db.dt select * from http_stream('column_separator'=',', 'format' = 'CSV')" ${protocol}://${context.config.feHttpAddress}/api/_http_stream ${tlsInfo}"""
+ cmd """curl --location-trusted -u ${context.config.jdbcUser}:${context.config.jdbcPassword} -T ${context.file.parent}/data.csv -H "group_commit:sync_mode" -H "sql:insert into db.dt select * from http_stream('column_separator'=',', 'format' = 'CSV')" ${protocol}://${context.config.feHttpAddress}/api/_http_stream ${tlsInfo}"""
sql """ALTER TABLE dt SET ("group_commit_interval_ms" = "2000");"""
sql """ALTER TABLE dt SET ("group_commit_data_bytes" = "134217728");"""
diff --git a/regression-test/suites/doc/table-design/auto-increment.md.groovy b/regression-test/suites/doc/table-design/auto-increment.md.groovy
index f78d53c1b13..bfddb0b1fad 100644
--- a/regression-test/suites/doc/table-design/auto-increment.md.groovy
+++ b/regression-test/suites/doc/table-design/auto-increment.md.groovy
@@ -119,9 +119,14 @@ suite("docs/table-design/auto-increment.md") {
select * from tbl order by id;
"""
- cmd """
- curl --location-trusted -u ${context.config.jdbcUser}:${context.config.jdbcPassword} -H "columns:name,value" -H "column_separator:," -T ${context.file.parent}/test_data/test.csv http://${context.config.feHttpAddress}/api/demo/tbl/_stream_load
- """
+ def curlCmd = """
+ curl --location-trusted -u ${context.config.jdbcUser}:${context.config.jdbcPassword} -H "columns:name,value" -H "column_separator:," -T ${context.file.parent}/test_data/test.csv http://${context.config.feHttpAddress}/api/demo/tbl/_stream_load
+ """
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ curlCmd = curlCmd.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
+ cmd curlCmd
+ log.info("${curlCmd}")
sql "select * from tbl order by id"
multi_sql """
diff --git a/regression-test/suites/doc/table-design/data-partitioning/dynamic-partitioning.md.groovy b/regression-test/suites/doc/table-design/data-partitioning/dynamic-partitioning.md.groovy
index 8693e78d776..7e5a36debbb 100644
--- a/regression-test/suites/doc/table-design/data-partitioning/dynamic-partitioning.md.groovy
+++ b/regression-test/suites/doc/table-design/data-partitioning/dynamic-partitioning.md.groovy
@@ -81,10 +81,16 @@ suite("docs/table-design/data-partitioning/dynamic-partitioning.md") {
sql "SHOW DYNAMIC PARTITION TABLES"
sql """ ADMIN SET FRONTEND CONFIG ("dynamic_partition_enable" = "true") """
- cmd """ curl --location-trusted -u ${context.config.jdbcUser}:${context.config.jdbcPassword} -XGET http://${context.config.feHttpAddress}/api/_set_config?dynamic_partition_enable=true """
+ String tlsInfo = ""
+ String protocol = "http"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ tlsInfo = " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ protocol = "https"
+ }
+ cmd """ curl --location-trusted -u ${context.config.jdbcUser}:${context.config.jdbcPassword} -XGET ${protocol}://${context.config.feHttpAddress}/api/_set_config?dynamic_partition_enable=true ${tlsInfo}"""
sql """ ADMIN SET FRONTEND CONFIG ("dynamic_partition_check_interval_seconds" = "7200") """
- cmd """ curl --location-trusted -u ${context.config.jdbcUser}:${context.config.jdbcPassword} -XGET http://${context.config.feHttpAddress}/api/_set_config?dynamic_partition_check_interval_seconds=432000 """
+ cmd """ curl --location-trusted -u ${context.config.jdbcUser}:${context.config.jdbcPassword} -XGET ${protocol}://${context.config.feHttpAddress}/api/_set_config?dynamic_partition_check_interval_seconds=432000 ${tlsInfo}"""
} catch (Throwable t) {
Assertions.fail("examples in docs/table-design/data-partitioning/dynamic-partitioning.md failed to exec, please fix it", t)
}
diff --git a/regression-test/suites/doc/table-design/index/ngram-bloomfilter-index.md.groovy b/regression-test/suites/doc/table-design/index/ngram-bloomfilter-index.md.groovy
index f42b455559b..49ce9634a4c 100644
--- a/regression-test/suites/doc/table-design/index/ngram-bloomfilter-index.md.groovy
+++ b/regression-test/suites/doc/table-design/index/ngram-bloomfilter-index.md.groovy
@@ -52,7 +52,13 @@ suite("docs/table-design/index/ngram-bloomfilter-index.md") {
f.delete()
}
cmd("wget ${getS3Url()}/regression/doc/amazon_reviews_2010.snappy.parquet")
- cmd("""curl --location-trusted -u ${context.config.jdbcUser}:${context.config.jdbcPassword} -T amazon_reviews_2010.snappy.parquet -H "format:parquet" http://${context.config.feHttpAddress}/api/${curDbName}/amazon_reviews/_stream_load""")
+ String tlsInfo = ""
+ String protocol = "http"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ tlsInfo = " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ protocol = "https"
+ }
+ cmd("""curl --location-trusted -u ${context.config.jdbcUser}:${context.config.jdbcPassword} -T amazon_reviews_2010.snappy.parquet -H "format:parquet" ${protocol}://${context.config.feHttpAddress}/api/${curDbName}/amazon_reviews/_stream_load ${tlsInfo}""")
sql " SELECT COUNT() FROM amazon_reviews "
sql """
diff --git a/regression-test/suites/export/test_array_export.groovy b/regression-test/suites/export/test_array_export.groovy
index cdf9c6588bb..68838c60c14 100644
--- a/regression-test/suites/export/test_array_export.groovy
+++ b/regression-test/suites/export/test_array_export.groovy
@@ -39,7 +39,12 @@ suite("test_array_export", "export,external") {
// check whether the FE config 'enable_outfile_to_local' is true
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
def process = command.toString().execute()
def code = process.waitFor()
diff --git a/regression-test/suites/export/test_map_export.groovy b/regression-test/suites/export/test_map_export.groovy
index 101ab07ebbe..151598a3c8b 100644
--- a/regression-test/suites/export/test_map_export.groovy
+++ b/regression-test/suites/export/test_map_export.groovy
@@ -25,7 +25,12 @@ suite("test_map_export", "export") {
// check whether the FE config 'enable_outfile_to_local' is true
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
def process = command.toString().execute()
diff --git a/regression-test/suites/export/test_struct_export.groovy b/regression-test/suites/export/test_struct_export.groovy
index bc3912af39e..f7752b3af75 100644
--- a/regression-test/suites/export/test_struct_export.groovy
+++ b/regression-test/suites/export/test_struct_export.groovy
@@ -25,7 +25,12 @@ suite("test_struct_export", "export") {
// check whether the FE config 'enable_outfile_to_local' is true
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
def process = command.toString().execute()
diff --git a/regression-test/suites/export_p0/outfile/parquet/test_outfile_parquet.groovy b/regression-test/suites/export_p0/outfile/parquet/test_outfile_parquet.groovy
index 96854cb8fa4..cd92abea530 100644
--- a/regression-test/suites/export_p0/outfile/parquet/test_outfile_parquet.groovy
+++ b/regression-test/suites/export_p0/outfile/parquet/test_outfile_parquet.groovy
@@ -32,7 +32,13 @@ suite("test_outfile_parquet") {
sql "USE $dbName"
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
def process = command.toString().execute()
diff --git a/regression-test/suites/export_p0/test_export_basic.groovy b/regression-test/suites/export_p0/test_export_basic.groovy
index 19261c55e01..c55fde0fac1 100644
--- a/regression-test/suites/export_p0/test_export_basic.groovy
+++ b/regression-test/suites/export_p0/test_export_basic.groovy
@@ -31,7 +31,13 @@ suite("test_export_basic", "p0") {
// check whether the FE config 'enable_outfile_to_local' is true
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
def process = command.toString().execute()
diff --git a/regression-test/suites/export_p0/test_export_csv.groovy b/regression-test/suites/export_p0/test_export_csv.groovy
index 9091fa55e6b..dd9f807e69a 100644
--- a/regression-test/suites/export_p0/test_export_csv.groovy
+++ b/regression-test/suites/export_p0/test_export_csv.groovy
@@ -29,7 +29,12 @@ suite("test_export_csv", "p0") {
// check whether the FE config 'enable_outfile_to_local' is true
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
def process = command.toString().execute()
diff --git a/regression-test/suites/export_p0/test_export_data_consistency.groovy b/regression-test/suites/export_p0/test_export_data_consistency.groovy
index e1d4ba16385..45d2be4dfff 100644
--- a/regression-test/suites/export_p0/test_export_data_consistency.groovy
+++ b/regression-test/suites/export_p0/test_export_data_consistency.groovy
@@ -31,7 +31,12 @@ suite("test_export_data_consistency", "p0") {
// check whether the FE config 'enable_outfile_to_local' is true
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
def process = command.toString().execute()
diff --git a/regression-test/suites/export_p0/test_export_delete_disallow.groovy b/regression-test/suites/export_p0/test_export_delete_disallow.groovy
index f5f508afb52..22a27908332 100644
--- a/regression-test/suites/export_p0/test_export_delete_disallow.groovy
+++ b/regression-test/suites/export_p0/test_export_delete_disallow.groovy
@@ -27,7 +27,12 @@ suite("test_export_delete_disallow", "p0") {
// check whether the FE config 'enable_outfile_to_local' is true
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
def process = command.toString().execute()
diff --git a/regression-test/suites/export_p0/test_export_empty_table.groovy b/regression-test/suites/export_p0/test_export_empty_table.groovy
index bd2b4ad09d1..76c665d0749 100644
--- a/regression-test/suites/export_p0/test_export_empty_table.groovy
+++ b/regression-test/suites/export_p0/test_export_empty_table.groovy
@@ -30,7 +30,12 @@ suite("test_export_empty_table", "p0") {
// check whether the FE config 'enable_outfile_to_local' is true
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
def process = command.toString().execute()
diff --git a/regression-test/suites/export_p0/test_export_table_with_label_retry.groovy b/regression-test/suites/export_p0/test_export_table_with_label_retry.groovy
index 854fac6ddee..bd7c85f4d8c 100644
--- a/regression-test/suites/export_p0/test_export_table_with_label_retry.groovy
+++ b/regression-test/suites/export_p0/test_export_table_with_label_retry.groovy
@@ -29,7 +29,12 @@ suite("test_export_table_with_label_retry", "p0") {
// check whether the FE config 'enable_outfile_to_local' is true
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
def process = command.toString().execute()
diff --git a/regression-test/suites/export_p0/test_export_view.groovy b/regression-test/suites/export_p0/test_export_view.groovy
index 0a7f8245a11..1e35483d619 100644
--- a/regression-test/suites/export_p0/test_export_view.groovy
+++ b/regression-test/suites/export_p0/test_export_view.groovy
@@ -29,7 +29,12 @@ suite("test_export_view", "p0") {
// check whether the FE config 'enable_outfile_to_local' is true
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
def process = command.toString().execute()
diff --git a/regression-test/suites/export_p0/test_outfile.groovy b/regression-test/suites/export_p0/test_outfile.groovy
index 56ede909514..f33500f5883 100644
--- a/regression-test/suites/export_p0/test_outfile.groovy
+++ b/regression-test/suites/export_p0/test_outfile.groovy
@@ -24,9 +24,15 @@ import java.nio.file.Paths
suite("test_outfile") {
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
+ logger.info("command xxx " + command.toString())
def process = command.toString().execute()
def code = process.waitFor()
def err = IOGroovyMethods.getText(new BufferedReader(new InputStreamReader(process.getErrorStream())));
diff --git a/regression-test/suites/export_p0/test_outfile_csv_with_names.groovy b/regression-test/suites/export_p0/test_outfile_csv_with_names.groovy
index 56e9e576b5b..874edf289a2 100644
--- a/regression-test/suites/export_p0/test_outfile_csv_with_names.groovy
+++ b/regression-test/suites/export_p0/test_outfile_csv_with_names.groovy
@@ -27,9 +27,15 @@ suite("test_outfile_csv_with_names") {
sql "USE $dbName"
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
+ logger.info("command xxx " + command.toString())
def process = command.toString().execute()
def code = process.waitFor()
def err = IOGroovyMethods.getText(new BufferedReader(new InputStreamReader(process.getErrorStream())));
diff --git a/regression-test/suites/export_p0/test_outfile_csv_with_names_and_types.groovy b/regression-test/suites/export_p0/test_outfile_csv_with_names_and_types.groovy
index 639988eb240..65a05f8b0ce 100644
--- a/regression-test/suites/export_p0/test_outfile_csv_with_names_and_types.groovy
+++ b/regression-test/suites/export_p0/test_outfile_csv_with_names_and_types.groovy
@@ -27,7 +27,12 @@ suite("test_outfile_csv_with_names_and_types") {
sql "USE $dbName"
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
def process = command.toString().execute()
diff --git a/regression-test/suites/export_p0/test_outfile_csv_with_success_prefix.groovy b/regression-test/suites/export_p0/test_outfile_csv_with_success_prefix.groovy
index de00eeabd17..bcb951038a4 100644
--- a/regression-test/suites/export_p0/test_outfile_csv_with_success_prefix.groovy
+++ b/regression-test/suites/export_p0/test_outfile_csv_with_success_prefix.groovy
@@ -27,7 +27,12 @@ suite("test_outfile_csv_with_success_prefix") {
sql "USE $dbName"
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
def process = command.toString().execute()
diff --git a/regression-test/suites/export_p0/test_outfile_expr.groovy b/regression-test/suites/export_p0/test_outfile_expr.groovy
index 34d9021f342..67c28f77390 100644
--- a/regression-test/suites/export_p0/test_outfile_expr.groovy
+++ b/regression-test/suites/export_p0/test_outfile_expr.groovy
@@ -29,7 +29,12 @@ suite("test_outfile_expr") {
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
def process = command.toString().execute()
diff --git a/regression-test/suites/export_p0/test_outfile_separator.groovy b/regression-test/suites/export_p0/test_outfile_separator.groovy
index c4d24885156..e7c992426da 100644
--- a/regression-test/suites/export_p0/test_outfile_separator.groovy
+++ b/regression-test/suites/export_p0/test_outfile_separator.groovy
@@ -29,7 +29,12 @@ suite("test_outfile_separator") {
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
def process = command.toString().execute()
diff --git a/regression-test/suites/export_p2/test_export_big_data.groovy b/regression-test/suites/export_p2/test_export_big_data.groovy
index 46061d917ec..0ef41e5649f 100644
--- a/regression-test/suites/export_p2/test_export_big_data.groovy
+++ b/regression-test/suites/export_p2/test_export_big_data.groovy
@@ -30,7 +30,12 @@ suite("test_export_big_data", "p2") {
// check whether the FE config 'enable_outfile_to_local' is true
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
def process = command.toString().execute()
diff --git a/regression-test/suites/external_table_p0/export/test_export_external_table.groovy b/regression-test/suites/external_table_p0/export/test_export_external_table.groovy
index 179f5066b74..6910a983faf 100644
--- a/regression-test/suites/external_table_p0/export/test_export_external_table.groovy
+++ b/regression-test/suites/external_table_p0/export/test_export_external_table.groovy
@@ -29,7 +29,12 @@ suite("test_export_external_table", "p0,external,mysql,external_docker,external_
// check whether the FE config 'enable_outfile_to_local' is true
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
def process = command.toString().execute()
diff --git a/regression-test/suites/fault_injection_p0/cloud/test_cloud_mow_delete_bitmap_lock_case.groovy b/regression-test/suites/fault_injection_p0/cloud/test_cloud_mow_delete_bitmap_lock_case.groovy
index 37a46dc7814..a9ef00170cd 100644
--- a/regression-test/suites/fault_injection_p0/cloud/test_cloud_mow_delete_bitmap_lock_case.groovy
+++ b/regression-test/suites/fault_injection_p0/cloud/test_cloud_mow_delete_bitmap_lock_case.groovy
@@ -139,9 +139,16 @@ suite("test_cloud_mow_delete_bitmap_lock_case", "nonConcurrent") {
boolean running = true
Thread.sleep(1000)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
sb.append("/api/compaction/show?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
@@ -159,9 +166,16 @@ suite("test_cloud_mow_delete_bitmap_lock_case", "nonConcurrent") {
do {
Thread.sleep(100)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
- sb.append("/api/compaction/run_status?tablet_id=")
- sb.append(tablet_id)
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
+ sb.append("/api/compaction/run_status?tablet_id=")
+ sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/fault_injection_p0/cloud/test_delete_bitmap_lock_with_restart.groovy b/regression-test/suites/fault_injection_p0/cloud/test_delete_bitmap_lock_with_restart.groovy
index cada05ac7fa..b3bd868ad3b 100644
--- a/regression-test/suites/fault_injection_p0/cloud/test_delete_bitmap_lock_with_restart.groovy
+++ b/regression-test/suites/fault_injection_p0/cloud/test_delete_bitmap_lock_with_restart.groovy
@@ -139,9 +139,16 @@ suite("test_delete_bitmap_lock_with_restart", "docker") {
do {
Thread.sleep(100)
StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET http://${be_host}:${be_http_port}")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ sb.append("curl -X GET ${protocol}://${be_host}:${be_http_port}")
sb.append("/api/compaction/run_status?tablet_id=")
sb.append(tablet_id)
+ if (enableTls) {
+ sb.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ sb.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ sb.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
String command = sb.toString()
logger.info(command)
diff --git a/regression-test/suites/flink_connector_p0/flink_connector_response.groovy b/regression-test/suites/flink_connector_p0/flink_connector_response.groovy
index c5aa754a52a..43379e8b906 100644
--- a/regression-test/suites/flink_connector_p0/flink_connector_response.groovy
+++ b/regression-test/suites/flink_connector_p0/flink_connector_response.groovy
@@ -61,8 +61,11 @@ PROPERTIES (
strBuilder.append(""" -H label:""" + label)
strBuilder.append(""" -T """ + filePath)
strBuilder.append(""" http://""" + context.config.feHttpAddress + """/api/${thisDb}/${tableName}/_stream_load""")
-
+
String command = strBuilder.toString()
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
logger.info("streamload command=" + command)
def process = command.toString().execute()
process.waitFor()
@@ -79,6 +82,9 @@ PROPERTIES (
strBuilder.append(""" http://""" + context.config.feHttpAddress + """/api/${thisDb}/${tableName}/_stream_load_2pc""")
String command = strBuilder.toString()
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
logger.info("streamload command=" + command)
def processCommit = command.toString().execute()
processCommit.waitFor()
@@ -95,6 +101,9 @@ PROPERTIES (
strBuilder.append(""" http://""" + context.config.feHttpAddress + """/api/${thisDb}/${tableName}/_stream_load_2pc""")
String command = strBuilder.toString()
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
logger.info("streamload command=" + command)
def processAbort = command.toString().execute()
processAbort.waitFor()
diff --git a/regression-test/suites/http_rest_api/get/test_schema_api.groovy b/regression-test/suites/http_rest_api/get/test_schema_api.groovy
index 937b35d4832..474b7a5a5ea 100644
--- a/regression-test/suites/http_rest_api/get/test_schema_api.groovy
+++ b/regression-test/suites/http_rest_api/get/test_schema_api.groovy
@@ -44,6 +44,19 @@ suite("test_schema_api") {
//exist table
def url = String.format("http://%s/api/%s/%s/_schema", context.config.feHttpAddress, thisDb, tbName)
+ Boolean enableTLS = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ if (enableTLS) {
+ Http.configure(enableTLS,
+ context.config.otherConfigs.get("tlsVerifyMode"),
+ context.config.otherConfigs.get("trustStorePath"),
+ context.config.otherConfigs.get("trustStorePassword"),
+ context.config.otherConfigs.get("trustStoreType"),
+ context.config.otherConfigs.get("keyStorePath"),
+ context.config.otherConfigs.get("keyStorePassword"),
+ context.config.otherConfigs.get("keyStoreType")
+ )
+ }
+ logger.info("url: ${url}")
def result = Http.GET(url, true)
assertTrue(result.code == 0)
assertEquals(result.msg, "success")
@@ -58,3 +71,4 @@ suite("test_schema_api") {
assertTrue(result2.data.contains("Unknown catalog"))
}
+
diff --git a/regression-test/suites/http_rest_api/post/test_query_stmt.groovy b/regression-test/suites/http_rest_api/post/test_query_stmt.groovy
index fe53fecd7bc..3001da2b15d 100644
--- a/regression-test/suites/http_rest_api/post/test_query_stmt.groovy
+++ b/regression-test/suites/http_rest_api/post/test_query_stmt.groovy
@@ -16,14 +16,64 @@
// under the License.
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
+import javax.net.ssl.*
+import java.security.KeyStore
+import java.security.SecureRandom
+import java.security.cert.X509Certificate
/**
* @Params url is "/xxx", data is request body
* @Return response body
*/
def http_post = { url, data = null ->
- def dst = "http://"+ context.config.feHttpAddress
+ def protocol = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ? "https" : "http"
+ def dst = "${protocol}://"+ context.config.feHttpAddress
+
+ // 配置 SSLContext
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false ){
+ def tlsVerifyMode = context.config.otherConfigs.get("tlsVerifyMode").toLowerCase()
+ SSLContext sslContext = SSLContext.getInstance("TLS")
+ def trustManagers = null
+ def keyManagers = null
+
+ if (tlsVerifyMode == 'none') {
+ trustManagers = [ [ checkClientTrusted: { c, a -> },
+ checkServerTrusted: { c, a -> },
+ getAcceptedIssuers: { [] as X509Certificate[] } ] as X509TrustManager ] as TrustManager[]
+ } else {
+ // 加载 TrustStore (CA 证书)
+ def trustStorePath = context.config.otherConfigs.get("trustStorePath")
+ def trustStorePwd = context.config.otherConfigs.get("trustStorePassword")
+
+ def trustStore = KeyStore.getInstance(context.config.otherConfigs.get("keyStoreType"))
+ trustStore.load(new FileInputStream(trustStorePath), trustStorePwd.toCharArray())
+ def tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm())
+ tmf.init(trustStore)
+ trustManagers = tmf.trustManagers
+
+ if (tlsVerifyMode == 'strict') {
+ // 加载客户端证书 (mTLS)
+ def keyStorePath = context.config.otherConfigs.get("keyStorePath")
+ def keyStorePwd = context.config.otherConfigs.get("keyStorePassword")
+
+ def keyStore = KeyStore.getInstance(context.config.otherConfigs.get("keyStoreType"))
+ keyStore.load(new FileInputStream(keyStorePath), keyStorePwd.toCharArray())
+ def kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm())
+ kmf.init(keyStore, keyStorePwd.toCharArray())
+ keyManagers = kmf.keyManagers
+ }
+ }
+ sslContext.init(keyManagers, trustManagers, new SecureRandom())
+ HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.socketFactory)
+
+ if ( tlsVerifyMode == "none") {
+ // 关闭 Hostname 验证
+ HttpsURLConnection.setDefaultHostnameVerifier({ hostname, session -> true })
+ }
+ }
+
def conn = new URL(dst + url).openConnection()
+ logger.info("request: " + dst + url)
conn.setRequestMethod("POST")
conn.setRequestProperty("Content-Type", "application/json")
conn.setRequestProperty("Authorization", "Basic cm9vdDo=")
@@ -54,6 +104,7 @@ suite("test_query_stmt") {
def resJson = http_post(url, stmt1_json)
def obj = new JsonSlurper().parseText(resJson)
+ logger.info("the res is " + obj.toString())
assertEquals(obj.msg, SUCCESS_MSG)
assertEquals(obj.code, SUCCESS_CODE)
def data = [[0],[1],[2],[3],[4],[5],[6],[7],[8],[9]];
@@ -108,3 +159,4 @@ suite("test_query_stmt") {
def resValue = http_post(url, stmt5)
assertTrue(resValue.contains("CREATE TABLE"))
}
+
diff --git a/regression-test/suites/inverted_index_p0/index_change/test_index_change_with_cumulative_compaction.groovy b/regression-test/suites/inverted_index_p0/index_change/test_index_change_with_cumulative_compaction.groovy
index ef2febe5266..09a66f6390c 100644
--- a/regression-test/suites/inverted_index_p0/index_change/test_index_change_with_cumulative_compaction.groovy
+++ b/regression-test/suites/inverted_index_p0/index_change/test_index_change_with_cumulative_compaction.groovy
@@ -59,11 +59,18 @@ suite("test_index_change_with_cumulative_compaction", "nonConcurrent") {
backend_id = backendId_to_backendIP.keySet()[0]
StringBuilder showConfigCommand = new StringBuilder();
- showConfigCommand.append("curl -X GET http://")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ showConfigCommand.append("curl -X GET ${protocol}://")
showConfigCommand.append(backendId_to_backendIP.get(backend_id))
showConfigCommand.append(":")
showConfigCommand.append(backendId_to_backendHttpPort.get(backend_id))
showConfigCommand.append("/api/show_config")
+ if (enableTls) {
+ showConfigCommand.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ showConfigCommand.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ showConfigCommand.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
logger.info(showConfigCommand.toString())
def process = showConfigCommand.toString().execute()
int code = process.waitFor()
@@ -165,6 +172,9 @@ suite("test_index_change_with_cumulative_compaction", "nonConcurrent") {
sb.append("curl -X GET ")
sb.append(tablet.CompactionStatus)
String command = sb.toString()
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
// wait for cleaning stale_rowsets
process = command.execute()
code = process.waitFor()
diff --git a/regression-test/suites/inverted_index_p0/index_change/test_index_change_with_full_compaction.groovy b/regression-test/suites/inverted_index_p0/index_change/test_index_change_with_full_compaction.groovy
index b5f2ce8eab8..5067f65c01f 100644
--- a/regression-test/suites/inverted_index_p0/index_change/test_index_change_with_full_compaction.groovy
+++ b/regression-test/suites/inverted_index_p0/index_change/test_index_change_with_full_compaction.groovy
@@ -35,11 +35,18 @@ suite("test_index_change_with_full_compaction") {
backend_id = backendId_to_backendIP.keySet()[0]
StringBuilder showConfigCommand = new StringBuilder();
- showConfigCommand.append("curl -X GET http://")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ showConfigCommand.append("curl -X GET ${protocol}://")
showConfigCommand.append(backendId_to_backendIP.get(backend_id))
showConfigCommand.append(":")
showConfigCommand.append(backendId_to_backendHttpPort.get(backend_id))
showConfigCommand.append("/api/show_config")
+ if (enableTls) {
+ showConfigCommand.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ showConfigCommand.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ showConfigCommand.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
logger.info(showConfigCommand.toString())
def process = showConfigCommand.toString().execute()
int code = process.waitFor()
@@ -142,6 +149,9 @@ suite("test_index_change_with_full_compaction") {
sb.append("curl -X GET ")
sb.append(tablet.CompactionStatus)
String command = sb.toString()
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
// wait for cleaning stale_rowsets
process = command.execute()
code = process.waitFor()
diff --git a/regression-test/suites/inverted_index_p0/index_format_v2/test_cumulative_compaction_with_format_v2.groovy b/regression-test/suites/inverted_index_p0/index_format_v2/test_cumulative_compaction_with_format_v2.groovy
index 24bcfb46ef0..32a1f6d6e76 100644
--- a/regression-test/suites/inverted_index_p0/index_format_v2/test_cumulative_compaction_with_format_v2.groovy
+++ b/regression-test/suites/inverted_index_p0/index_format_v2/test_cumulative_compaction_with_format_v2.groovy
@@ -47,6 +47,9 @@ suite("test_cumulative_compaction_with_format_v2", "inverted_index_format_v2") {
sb.append("curl -X GET ")
sb.append(tablet.CompactionStatus)
String command = sb.toString()
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
// wait for cleaning stale_rowsets
def process = command.execute()
def code = process.waitFor()
@@ -73,11 +76,18 @@ suite("test_cumulative_compaction_with_format_v2", "inverted_index_format_v2") {
backend_id = backendId_to_backendIP.keySet()[0]
StringBuilder showConfigCommand = new StringBuilder();
- showConfigCommand.append("curl -X GET http://")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ showConfigCommand.append("curl -X GET ${protocol}://")
showConfigCommand.append(backendId_to_backendIP.get(backend_id))
showConfigCommand.append(":")
showConfigCommand.append(backendId_to_backendHttpPort.get(backend_id))
showConfigCommand.append("/api/show_config")
+ if (enableTls) {
+ showConfigCommand.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ showConfigCommand.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ showConfigCommand.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
logger.info(showConfigCommand.toString())
def process = showConfigCommand.toString().execute()
int code = process.waitFor()
diff --git a/regression-test/suites/inverted_index_p0/index_format_v2/test_mor_table_with_format_v2.groovy b/regression-test/suites/inverted_index_p0/index_format_v2/test_mor_table_with_format_v2.groovy
index cb438df4142..4f8c99695b7 100644
--- a/regression-test/suites/inverted_index_p0/index_format_v2/test_mor_table_with_format_v2.groovy
+++ b/regression-test/suites/inverted_index_p0/index_format_v2/test_mor_table_with_format_v2.groovy
@@ -47,6 +47,9 @@ suite("test_mor_table_with_format_v2", "inverted_index_format_v2") {
sb.append("curl -X GET ")
sb.append(tablet.CompactionStatus)
String command = sb.toString()
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
// wait for cleaning stale_rowsets
def process = command.execute()
def code = process.waitFor()
@@ -73,11 +76,19 @@ suite("test_mor_table_with_format_v2", "inverted_index_format_v2") {
backend_id = backendId_to_backendIP.keySet()[0]
StringBuilder showConfigCommand = new StringBuilder();
- showConfigCommand.append("curl -X GET http://")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ showConfigCommand.append("curl -X GET ${protocol}://")
showConfigCommand.append(backendId_to_backendIP.get(backend_id))
showConfigCommand.append(":")
showConfigCommand.append(backendId_to_backendHttpPort.get(backend_id))
showConfigCommand.append("/api/show_config")
+ if (enableTls) {
+ showConfigCommand.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ showConfigCommand.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ showConfigCommand.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
+
logger.info(showConfigCommand.toString())
def process = showConfigCommand.toString().execute()
int code = process.waitFor()
diff --git a/regression-test/suites/inverted_index_p0/index_format_v2/test_mow_table_with_format_v2.groovy b/regression-test/suites/inverted_index_p0/index_format_v2/test_mow_table_with_format_v2.groovy
index 7d99de66f94..ea288d09679 100644
--- a/regression-test/suites/inverted_index_p0/index_format_v2/test_mow_table_with_format_v2.groovy
+++ b/regression-test/suites/inverted_index_p0/index_format_v2/test_mow_table_with_format_v2.groovy
@@ -43,10 +43,13 @@ suite("test_mow_table_with_format_v2", "inverted_index_format_v2") {
def calc_segment_count = { tablet ->
int segment_count = 0
String tablet_id = tablet.TabletId
- StringBuilder sb = new StringBuilder();
- sb.append("curl -X GET ")
- sb.append(tablet.CompactionStatus)
- String command = sb.toString()
+
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ String command = "curl -X GET " + tablet.CompactionStatus
+ if (enableTls) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
+ logger.info("command: ${command}")
// wait for cleaning stale_rowsets
def process = command.execute()
def code = process.waitFor()
@@ -70,22 +73,31 @@ suite("test_mow_table_with_format_v2", "inverted_index_format_v2") {
def backendId_to_backendIP = [:]
def backendId_to_backendHttpPort = [:]
getBackendIpHttpPort(backendId_to_backendIP, backendId_to_backendHttpPort);
-
backend_id = backendId_to_backendIP.keySet()[0]
- StringBuilder showConfigCommand = new StringBuilder();
- showConfigCommand.append("curl -X GET http://")
- showConfigCommand.append(backendId_to_backendIP.get(backend_id))
- showConfigCommand.append(":")
- showConfigCommand.append(backendId_to_backendHttpPort.get(backend_id))
- showConfigCommand.append("/api/show_config")
- logger.info(showConfigCommand.toString())
- def process = showConfigCommand.toString().execute()
- int code = process.waitFor()
- String err = IOGroovyMethods.getText(new BufferedReader(new InputStreamReader(process.getErrorStream())));
- String out = process.getText()
- logger.info("Show config: code=" + code + ", out=" + out + ", err=" + err)
- assertEquals(code, 0)
- def configList = parseJson(out.trim())
+
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ def cmd = [
+ "curl", "-X", "GET",
+ "${protocol}://${backendId_to_backendIP.get(backend_id)}:${backendId_to_backendHttpPort.get(backend_id)}/api/show_config"
+ ]
+
+ if (enableTls) {
+ cmd << "--cert" << context.config.otherConfigs.get("trustCert")
+ cmd << "--key" << context.config.otherConfigs.get("trustCAKey")
+ cmd << "--cacert" << context.config.otherConfigs.get("trustCACert")
+ }
+
+ logger.info("Executing command: ${cmd.join(' ')}")
+
+ def process = cmd.execute()
+ def output = new StringBuffer()
+ def errorOutput = new StringBuffer()
+ process.consumeProcessOutput(output, errorOutput)
+ int exitCode = process.waitFor()
+ logger.info("Show config: code=" + exitCode + ", out=" + output + ", err=" + errorOutput)
+ assertEquals(exitCode, 0)
+ def configList = parseJson(output.toString().trim())
assert configList instanceof List
boolean disableAutoCompaction = true
@@ -172,6 +184,9 @@ suite("test_mow_table_with_format_v2", "inverted_index_format_v2") {
String ip = backendId_to_backendIP.get(backend_id)
String port = backendId_to_backendHttpPort.get(backend_id)
be_show_tablet_status(ip, port, tablet_id)
+ def code
+ def out
+ def err
(code, out, err) = be_show_tablet_status(ip, port, tablet_id)
logger.info("Run show: code=" + code + ", out=" + out + ", err=" + err)
assertTrue(out.contains("[0-1]"))
diff --git a/regression-test/suites/inverted_index_p0/index_format_v2/test_single_replica_compaction_with_format_v2.groovy b/regression-test/suites/inverted_index_p0/index_format_v2/test_single_replica_compaction_with_format_v2.groovy
index 185fdd2e731..2d267cf31b2 100644
--- a/regression-test/suites/inverted_index_p0/index_format_v2/test_single_replica_compaction_with_format_v2.groovy
+++ b/regression-test/suites/inverted_index_p0/index_format_v2/test_single_replica_compaction_with_format_v2.groovy
@@ -53,6 +53,9 @@ suite("test_single_replica_compaction_with_format_v2", "inverted_index_format_v2
sb.append("curl -X GET ")
sb.append(tablet.CompactionStatus)
String command = sb.toString()
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
// wait for cleaning stale_rowsets
def process = command.execute()
def code = process.waitFor()
@@ -77,11 +80,18 @@ suite("test_single_replica_compaction_with_format_v2", "inverted_index_format_v2
backend_id = backendId_to_backendIP.keySet()[0]
StringBuilder showConfigCommand = new StringBuilder();
- showConfigCommand.append("curl -X GET http://")
+ Boolean enableTls = (context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false
+ def protocol = enableTls ? "https" : "http"
+ showConfigCommand.append("curl -X GET ${protocol}://")
showConfigCommand.append(backendId_to_backendIP.get(backend_id))
showConfigCommand.append(":")
showConfigCommand.append(backendId_to_backendHttpPort.get(backend_id))
showConfigCommand.append("/api/show_config")
+ if (enableTls) {
+ showConfigCommand.append(" --cert ${context.config.otherConfigs.get("trustCert")}")
+ showConfigCommand.append(" --key ${context.config.otherConfigs.get("trustCAKey")}")
+ showConfigCommand.append(" --cacert ${context.config.otherConfigs.get("trustCACert")}")
+ }
logger.info(showConfigCommand.toString())
def process = showConfigCommand.toString().execute()
int code = process.waitFor()
diff --git a/regression-test/suites/inverted_index_p0/test_arrayInvertedIdx_profile.groovy b/regression-test/suites/inverted_index_p0/test_arrayInvertedIdx_profile.groovy
index ffa0e93bb67..5a60541f4a1 100644
--- a/regression-test/suites/inverted_index_p0/test_arrayInvertedIdx_profile.groovy
+++ b/regression-test/suites/inverted_index_p0/test_arrayInvertedIdx_profile.groovy
@@ -18,6 +18,7 @@
import groovy.json.JsonSlurper
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.apache.doris.regression.action.ProfileAction
suite("test_arrayInvertedIdx_profile", "nonConcurrent"){
// prepare test table
@@ -34,22 +35,21 @@ suite("test_arrayInvertedIdx_profile", "nonConcurrent"){
def checkRowsInvertedIndexFilter = { sql, expectedRowsInvertedIndexFiltered ->
order_qt_sql sql
- def profileUrl = '/rest/v1/query_profile/'
- def profiles = httpGet(profileUrl)
+ def profileAction = new ProfileAction(context)
+ def profiles = profileAction.getProfileList()
log.debug("profiles:{}", profiles);
- profiles = new JsonSlurper().parseText(profiles)
- assertEquals(0, profiles.code)
+ assertTrue(profiles.size() > 0)
def profileId = null;
- for (def profile in profiles["data"]["rows"]) {
+ for (def profile in profiles) {
if (profile["Sql Statement"].contains(sql)) {
profileId = profile["Profile ID"]
break;
}
}
log.info("profileId:{}", profileId);
- def profileDetail = httpGet("/rest/v1/query_profile/" + profileId)
- String regex = "RowsInvertedIndexFiltered: (\\d+)"
+ def profileDetail = profileAction.getProfile(profileId)
+ String regex = "RowsInvertedIndexFiltered: (\\d+)"
Pattern pattern = Pattern.compile(regex)
Matcher matcher = pattern.matcher(profileDetail)
while (matcher.find()) {
diff --git a/regression-test/suites/load_p0/stream_load/test_get_stream_load_state.groovy b/regression-test/suites/load_p0/stream_load/test_get_stream_load_state.groovy
index 7bba1394bf3..7914978a0d0 100644
--- a/regression-test/suites/load_p0/stream_load/test_get_stream_load_state.groovy
+++ b/regression-test/suites/load_p0/stream_load/test_get_stream_load_state.groovy
@@ -58,6 +58,9 @@ suite("test_get_stream_load_state", "p0") {
}
def command = "curl --location-trusted -u ${context.config.feHttpUser}:${context.config.feHttpPassword} http://${context.config.feHttpAddress}/api/${db}/get_load_state?label=${label}"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
log.info("test_get_stream_load_state: ${command}")
def process = command.execute()
def code = process.waitFor()
@@ -69,10 +72,13 @@ suite("test_get_stream_load_state", "p0") {
def label1 = UUID.randomUUID().toString().replaceAll("-", "")
command = "curl --location-trusted -u ${context.config.feHttpUser}:${context.config.feHttpPassword} http://${context.config.feHttpAddress}/api/${db}/get_load_state?label=${label1}"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
log.info("test_get_stream_load_state: ${command}")
process = command.execute()
code = process.waitFor()
out = process.text
json = parseJson(out)
log.info("test_get_stream_load_state: ${out}".toString())
-}
\ No newline at end of file
+}
diff --git a/regression-test/suites/load_p0/stream_load/test_group_commit_stream_load_with_nonexist_db_and_table.groovy b/regression-test/suites/load_p0/stream_load/test_group_commit_stream_load_with_nonexist_db_and_table.groovy
index 8fd63814715..5c2be2d7a19 100644
--- a/regression-test/suites/load_p0/stream_load/test_group_commit_stream_load_with_nonexist_db_and_table.groovy
+++ b/regression-test/suites/load_p0/stream_load/test_group_commit_stream_load_with_nonexist_db_and_table.groovy
@@ -25,6 +25,9 @@ suite("test_group_commit_stream_load_with_nonexist_db_and_table") {
" -H column_separator:," +
" -T ${context.config.dataPath}/load_p0/stream_load/test_stream_load1.csv" +
" http://${context.config.feHttpAddress}/api/${tableName}/${tableName}/_stream_load"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
log.info("stream load command: ${command}")
def process = command.execute()
diff --git a/regression-test/suites/load_p0/stream_load/test_group_commit_wal_limit.groovy b/regression-test/suites/load_p0/stream_load/test_group_commit_wal_limit.groovy
index 7361faf72df..cf094146fff 100644
--- a/regression-test/suites/load_p0/stream_load/test_group_commit_wal_limit.groovy
+++ b/regression-test/suites/load_p0/stream_load/test_group_commit_wal_limit.groovy
@@ -47,6 +47,9 @@ suite("test_group_commit_wal_limit") {
strBuilder.append(" http://" + context.config.feHttpAddress + "/api/${db}/${tableName}/_stream_load")
String command = strBuilder.toString()
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
logger.info("command is " + command)
def process = ['bash','-c',command].execute()
def code = process.waitFor()
@@ -66,6 +69,9 @@ suite("test_group_commit_wal_limit") {
strBuilder.append(" http://" + context.config.feHttpAddress + "/api/_http_stream")
command = strBuilder.toString()
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
logger.info("command is " + command)
process = ['bash','-c',command].execute()
code = process.waitFor()
diff --git a/regression-test/suites/load_p0/stream_load/test_json_load.groovy b/regression-test/suites/load_p0/stream_load/test_json_load.groovy
index 97cfbb322b4..13b45bb2c65 100644
--- a/regression-test/suites/load_p0/stream_load/test_json_load.groovy
+++ b/regression-test/suites/load_p0/stream_load/test_json_load.groovy
@@ -972,4 +972,4 @@ suite("test_json_load", "p0,nonConcurrent") {
} finally {
// try_sql("DROP TABLE IF EXISTS ${testTable}")
}
-}
+}
\ No newline at end of file
diff --git a/regression-test/suites/load_p0/stream_load/test_load_with_transfer_encoding.groovy b/regression-test/suites/load_p0/stream_load/test_load_with_transfer_encoding.groovy
index 260c205e656..2926b5e2fc0 100644
--- a/regression-test/suites/load_p0/stream_load/test_load_with_transfer_encoding.groovy
+++ b/regression-test/suites/load_p0/stream_load/test_load_with_transfer_encoding.groovy
@@ -101,6 +101,9 @@ suite("test_load_with_transfer_encoding", "p0") {
}
def command = """curl --location-trusted -u ${context.config.feHttpUser}:${context.config.feHttpPassword} -H read_json_by_line:false -H Expect:100-continue -H max_filter_ratio:1 -H strict_mode:false -H strip_outer_array:true -H columns:id,created,creater,deleted,updated,card_id,card_type_id,card_type_name,cash_balance,cashier_id,client_id,cost,creater_name,details,id_name,id_number,last_client_id,login_id,operation_type,place_id,present,present_balance,remark,shift_id,source_type [...]
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
log.info("stream load: ${command}")
def process = command.execute()
def code = process.waitFor()
diff --git a/regression-test/suites/load_p0/stream_load/test_publish_timeout.groovy b/regression-test/suites/load_p0/stream_load/test_publish_timeout.groovy
index af13b063b06..049d717f406 100644
--- a/regression-test/suites/load_p0/stream_load/test_publish_timeout.groovy
+++ b/regression-test/suites/load_p0/stream_load/test_publish_timeout.groovy
@@ -44,8 +44,13 @@ suite("test_publish_timeout", "nonConcurrent") {
for (String id in backendId_to_backendIP.keySet()) {
def beIp = backendId_to_backendIP.get(id)
def bePort = backendId_to_backendHttpPort.get(id)
- def (code, out, err) = curl("POST", String.format("http://%s:%s/api/update_config?%s=%s", beIp, bePort, paramName, paramValue))
- assertTrue(out.contains("OK"))
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ def (code, out, err) = curl("POST", String.format("https://%s:%s/api/update_config?%s=%s", beIp, bePort, paramName, paramValue) + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ assertTrue(out.contains("OK"))
+ } else {
+ def (code, out, err) = curl("POST", String.format("http://%s:%s/api/update_config?%s=%s", beIp, bePort, paramName, paramValue))
+ assertTrue(out.contains("OK"))
+ }
}
}
diff --git a/regression-test/suites/load_p0/stream_load/test_s3_bytes_written_metrics.groovy b/regression-test/suites/load_p0/stream_load/test_s3_bytes_written_metrics.groovy
index 88d5461a7ae..1fd7de8e51e 100644
--- a/regression-test/suites/load_p0/stream_load/test_s3_bytes_written_metrics.groovy
+++ b/regression-test/suites/load_p0/stream_load/test_s3_bytes_written_metrics.groovy
@@ -23,6 +23,9 @@ suite("test_s3_bytes_written_metrics", "p0") {
def tableName = "test_s3_bytes_written_metrics"
def getBrpcMetrics = {ip, port, name ->
def url = "http://${ip}:${port}/brpc_metrics"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ url = url.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def metrics = new URL(url).text
def matcher = metrics =~ ~"${name}\\s+(\\d+)"
if (matcher.find()) {
diff --git a/regression-test/suites/load_p0/stream_load/test_stream_load.groovy b/regression-test/suites/load_p0/stream_load/test_stream_load.groovy
index 856a5152333..1b3877303df 100644
--- a/regression-test/suites/load_p0/stream_load/test_stream_load.groovy
+++ b/regression-test/suites/load_p0/stream_load/test_stream_load.groovy
@@ -1234,98 +1234,100 @@ suite("test_stream_load", "p0") {
}
}
}
-
- try {
- sql """ DROP TABLE IF EXISTS ${tableName15} """
- sql """
- CREATE TABLE IF NOT EXISTS ${tableName15} (
- `k1` bigint(20) NULL DEFAULT "1",
- `k2` bigint(20) NULL ,
- `v1` tinyint(4) NULL,
- `v2` tinyint(4) NULL,
- `v3` tinyint(4) NULL,
- `v4` DATETIME NULL
- ) ENGINE=OLAP
- DISTRIBUTED BY HASH(`k1`) BUCKETS 3
- PROPERTIES ("replication_allocation" = "tag.location.default: 1");
- """
-
- def label = UUID.randomUUID().toString().replaceAll("-", "")
- streamLoad {
- table "${tableName15}"
-
- set 'label', "${label}"
- set 'column_separator', '|'
- set 'columns', 'k1, k2, v1, v2, v3'
- set 'two_phase_commit', 'true'
-
- file 'test_two_phase_commit.csv'
-
- check { result, exception, startTime, endTime ->
- if (exception != null) {
- throw exception
+ if (!isCloudMode()) {
+ try {
+ sql """ DROP TABLE IF EXISTS ${tableName15} """
+ sql """
+ CREATE TABLE IF NOT EXISTS ${tableName15} (
+ `k1` bigint(20) NULL DEFAULT "1",
+ `k2` bigint(20) NULL ,
+ `v1` tinyint(4) NULL,
+ `v2` tinyint(4) NULL,
+ `v3` tinyint(4) NULL,
+ `v4` DATETIME NULL
+ ) ENGINE=OLAP
+ DISTRIBUTED BY HASH(`k1`) BUCKETS 3
+ PROPERTIES ("replication_allocation" = "tag.location.default: 1");
+ """
+
+ def label = UUID.randomUUID().toString().replaceAll("-", "")
+ streamLoad {
+ table "${tableName15}"
+
+ set 'label', "${label}"
+ set 'column_separator', '|'
+ set 'columns', 'k1, k2, v1, v2, v3'
+ set 'two_phase_commit', 'true'
+
+ file 'test_two_phase_commit.csv'
+
+ check { result, exception, startTime, endTime ->
+ if (exception != null) {
+ throw exception
+ }
+ log.info("Stream load result: ${result}".toString())
+ def json = parseJson(result)
+ assertEquals("success", json.Status.toLowerCase())
+ assertTrue(!result.contains("ErrorURL"))
+ assertEquals(2, json.NumberTotalRows)
+ assertEquals(0, json.NumberFilteredRows)
+ assertEquals(0, json.NumberUnselectedRows)
}
- log.info("Stream load result: ${result}".toString())
- def json = parseJson(result)
- assertEquals("success", json.Status.toLowerCase())
- assertTrue(!result.contains("ErrorURL"))
- assertEquals(2, json.NumberTotalRows)
- assertEquals(0, json.NumberFilteredRows)
- assertEquals(0, json.NumberUnselectedRows)
}
- }
-
- qt_sql_2pc "select * from ${tableName15} order by k1"
-
- do_streamload_2pc.call(label, "abort")
+
+ qt_sql_2pc "select * from ${tableName15} order by k1"
- qt_sql_2pc_abort "select * from ${tableName15} order by k1"
+ do_streamload_2pc.call(label, "abort")
- streamLoad {
- table "${tableName15}"
+ qt_sql_2pc_abort "select * from ${tableName15} order by k1"
- set 'label', "${label}"
- set 'column_separator', '|'
- set 'columns', 'k1, k2, v1, v2, v3'
- set 'two_phase_commit', 'true'
+ streamLoad {
+ table "${tableName15}"
+
+ set 'label', "${label}"
+ set 'column_separator', '|'
+ set 'columns', 'k1, k2, v1, v2, v3'
+ set 'two_phase_commit', 'true'
- file 'test_two_phase_commit.csv'
+ file 'test_two_phase_commit.csv'
- check { result, exception, startTime, endTime ->
- if (exception != null) {
- throw exception
+ check { result, exception, startTime, endTime ->
+ if (exception != null) {
+ throw exception
+ }
+ log.info("Stream load result: ${result}".toString())
+ def json = parseJson(result)
+ assertEquals("success", json.Status.toLowerCase())
+ assertTrue(!result.contains("ErrorURL"))
+ assertEquals(2, json.NumberTotalRows)
+ assertEquals(0, json.NumberFilteredRows)
+ assertEquals(0, json.NumberUnselectedRows)
}
- log.info("Stream load result: ${result}".toString())
- def json = parseJson(result)
- assertEquals("success", json.Status.toLowerCase())
- assertTrue(!result.contains("ErrorURL"))
- assertEquals(2, json.NumberTotalRows)
- assertEquals(0, json.NumberFilteredRows)
- assertEquals(0, json.NumberUnselectedRows)
- }
- }
-
- do_streamload_2pc.call(label, "commit")
-
- def count = 0
- while (true) {
- res = sql "select count(*) from ${tableName15}"
- if (res[0][0] > 0) {
- break
}
- if (count >= 60) {
- log.error("stream load commit can not visible for long time")
- assertEquals(2, res[0][0])
- break
+
+ do_streamload_2pc.call(label, "commit")
+
+ def count = 0
+ while (true) {
+ res = sql "select count(*) from ${tableName15}"
+ if (res[0][0] > 0) {
+ break
+ }
+ if (count >= 60) {
+ log.error("stream load commit can not visible for long time")
+ assertEquals(2, res[0][0])
+ break
+ }
+ sleep(1000)
+ count++
}
- sleep(1000)
- count++
+
+ qt_sql_2pc_commit "select * from ${tableName15} order by k1"
+ } finally {
+ sql """ DROP TABLE IF EXISTS ${tableName15} FORCE"""
}
- qt_sql_2pc_commit "select * from ${tableName15} order by k1"
- } finally {
- sql """ DROP TABLE IF EXISTS ${tableName15} FORCE"""
- }
+ }
// test chunked transfer
def tableName16 = "test_chunked_transfer"
@@ -1345,6 +1347,9 @@ suite("test_stream_load", "p0") {
"""
def command = "curl --location-trusted -u ${context.config.feHttpUser}:${context.config.feHttpPassword} -H column_separator:| -H Transfer-Encoding:chunked -H columns:k1,k2,v1,v2,v3 -T ${context.dataPath}/test_chunked_transfer.csv http://${context.config.feHttpAddress}/api/${db}/${tableName16}/_stream_load"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
log.info("test chunked transfer command: ${command}")
def process = command.execute()
def code = process.waitFor()
@@ -1373,6 +1378,9 @@ suite("test_stream_load", "p0") {
"""
def command = "curl --location-trusted -u ${context.config.feHttpUser}:${context.config.feHttpPassword} -H Transfer-Encoding:chunked -H format:json -H read_json_by_line:true -T ${context.dataPath}/test_chunked_transfer.json http://${context.config.feHttpAddress}/api/${db}/${tableName16}/_stream_load"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
log.info("test chunked transfer command: ${command}")
def process = command.execute()
def code = process.waitFor()
@@ -1654,6 +1662,9 @@ suite("test_stream_load", "p0") {
"""
def command = "curl --location-trusted -u ${context.config.feHttpUser}:${context.config.feHttpPassword} -H column_separator:| -H ${db}:${tableName16} -H Content-Length:0 -H Transfer-Encoding:chunked -H columns:k1,k2,v1,v2,v3 -T ${context.dataPath}/test_chunked_transfer.csv http://${beHost}:${beHttpPort}/api/${db}/${tableName16}/_stream_load"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
log.info("test chunked transfer command: ${command}")
def process = command.execute()
def code = process.waitFor()
@@ -1684,6 +1695,9 @@ suite("test_stream_load", "p0") {
"""
def command = "curl --location-trusted -u ${context.config.feHttpUser}:${context.config.feHttpPassword} -H column_separator:| -H ${db}:${tableName16} -H Content-Length: -H Transfer-Encoding: -T ${context.dataPath}/test_chunked_transfer.csv http://${beHost}:${beHttpPort}/api/${db}/${tableName16}/_stream_load"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
log.info("test chunked transfer command: ${command}")
def process = command.execute()
def code = process.waitFor()
@@ -1698,3 +1712,4 @@ suite("test_stream_load", "p0") {
}
+
diff --git a/regression-test/suites/load_p0/stream_load/test_stream_load_2pc.groovy b/regression-test/suites/load_p0/stream_load/test_stream_load_2pc.groovy
index fd03f40b9b1..fe8d51c61f5 100644
--- a/regression-test/suites/load_p0/stream_load/test_stream_load_2pc.groovy
+++ b/regression-test/suites/load_p0/stream_load/test_stream_load_2pc.groovy
@@ -341,8 +341,12 @@ suite("test_stream_load_2pc", "p0") {
def do_streamload_2pc_commit_by_label = { label, tbl ->
def command = "curl -X PUT --location-trusted -u ${context.config.feHttpUser}:${context.config.feHttpPassword}" +
" -H label:${label}" +
- " -H txn_operation:commit" +
- " http://${context.config.feHttpAddress}/api/${db}/${tbl}/_stream_load_2pc"
+ " -H txn_operation:commit"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command + " https://${context.config.feHttpAddress}/api/${db}/${tbl}/_stream_load_2pc" + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ } else {
+ command = command + " http://${context.config.feHttpAddress}/api/${db}/${tbl}/_stream_load_2pc"
+ }
log.info("http_stream execute 2pc: ${command}")
def process = command.execute()
@@ -356,8 +360,12 @@ suite("test_stream_load_2pc", "p0") {
def do_streamload_2pc_commit_by_txn_id = { txnId, tbl ->
def command = "curl -X PUT --location-trusted -u ${context.config.feHttpUser}:${context.config.feHttpPassword}" +
" -H txn_id:${txnId}" +
- " -H txn_operation:commit" +
- " http://${context.config.feHttpAddress}/api/${db}/${tbl}/_stream_load_2pc"
+ " -H txn_operation:commit"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command + " https://${context.config.feHttpAddress}/api/${db}/${tbl}/_stream_load_2pc" + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ } else {
+ command = command + " http://${context.config.feHttpAddress}/api/${db}/${tbl}/_stream_load_2pc"
+ }
log.info("http_stream execute 2pc: ${command}")
def process = command.execute()
diff --git a/regression-test/suites/load_p0/stream_load/test_stream_load_2pc_with_schema_change.groovy b/regression-test/suites/load_p0/stream_load/test_stream_load_2pc_with_schema_change.groovy
index 17104133f7d..1cff1c13a36 100644
--- a/regression-test/suites/load_p0/stream_load/test_stream_load_2pc_with_schema_change.groovy
+++ b/regression-test/suites/load_p0/stream_load/test_stream_load_2pc_with_schema_change.groovy
@@ -27,6 +27,9 @@ suite("test_stream_load_2pc_with_schema_change", "p0") {
" -H txn_id:${txnId}" +
" -H txn_operation:commit" +
" http://${context.config.feHttpAddress}/api/${db}/${tableName}/_stream_load_2pc"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
log.info("http_stream execute 2pc: ${command}")
def process = command.execute()
diff --git a/regression-test/suites/load_p0/stream_load/test_stream_load_err_log_limit.groovy b/regression-test/suites/load_p0/stream_load/test_stream_load_err_log_limit.groovy
index a2af1e72c55..3fbcd2c46c8 100644
--- a/regression-test/suites/load_p0/stream_load/test_stream_load_err_log_limit.groovy
+++ b/regression-test/suites/load_p0/stream_load/test_stream_load_err_log_limit.groovy
@@ -39,8 +39,13 @@ suite("test_stream_load_err_log_limit", "p0, nonConcurrent") {
for (String id in backendId_to_backendIP.keySet()) {
def beIp = backendId_to_backendIP.get(id)
def bePort = backendId_to_backendHttpPort.get(id)
- def (code, out, err) = curl("POST", String.format("http://%s:%s/api/update_config?%s=%s", beIp, bePort, paramName, paramValue))
- assertTrue(out.contains("OK"))
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ def (code, out, err) = curl("POST", String.format("https://%s:%s/api/update_config?%s=%s", beIp, bePort, paramName, paramValue) + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ assertTrue(out.contains("OK"))
+ } else {
+ def (code, out, err) = curl("POST", String.format("http://%s:%s/api/update_config?%s=%s", beIp, bePort, paramName, paramValue))
+ assertTrue(out.contains("OK"))
+ }
}
}
diff --git a/regression-test/suites/load_p0/stream_load/test_stream_load_properties.groovy b/regression-test/suites/load_p0/stream_load/test_stream_load_properties.groovy
index 1987059ffde..2db68506333 100644
--- a/regression-test/suites/load_p0/stream_load/test_stream_load_properties.groovy
+++ b/regression-test/suites/load_p0/stream_load/test_stream_load_properties.groovy
@@ -1140,4 +1140,4 @@ suite("test_stream_load_properties", "p0") {
sql new File("""${context.file.parent}/ddl/${tableName}_drop.sql""").text
}
}
-}
+}
\ No newline at end of file
diff --git a/regression-test/suites/manager/test_manager_interface_1.groovy b/regression-test/suites/manager/test_manager_interface_1.groovy
index 10108bd588e..e3804014f35 100644
--- a/regression-test/suites/manager/test_manager_interface_1.groovy
+++ b/regression-test/suites/manager/test_manager_interface_1.groovy
@@ -32,10 +32,18 @@ suite('test_manager_interface_1',"p0") {
sql """ switch internal """
-
String jdbcUrl = context.config.jdbcUrl
def tokens = context.config.jdbcUrl.split('/')
jdbcUrl=tokens[0] + "//" + tokens[2] + "/" + "?"
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false ){
+ String useSslconfig = "useSSL=true&requireSSL=true&verifyServerCertificate=true"
+ String clientCAKey = "clientCertificateKeyStoreUrl=file:" + context.config.otherConfigs.get("keyStorePath")
+ String clientCAPwd = "clientCertificateKeyStorePassword=" + context.config.otherConfigs.get("keyStorePassword")
+ String trustCAKey = "trustCertificateKeyStoreUrl=file:" + context.config.otherConfigs.get("trustStorePath")
+ String trustCAPwd = "trustCertificateKeyStorePassword=" + context.config.otherConfigs.get("trustStorePassword")
+ String tlsUrl = useSslconfig + "&" + clientCAKey + "&" + clientCAPwd + "&" + trustCAKey + "&" + trustCA
+ jdbcUrl += tlsUrl
+ }
String jdbcUser = context.config.jdbcUser
String jdbcPassword = context.config.jdbcPassword
String s3_endpoint = getS3Endpoint()
diff --git a/regression-test/suites/metrics_p0/test_delete_bitmap_metrics.groovy b/regression-test/suites/metrics_p0/test_delete_bitmap_metrics.groovy
index a74d5ffb6e4..80f7da957ef 100644
--- a/regression-test/suites/metrics_p0/test_delete_bitmap_metrics.groovy
+++ b/regression-test/suites/metrics_p0/test_delete_bitmap_metrics.groovy
@@ -71,6 +71,9 @@ suite("test_delete_bitmap_metrics", "p0") {
sb.append(tablet_id)
String command = sb.toString()
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
logger.info(command)
def process = command.execute()
def code = process.waitFor()
diff --git a/regression-test/suites/mysql_ssl_p0/test_mysql_connection.groovy b/regression-test/suites/mysql_ssl_p0/test_mysql_connection.groovy
index 68fbe46dfe3..3999853e66d 100644
--- a/regression-test/suites/mysql_ssl_p0/test_mysql_connection.groovy
+++ b/regression-test/suites/mysql_ssl_p0/test_mysql_connection.groovy
@@ -37,23 +37,27 @@ suite("test_mysql_connection") { suite ->
String tempString = jdbcUrlConfig.substring(jdbcUrlConfig.indexOf("jdbc:mysql://") + 13);
String mysqlHost = tempString.substring(0, tempString.indexOf(":"));
String mysqlPort = tempString.substring(tempString.indexOf(":") + 1, tempString.indexOf("/"));
- String cmdDefault = "mysql -uroot -h" + mysqlHost + " -P" + mysqlPort + " -e \"show variables\"";
- String cmdDisabledSsl = "mysql --ssl-mode=DISABLE -uroot -h" + mysqlHost + " -P" + mysqlPort + " -e \"show variables\"";
- String cmdSsl12 = "mysql --ssl-mode=REQUIRED -uroot -h" + mysqlHost + " -P" + mysqlPort + " --tls-version=TLSv1.2 -e \"show variables\"";
- // client verifies server certificate
- String cmdv1 = "mysql --ssl-mode=VERIFY_CA --ssl-ca=" + context.config.sslCertificatePath + "/ca.pem -uroot -h" + mysqlHost + " -P" + mysqlPort + " --tls-version=TLSv1.2 -e \"show variables\"";
-
- // two-way ssl auth (client and server both verify their respective certificates)
- String cmdv2 = "mysql --ssl-mode=VERIFY_CA --ssl-ca=" + context.config.sslCertificatePath + "/ca.pem \
- --ssl-cert=" + context.config.sslCertificatePath + "/client-cert.pem \
- --ssl-key=" + context.config.sslCertificatePath + "/client-key.pem -uroot -h" + mysqlHost + " -P" + mysqlPort + " --tls-version=TLSv1.2 -e \"show variables\"";
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
- // The current mysql-client version of the test environment is 5.7.32, which does not support TLSv1.3, so comment this part.
- // String cmdSsl13 = "mysql --ssl-mode=REQUIRED -uroot -h" + mysqlHost + " -P" + mysqlPort + " --tls-version=TLSv1.3 -e \"show variables\"";
- executeMySQLCommand(cmdDefault);
- executeMySQLCommand(cmdDisabledSsl);
- executeMySQLCommand(cmdSsl12);
- // executeMySQLCommand(cmdSsl13);
- executeMySQLCommand(cmdv1);
- executeMySQLCommand(cmdv2);
+ } else {
+ String cmdDefault = "mysql -uroot -h" + mysqlHost + " -P" + mysqlPort + " -e \"show variables\"";
+ String cmdDisabledSsl = "mysql --ssl-mode=DISABLE -uroot -h" + mysqlHost + " -P" + mysqlPort + " -e \"show variables\"";
+ String cmdSsl12 = "mysql --ssl-mode=REQUIRED -uroot -h" + mysqlHost + " -P" + mysqlPort + " --tls-version=TLSv1.2 -e \"show variables\"";
+ // client verifies server certificate
+ String cmdv1 = "mysql --ssl-mode=VERIFY_CA --ssl-ca=" + context.config.sslCertificatePath + "/ca.pem -uroot -h" + mysqlHost + " -P" + mysqlPort + " --tls-version=TLSv1.2 -e \"show variables\"";
+
+ // two-way ssl auth (client and server both verify their respective certificates)
+ String cmdv2 = "mysql --ssl-mode=VERIFY_CA --ssl-ca=" + context.config.sslCertificatePath + "/ca.pem \
+ --ssl-cert=" + context.config.sslCertificatePath + "/client-cert.pem \
+ --ssl-key=" + context.config.sslCertificatePath + "/client-key.pem -uroot -h" + mysqlHost + " -P" + mysqlPort + " --tls-version=TLSv1.2 -e \"show variables\"";
+
+ // The current mysql-client version of the test environment is 5.7.32, which does not support TLSv1.3, so comment this part.
+ // String cmdSsl13 = "mysql --ssl-mode=REQUIRED -uroot -h" + mysqlHost + " -P" + mysqlPort + " --tls-version=TLSv1.3 -e \"show variables\"";
+ executeMySQLCommand(cmdDefault);
+ executeMySQLCommand(cmdDisabledSsl);
+ executeMySQLCommand(cmdSsl12);
+ // executeMySQLCommand(cmdSsl13);
+ executeMySQLCommand(cmdv1);
+ executeMySQLCommand(cmdv2);
+ }
}
diff --git a/regression-test/suites/nereids_p0/aggregate/window_funnel.groovy b/regression-test/suites/nereids_p0/aggregate/window_funnel.groovy
index 186e65461da..71188cfbac1 100644
--- a/regression-test/suites/nereids_p0/aggregate/window_funnel.groovy
+++ b/regression-test/suites/nereids_p0/aggregate/window_funnel.groovy
@@ -112,6 +112,9 @@ suite("window_funnel") {
strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe?conf_item=be_exec_version")
def command = strBuilder.toString()
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
def process = command.toString().execute()
def code = process.waitFor()
def err = IOGroovyMethods.getText(new BufferedReader(new InputStreamReader(process.getErrorStream())));
diff --git a/regression-test/suites/nereids_p0/authorization/column_authorization.groovy b/regression-test/suites/nereids_p0/authorization/column_authorization.groovy
index 5c01d54ad56..5de6d9b9e25 100644
--- a/regression-test/suites/nereids_p0/authorization/column_authorization.groovy
+++ b/regression-test/suites/nereids_p0/authorization/column_authorization.groovy
@@ -54,7 +54,12 @@ suite("column_authorization") {
sql 'sync'
- def defaultDbUrl = context.config.jdbcUrl.substring(0, context.config.jdbcUrl.lastIndexOf("/"))
+ def url = context.config.jdbcUrl
+ def thirdSlashIndex = url.findIndexOf(0) { it == '/' } // 第一个 /
+ thirdSlashIndex = url.findIndexOf(thirdSlashIndex + 1) { it == '/' } // 第二个 /
+ thirdSlashIndex = url.findIndexOf(thirdSlashIndex + 1) { it == '/' } // 第三个 /
+ def questionIndex = url.indexOf('?')
+ def defaultDbUrl = url[0..thirdSlashIndex] + url.substring(questionIndex)
logger.info("connect to ${defaultDbUrl}".toString())
connect(user1, null, defaultDbUrl) {
sql "set enable_fallback_to_original_planner=false"
diff --git a/regression-test/suites/nereids_p0/authorization/view_authorization.groovy b/regression-test/suites/nereids_p0/authorization/view_authorization.groovy
index fa7f56c1e09..5ddff02514b 100644
--- a/regression-test/suites/nereids_p0/authorization/view_authorization.groovy
+++ b/regression-test/suites/nereids_p0/authorization/view_authorization.groovy
@@ -57,7 +57,12 @@ suite("view_authorization") {
sql 'sync'
- def defaultDbUrl = context.config.jdbcUrl.substring(0, context.config.jdbcUrl.lastIndexOf("/"))
+ def url = context.config.jdbcUrl
+ def thirdSlashIndex = url.findIndexOf(0) { it == '/' } // 第一个 /
+ thirdSlashIndex = url.findIndexOf(thirdSlashIndex + 1) { it == '/' } // 第二个 /
+ thirdSlashIndex = url.findIndexOf(thirdSlashIndex + 1) { it == '/' } // 第三个 /
+ def questionIndex = url.indexOf('?')
+ def defaultDbUrl = url[0..thirdSlashIndex] + url.substring(questionIndex)
logger.info("connect to ${defaultDbUrl}".toString())
connect(user1, null, defaultDbUrl) {
sql "set enable_fallback_to_original_planner=false"
diff --git a/regression-test/suites/nereids_p0/outfile/test_outfile.groovy b/regression-test/suites/nereids_p0/outfile/test_outfile.groovy
index 6a7be107510..23e5a0be7ca 100644
--- a/regression-test/suites/nereids_p0/outfile/test_outfile.groovy
+++ b/regression-test/suites/nereids_p0/outfile/test_outfile.groovy
@@ -31,7 +31,12 @@ suite("test_outfile") {
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
def process = command.toString().execute()
diff --git a/regression-test/suites/nereids_p0/outfile/test_outfile_csv_with_names.groovy b/regression-test/suites/nereids_p0/outfile/test_outfile_csv_with_names.groovy
index 3fe4a99d79e..408a09d9fb3 100644
--- a/regression-test/suites/nereids_p0/outfile/test_outfile_csv_with_names.groovy
+++ b/regression-test/suites/nereids_p0/outfile/test_outfile_csv_with_names.groovy
@@ -31,7 +31,12 @@ suite("test_outfile_csv_with_names") {
sql "USE $dbName"
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
def process = command.toString().execute()
@@ -150,6 +155,9 @@ suite("test_outfile_csv_with_names") {
commandBuilder.append("""curl -v --location-trusted -u ${context.config.feHttpUser}:${context.config.feHttpPassword}""")
commandBuilder.append(""" -H format:csv_with_names -H column_separator:, -T """ + files[0].getAbsolutePath() + """ http://${context.config.feHttpAddress}/api/""" + dbName + "/" + tableName2 + "/_stream_load")
command = commandBuilder.toString()
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
process = command.execute()
code = process.waitFor()
err = IOGroovyMethods.getText(new BufferedReader(new InputStreamReader(process.getErrorStream())))
diff --git a/regression-test/suites/nereids_p0/outfile/test_outfile_expr.groovy b/regression-test/suites/nereids_p0/outfile/test_outfile_expr.groovy
index 9429906ec3c..23d9260a81a 100644
--- a/regression-test/suites/nereids_p0/outfile/test_outfile_expr.groovy
+++ b/regression-test/suites/nereids_p0/outfile/test_outfile_expr.groovy
@@ -31,7 +31,12 @@ suite("test_outfile_expr") {
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
def process = command.toString().execute()
diff --git a/regression-test/suites/nereids_p0/outfile/test_outfile_parquet.groovy b/regression-test/suites/nereids_p0/outfile/test_outfile_parquet.groovy
index cdc210b8aea..0ee3dc3b224 100644
--- a/regression-test/suites/nereids_p0/outfile/test_outfile_parquet.groovy
+++ b/regression-test/suites/nereids_p0/outfile/test_outfile_parquet.groovy
@@ -34,7 +34,12 @@ suite("test_outfile_parquet") {
sql "USE $dbName"
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
def process = command.toString().execute()
@@ -151,6 +156,9 @@ suite("test_outfile_parquet") {
commandBuilder.append("""curl -v --location-trusted -u ${context.config.feHttpUser}:${context.config.feHttpPassword}""")
commandBuilder.append(""" -H format:parquet -T """ + files[0].getAbsolutePath() + """ http://${context.config.feHttpAddress}/api/""" + dbName + "/" + tableName2 + "/_stream_load")
command = commandBuilder.toString()
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ command = command.replace("http://", "https://") + " --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey")
+ }
process = command.execute()
code = process.waitFor()
err = IOGroovyMethods.getText(new BufferedReader(new InputStreamReader(process.getErrorStream())))
diff --git a/regression-test/suites/nereids_p0/outfile/test_outfile_separator.groovy b/regression-test/suites/nereids_p0/outfile/test_outfile_separator.groovy
index 0168cfe430c..2c412f900ba 100644
--- a/regression-test/suites/nereids_p0/outfile/test_outfile_separator.groovy
+++ b/regression-test/suites/nereids_p0/outfile/test_outfile_separator.groovy
@@ -27,7 +27,12 @@ suite("test_outfile_separator") {
StringBuilder strBuilder = new StringBuilder()
strBuilder.append("curl --location-trusted -u " + context.config.jdbcUser + ":" + context.config.jdbcPassword)
- strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ if ((context.config.otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true")) ?: false) {
+ strBuilder.append(" https://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ strBuilder.append(" --cert " + context.config.otherConfigs.get("trustCert") + " --cacert " + context.config.otherConfigs.get("trustCACert") + " --key " + context.config.otherConfigs.get("trustCAKey"))
+ } else {
+ strBuilder.append(" http://" + context.config.feHttpAddress + "/rest/v1/config/fe")
+ }
String command = strBuilder.toString()
def process = command.toString().execute()
diff --git a/regression-test/suites/query_profile/adaptive_pipeline_task_serial_read_on_limit.groovy b/regression-test/suites/query_profile/adaptive_pipeline_task_serial_read_on_limit.groovy
index afed45ddb40..4a36401b02b 100644
--- a/regression-test/suites/query_profile/adaptive_pipeline_task_serial_read_on_limit.groovy
+++ b/regression-test/suites/query_profile/adaptive_pipeline_task_serial_read_on_limit.groovy
@@ -18,33 +18,14 @@
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import groovy.json.StringEscapeUtils
+import org.apache.doris.regression.action.ProfileAction
-
-def getProfileList = {
- def dst = 'http://' + context.config.feHttpAddress
- 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 = { 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 verifyProfileContent = { stmt, serialReadOnLimit ->
+def verifyProfileContent = { suiteContext, stmt, serialReadOnLimit ->
// Sleep 500ms to wait for the profile collection
Thread.sleep(500)
// Get profile list by using getProfileList
- List profileData = new JsonSlurper().parseText(getProfileList()).data.rows
+ def profileAction = new ProfileAction(suiteContext)
+ List profileData = profileAction.getProfileList()
// Find the profile id for the query that we just emitted
String profileId = ""
for (def profileItem : profileData) {
@@ -60,7 +41,7 @@ def verifyProfileContent = { stmt, serialReadOnLimit ->
return false
}
// Get profile content by using getProfile
- def String profileContent = getProfile(profileId).toString()
+ String profileContent = profileAction.getProfile(profileId)
logger.info("Profile content of ${stmt} is\n${profileContent}")
// Check if the profile contains the expected content
if (serialReadOnLimit) {
@@ -127,18 +108,18 @@ suite('adaptive_pipeline_task_serial_read_on_limit') {
// With Limit, MaxScannerThreadNum = 1
sql "select * from adaptive_pipeline_task_serial_read_on_limit limit 10;"
- assertTrue(verifyProfileContent("select * from adaptive_pipeline_task_serial_read_on_limit limit 10;", true))
+ assertTrue(verifyProfileContent(context, "select * from adaptive_pipeline_task_serial_read_on_limit limit 10;", true))
sql "select * from adaptive_pipeline_task_serial_read_on_limit limit 10000;"
- assertTrue(verifyProfileContent("select * from adaptive_pipeline_task_serial_read_on_limit limit 10000;", true))
+ assertTrue(verifyProfileContent(context, "select * from adaptive_pipeline_task_serial_read_on_limit limit 10000;", true))
// With Limit, but bigger then adaptive_pipeline_task_serial_read_on_limit, MaxScannerThreadNum = TabletNum
sql "set adaptive_pipeline_task_serial_read_on_limit=9998;"
sql "select * from adaptive_pipeline_task_serial_read_on_limit limit 9999;"
- assertTrue(verifyProfileContent("select * from adaptive_pipeline_task_serial_read_on_limit limit 9999;", false))
+ assertTrue(verifyProfileContent(context, "select * from adaptive_pipeline_task_serial_read_on_limit limit 9999;", false))
// With limit, but with predicates too. MaxScannerThreadNum = TabletNum
sql "select * from adaptive_pipeline_task_serial_read_on_limit where id > 10 limit 1;"
- assertTrue(verifyProfileContent("select * from adaptive_pipeline_task_serial_read_on_limit where id > 10 limit 1;", false))
+ assertTrue(verifyProfileContent(context, "select * from adaptive_pipeline_task_serial_read_on_limit where id > 10 limit 1;", false))
// With large engough limit, but enable_adaptive_pipeline_task_serial_read_on_limit is false. MaxScannerThreadNum = TabletNum
sql "set enable_adaptive_pipeline_task_serial_read_on_limit=false;"
sql """select "enable_adaptive_pipeline_task_serial_read_on_limit=false", * from adaptive_pipeline_task_serial_read_on_limit limit 1000000;"""
- assertTrue(verifyProfileContent("select \"enable_adaptive_pipeline_task_serial_read_on_limit=false\", * from adaptive_pipeline_task_serial_read_on_limit limit 1000000;", false))
+ assertTrue(verifyProfileContent(context, "select \"enable_adaptive_pipeline_task_serial_read_on_limit=false\", * from adaptive_pipeline_task_serial_read_on_limit limit 1000000;", false))
}
\ No newline at end of file
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 19bd9cf064c..ce71c49d7b9 100644
--- a/regression-test/suites/query_profile/s3_load_profile_test.groovy
+++ b/regression-test/suites/query_profile/s3_load_profile_test.groovy
@@ -16,27 +16,7 @@
// under the License.
import groovy.json.JsonSlurper
-
-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()
-}
+import org.apache.doris.regression.action.ProfileAction
// ref https://github.com/apache/doris/blob/3525a03815814f66ec78aa2ad6bbd9225b0e7a6b/regression-test/suites/load_p0/broker_load/test_s3_load.groovy
suite('s3_load_profile_test') {
@@ -204,7 +184,8 @@ PROPERTIES (
def masterAddress = masterIP + ":" + masterHTTPPort
logger.info("masterIP:masterHTTPPort is:${masterAddress}")
- def profileString = getProfile(masterAddress, jobId)
+ def profileAction = new ProfileAction(context)
+ def profileString = profileAction.getProfile(jobId.toString())
logger.info("profileDataString:" + profileString)
assertTrue(profileString.contains("NumScanners"))
assertTrue(profileString.contains("RowsProduced"))
diff --git a/regression-test/suites/query_profile/scanner_profile.groovy b/regression-test/suites/query_profile/scanner_profile.groovy
index 3db4851df9b..200599315a2 100644
--- a/regression-test/suites/query_profile/scanner_profile.groovy
+++ b/regression-test/suites/query_profile/scanner_profile.groovy
@@ -18,49 +18,7 @@
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import groovy.json.StringEscapeUtils
-
-
-def getProfileList = {
- def dst = 'http://' + context.config.feHttpAddress
- 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 = { 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 getProfileWithToken = { token ->
- def wholeString = getProfileList()
- List profileData = new JsonSlurper().parseText(wholeString).data.rows
- String profileId = "";
- logger.info("{}", token)
-
- for (def profileItem in profileData) {
- if (profileItem["Sql Statement"].toString().contains(token)) {
- profileId = profileItem["Profile ID"].toString()
- logger.info("profileItem: {}", profileItem)
- }
- }
-
- logger.info("$token: {}", profileId)
- // Sleep 2 seconds to make sure profile collection is done
- Thread.sleep(2000)
-
- def String profile = getProfile(profileId).toString()
- return profile;
-}
+import org.apache.doris.regression.action.ProfileAction
suite('scanner_profile') {
sql """
@@ -103,16 +61,30 @@ suite('scanner_profile') {
sql """
select "${token}", * from scanner_profile limit 10;
"""
+ def profileAction = new ProfileAction(context)
+ def getProfileByToken = { pattern ->
+ List profileData = profileAction.getProfileList()
+ def profileContent = ""
+ for (final def profileItem in profileData) {
+ if (profileItem["Sql Statement"].toString().contains(pattern)) {
+ profileContent = profileAction.getProfile(profileItem["Profile ID"].toString())
+ break
+ }
+ }
+ return profileContent
+ }
- def String profileWithLimit1 = getProfileWithToken(token)
- logger.info("Profile of ${token} ${profileWithLimit1}")
- assertTrue(profileWithLimit1.contains("- MaxScanConcurrency: 1"))
+ List profileData = profileAction.getProfileList()
+ def profileWithLimit1 = getProfileByToken(token)
+ logger.info("${token} Profile Data: ${profileWithLimit1}")
+ assertTrue(profileWithLimit1.toString().contains("- MaxScanConcurrency: 1"))
token = UUID.randomUUID().toString()
sql """
select "${token}", * from scanner_profile where id < 10;
"""
- def String profileWithFilter = getProfileWithToken(token)
- logger.info("Profile of ${token} ${profileWithFilter}")
- assertTrue(profileWithFilter.contains("actualRows=9"))
+
+ String profileWithFilter = getProfileByToken(token)
+ logger.info("${token} Profile Data: ${profileWithFilter}")
+ assertTrue(profileWithFilter.toString().contains("actualRows=9"))
}
\ No newline at end of file
diff --git a/regression-test/suites/query_profile/test_execute_by_frontend.groovy b/regression-test/suites/query_profile/test_execute_by_frontend.groovy
index c166dfdcee9..01aa22563ae 100644
--- a/regression-test/suites/query_profile/test_execute_by_frontend.groovy
+++ b/regression-test/suites/query_profile/test_execute_by_frontend.groovy
@@ -18,28 +18,7 @@
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import groovy.json.StringEscapeUtils
-
-def getProfileList = {
- def dst = 'http://' + context.config.feHttpAddress
- 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 = { 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}")
- // set conn parameters
-
- return conn.getInputStream().getText()
- }
+import org.apache.doris.regression.action.ProfileAction
suite('test_execute_by_frontend') {
sql """
@@ -60,8 +39,8 @@ suite('test_execute_by_frontend') {
def simpleSql2 = """select cast("1" as Int)"""
sql "${simpleSql2}"
def isRecorded = false
- def wholeString = getProfileList()
- List profileData = new JsonSlurper().parseText(wholeString).data.rows
+ def profileAction = new ProfileAction(context)
+ List profileData = profileAction.getProfileList()
String queryId1 = "";
String queryId2 = "";
@@ -78,11 +57,11 @@ suite('test_execute_by_frontend') {
assertTrue(isRecorded)
- String profileContent1 = getProfile(queryId1)
+ String profileContent1 = profileAction.getProfile(queryId1)
logger.info("Profile of ${queryId1}: ${profileContent1}")
def executionProfileIdx1 = profileContent1.indexOf("Executed By Frontend: true")
assertTrue(executionProfileIdx1 > 0)
- String profileContent2 = getProfile(queryId2)
+ String profileContent2 = profileAction.getProfile(queryId2)
logger.info("Profile of ${queryId2}: ${profileContent2}")
def executionProfileIdx2 = profileContent2.indexOf("Executed By Frontend: true")
assertTrue(executionProfileIdx2 > 0)
diff --git a/regression-test/suites/query_profile/test_profile.groovy b/regression-test/suites/query_profile/test_profile.groovy
index 11150e61e6e..35ea1ba8687 100644
--- a/regression-test/suites/query_profile/test_profile.groovy
+++ b/regression-test/suites/query_profile/test_profile.groovy
@@ -17,38 +17,20 @@
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
-
-def getProfileList = {
- def dst = 'http://' + context.config.feHttpAddress
- 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 = { id ->
- def dst = 'http://' + context.config.feHttpAddress
- def conn = new URL(dst + "/rest/v1/query_profile/$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()
- }
+import org.apache.doris.regression.action.ProfileAction
suite('test_profile') {
// TODO: more test for normal situation
// invalidProfileId
- def invalidProfileString = getProfile("ABCD")
+ def profileAction = new ProfileAction(context)
+ def invalidProfileString = profileAction.getProfile("ABCD")
logger.info("invalidProfileString:{}", invalidProfileString);
def json = new JsonSlurper().parseText(invalidProfileString)
assertEquals(500, json.code)
// notExistingProfileId
- def notExistingProfileString = getProfile("-100")
+ def notExistingProfileString = profileAction.getProfile("-100")
logger.info("notExistingProfileString:{}", notExistingProfileString)
def json2 = new JsonSlurper().parseText(notExistingProfileString)
assertEquals("Profile -100 not found", json2.data)
@@ -70,7 +52,7 @@ suite('test_profile') {
def simpleSql = "select count(*) from test_profile"
sql "${simpleSql}"
def isRecorded = false
- def wholeString = getProfileList()
+ def wholeString = profileAction.getProfileList()
List profileData = new JsonSlurper().parseText(wholeString).data.rows
for (final def profileItem in profileData) {
if (profileItem["Sql Statement"].toString() == simpleSql) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org