mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-31 09:18:28 +00:00
s3Select: add unit test case
Signed-off-by: junxiang Mu <1948535941@qq.com>
This commit is contained in:
@@ -20,6 +20,9 @@ pub mod instance;
|
||||
pub mod metadata;
|
||||
pub mod sql;
|
||||
|
||||
#[cfg(test)]
|
||||
mod test;
|
||||
|
||||
use rustfs_s3select_api::{QueryResult, server::dbms::DatabaseManagerSystem};
|
||||
use s3s::dto::SelectObjectContentInput;
|
||||
use std::sync::{Arc, LazyLock};
|
||||
@@ -75,10 +78,25 @@ pub async fn get_global_db(
|
||||
}
|
||||
|
||||
/// Create a fresh database instance without using cached components (for testing)
|
||||
pub async fn create_fresh_db(
|
||||
input: SelectObjectContentInput,
|
||||
enable_debug: bool,
|
||||
) -> QueryResult<Arc<dyn DatabaseManagerSystem + Send + Sync>> {
|
||||
let db = crate::instance::make_rustfsms(Arc::new(input), enable_debug).await?;
|
||||
pub async fn create_fresh_db() -> QueryResult<Arc<dyn DatabaseManagerSystem + Send + Sync>> {
|
||||
// Create a default test input for fresh database creation
|
||||
let default_input = SelectObjectContentInput {
|
||||
bucket: "test-bucket".to_string(),
|
||||
expected_bucket_owner: None,
|
||||
key: "test.csv".to_string(),
|
||||
sse_customer_algorithm: None,
|
||||
sse_customer_key: None,
|
||||
sse_customer_key_md5: None,
|
||||
request: s3s::dto::SelectObjectContentRequest {
|
||||
expression: "SELECT * FROM S3Object".to_string(),
|
||||
expression_type: s3s::dto::ExpressionType::from_static("SQL"),
|
||||
input_serialization: s3s::dto::InputSerialization::default(),
|
||||
output_serialization: s3s::dto::OutputSerialization::default(),
|
||||
request_progress: None,
|
||||
scan_range: None,
|
||||
},
|
||||
};
|
||||
|
||||
let db = crate::instance::make_rustfsms(Arc::new(default_input), true).await?;
|
||||
Ok(Arc::new(db) as Arc<dyn DatabaseManagerSystem + Send + Sync>)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user