feat: specify prom server start addr (#1111)

* feat: specify promql server start addr

* refactor: rename promql to prom in Prometheus API server scenario
This commit is contained in:
yuanbohan
2023-03-06 11:07:21 +08:00
committed by GitHub
parent b022556b79
commit d4e0dc3685
15 changed files with 97 additions and 73 deletions

View File

@@ -38,7 +38,7 @@ use once_cell::sync::OnceCell;
use rand::Rng;
use servers::grpc::GrpcServer;
use servers::http::{HttpOptions, HttpServer};
use servers::promql::PromqlServer;
use servers::prom::PromServer;
use servers::query_handler::grpc::ServerGrpcQueryHandlerAdaptor;
use servers::query_handler::sql::ServerSqlQueryHandlerAdaptor;
use servers::server::Server;
@@ -305,7 +305,7 @@ pub async fn setup_test_http_app_with_frontend(
(app, guard)
}
pub async fn setup_test_promql_app_with_frontend(
pub async fn setup_test_prom_app_with_frontend(
store_type: StorageType,
name: &str,
) -> (Router, TestGuard) {
@@ -320,8 +320,8 @@ pub async fn setup_test_promql_app_with_frontend(
)
.await
.unwrap();
let promql_server = PromqlServer::create_server(Arc::new(frontend) as _);
let app = promql_server.make_app();
let prom_server = PromServer::create_server(Arc::new(frontend) as _);
let app = prom_server.make_app();
(app, guard)
}

View File

@@ -19,7 +19,7 @@ use serde_json::json;
use servers::http::handler::HealthResponse;
use servers::http::{JsonOutput, JsonResponse};
use tests_integration::test_util::{
setup_test_http_app, setup_test_http_app_with_frontend, setup_test_promql_app_with_frontend,
setup_test_http_app, setup_test_http_app_with_frontend, setup_test_prom_app_with_frontend,
StorageType,
};
@@ -54,7 +54,7 @@ macro_rules! http_tests {
test_sql_api,
test_prometheus_promql_api,
test_promql_http_api,
test_prom_http_api,
test_metrics_api,
test_scripts_api,
test_health_api,
@@ -284,9 +284,9 @@ pub async fn test_prometheus_promql_api(store_type: StorageType) {
guard.remove_all().await;
}
pub async fn test_promql_http_api(store_type: StorageType) {
pub async fn test_prom_http_api(store_type: StorageType) {
common_telemetry::init_default_ut_logging();
let (app, mut guard) = setup_test_promql_app_with_frontend(store_type, "promql_api").await;
let (app, mut guard) = setup_test_prom_app_with_frontend(store_type, "promql_api").await;
let client = TestClient::new(app);
// instant query