refactor: expose shared operator test fixtures

Signed-off-by: WenyXu <wenymedia@gmail.com>
This commit is contained in:
WenyXu
2026-09-16 10:25:34 +00:00
parent e0915a8380
commit c1146cc0f2
8 changed files with 15 additions and 11 deletions
+1 -1
View File
@@ -1559,7 +1559,7 @@ mod tests {
use table::metadata::{TableInfoBuilder, TableMetaBuilder, TableType};
use super::*;
use crate::tests::{create_partition_rule_manager, prepare_mocked_backend};
use crate::test_util::{create_partition_rule_manager, prepare_mocked_backend};
fn make_table_ref_with_schema(
ts_name: &str,
+2 -2
View File
@@ -25,6 +25,6 @@ pub mod req_convert;
pub mod request;
pub mod statement;
pub mod table;
#[cfg(test)]
pub(crate) mod tests;
#[cfg(any(test, feature = "testing"))]
pub mod test_util;
pub mod utils;
@@ -62,7 +62,7 @@ mod tests {
use store_api::storage::RegionId;
use super::*;
use crate::tests::{
use crate::test_util::{
create_partition_rule_manager, new_test_table_info, prepare_mocked_backend,
};
@@ -92,7 +92,7 @@ mod tests {
use api::v1::{ColumnDataType, Row, RowInsertRequest, Rows, Value};
use super::*;
use crate::tests::{
use crate::test_util::{
create_partition_rule_manager, new_test_table_info, prepare_mocked_backend,
};
@@ -78,7 +78,7 @@ mod tests {
use store_api::storage::RegionId;
use super::*;
use crate::tests::{
use crate::test_util::{
create_partition_rule_manager, new_test_table_info, prepare_mocked_backend,
};
@@ -15,5 +15,5 @@
mod kv_backend;
mod partition_manager;
pub(crate) use kv_backend::prepare_mocked_backend;
pub(crate) use partition_manager::{create_partition_rule_manager, new_test_table_info};
pub use crate::test_util::kv_backend::prepare_mocked_backend;
pub use crate::test_util::partition_manager::{create_partition_rule_manager, new_test_table_info};
@@ -15,9 +15,13 @@
use std::collections::{BTreeMap, HashMap};
use std::sync::Arc;
#[cfg(test)]
use api::v1::helper::tag_column_schema;
#[cfg(test)]
use api::v1::value::ValueData;
#[cfg(test)]
use api::v1::{ColumnDataType, Row, Rows};
#[cfg(test)]
use common_base::hash::partition_expr_version;
use common_meta::cache::{TableRouteCacheRef, new_table_route_cache};
use common_meta::key::TableMetadataManager;
@@ -93,10 +97,12 @@ fn new_test_table_info_with_columns(
.unwrap()
}
#[cfg(test)]
fn new_physical_test_table_info(table_id: u32, table_name: &str) -> TableInfo {
new_test_table_info_with_columns(table_id, table_name, test_column_schemas(true), vec![0, 2])
}
#[cfg(test)]
fn new_logical_test_table_info(table_id: u32, table_name: &str) -> TableInfo {
new_test_table_info_with_columns(table_id, table_name, test_column_schemas(false), vec![0])
}
@@ -141,9 +147,7 @@ fn test_new_partition_info_cache(table_route_cache: TableRouteCacheRef) -> Parti
/// PARTITION r2 VALUES LESS THAN (50, 'sh'),
/// PARTITION r3 VALUES LESS THAN (MAXVALUE, MAXVALUE),
/// )
pub(crate) async fn create_partition_rule_manager(
kv_backend: KvBackendRef,
) -> PartitionRuleManagerRef {
pub async fn create_partition_rule_manager(kv_backend: KvBackendRef) -> PartitionRuleManagerRef {
let table_metadata_manager = TableMetadataManager::new(kv_backend.clone());
let table_route_cache = test_new_table_route_cache(kv_backend.clone());
let partition_info_cache = test_new_partition_info_cache(table_route_cache.clone());