mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-08-12 09:19:44 +00:00
feat!: Remove script crate and python feature (#5321)
* feat: exclude script crate * chore: simplify feature * feat: remove the script crate * chore: remove python feature and some comments * chore: fix warning
This commit is contained in:
@@ -91,7 +91,6 @@ partition.workspace = true
|
||||
paste.workspace = true
|
||||
prost.workspace = true
|
||||
rand.workspace = true
|
||||
script.workspace = true
|
||||
session = { workspace = true, features = ["testing"] }
|
||||
store-api.workspace = true
|
||||
tokio-postgres = { workspace = true }
|
||||
|
||||
@@ -392,10 +392,7 @@ pub async fn setup_test_http_app(store_type: StorageType, name: &str) -> (Router
|
||||
..Default::default()
|
||||
};
|
||||
let http_server = HttpServerBuilder::new(http_opts)
|
||||
.with_sql_handler(
|
||||
ServerSqlQueryHandlerAdapter::arc(instance.instance.clone()),
|
||||
None,
|
||||
)
|
||||
.with_sql_handler(ServerSqlQueryHandlerAdapter::arc(instance.instance.clone()))
|
||||
.with_metrics_handler(MetricsHandler)
|
||||
.with_greptime_config_options(instance.opts.datanode_options().to_toml().unwrap())
|
||||
.build();
|
||||
@@ -426,10 +423,7 @@ pub async fn setup_test_http_app_with_frontend_and_user_provider(
|
||||
let mut http_server = HttpServerBuilder::new(http_opts);
|
||||
|
||||
http_server = http_server
|
||||
.with_sql_handler(
|
||||
ServerSqlQueryHandlerAdapter::arc(instance.instance.clone()),
|
||||
Some(instance.instance.clone()),
|
||||
)
|
||||
.with_sql_handler(ServerSqlQueryHandlerAdapter::arc(instance.instance.clone()))
|
||||
.with_log_ingest_handler(instance.instance.clone(), None, None)
|
||||
.with_otlp_handler(instance.instance.clone())
|
||||
.with_greptime_config_options(instance.opts.to_toml().unwrap());
|
||||
@@ -465,10 +459,7 @@ pub async fn setup_test_prom_app_with_frontend(
|
||||
let frontend_ref = instance.instance.clone();
|
||||
let is_strict_mode = true;
|
||||
let http_server = HttpServerBuilder::new(http_opts)
|
||||
.with_sql_handler(
|
||||
ServerSqlQueryHandlerAdapter::arc(frontend_ref.clone()),
|
||||
Some(frontend_ref.clone()),
|
||||
)
|
||||
.with_sql_handler(ServerSqlQueryHandlerAdapter::arc(frontend_ref.clone()))
|
||||
.with_prom_handler(frontend_ref.clone(), true, is_strict_mode)
|
||||
.with_prometheus_handler(frontend_ref)
|
||||
.with_greptime_config_options(instance.opts.datanode_options().to_toml().unwrap())
|
||||
|
||||
@@ -80,7 +80,6 @@ macro_rules! http_tests {
|
||||
test_prometheus_promql_api,
|
||||
test_prom_http_api,
|
||||
test_metrics_api,
|
||||
test_scripts_api,
|
||||
test_health_api,
|
||||
test_status_api,
|
||||
test_config_api,
|
||||
@@ -721,46 +720,6 @@ pub async fn test_metrics_api(store_type: StorageType) {
|
||||
guard.remove_all().await;
|
||||
}
|
||||
|
||||
pub async fn test_scripts_api(store_type: StorageType) {
|
||||
common_telemetry::init_default_ut_logging();
|
||||
let (app, mut guard) = setup_test_http_app_with_frontend(store_type, "script_api").await;
|
||||
let client = TestClient::new(app);
|
||||
|
||||
let res = client
|
||||
.post("/v1/scripts?db=schema_test&name=test")
|
||||
.body(
|
||||
r#"
|
||||
@copr(sql='select number from numbers limit 10', args=['number'], returns=['n'])
|
||||
def test(n) -> vector[f64]:
|
||||
return n + 1;
|
||||
"#,
|
||||
)
|
||||
.send()
|
||||
.await;
|
||||
assert_eq!(res.status(), StatusCode::OK);
|
||||
|
||||
let body = serde_json::from_str::<GreptimedbV1Response>(&res.text().await).unwrap();
|
||||
assert!(body.output().is_empty());
|
||||
|
||||
// call script
|
||||
let res = client
|
||||
.post("/v1/run-script?db=schema_test&name=test")
|
||||
.send()
|
||||
.await;
|
||||
assert_eq!(res.status(), StatusCode::OK);
|
||||
let body = serde_json::from_str::<GreptimedbV1Response>(&res.text().await).unwrap();
|
||||
let output = body.output();
|
||||
assert_eq!(output.len(), 1);
|
||||
assert_eq!(
|
||||
output[0],
|
||||
serde_json::from_value::<GreptimeQueryOutput>(json!({
|
||||
"records":{"schema":{"column_schemas":[{"name":"n","data_type":"Float64"}]},"rows":[[1.0],[2.0],[3.0],[4.0],[5.0],[6.0],[7.0],[8.0],[9.0],[10.0]],"total_rows": 10}
|
||||
})).unwrap()
|
||||
);
|
||||
|
||||
guard.remove_all().await;
|
||||
}
|
||||
|
||||
pub async fn test_health_api(store_type: StorageType) {
|
||||
common_telemetry::init_default_ut_logging();
|
||||
let (app, _guard) = setup_test_http_app_with_frontend(store_type, "health_api").await;
|
||||
|
||||
Reference in New Issue
Block a user