diff --git a/Cargo.lock b/Cargo.lock index f769e00b50..7592b6afdc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5239,6 +5239,7 @@ dependencies = [ "table", "tokio", "tokio-stream", + "toml", "tonic", "tower", "tracing", diff --git a/tests-integration/src/test_util.rs b/tests-integration/src/test_util.rs index fa92e5216f..3727dbdcd8 100644 --- a/tests-integration/src/test_util.rs +++ b/tests-integration/src/test_util.rs @@ -14,6 +14,7 @@ use std::collections::HashMap; use std::env; +use std::fmt::Display; use std::net::SocketAddr; use std::sync::Arc; use std::time::Duration; @@ -61,7 +62,7 @@ use snafu::ResultExt; use table::engine::{EngineContext, TableEngineRef}; use table::requests::{CreateTableRequest, InsertRequest, TableOptions}; -#[derive(Debug, Eq, PartialEq)] +#[derive(Debug, Clone, Copy, Eq, PartialEq)] pub enum StorageType { S3, S3WithCache, @@ -71,6 +72,19 @@ pub enum StorageType { Gcs, } +impl Display for StorageType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + StorageType::S3 => write!(f, "S3"), + StorageType::S3WithCache => write!(f, "S3"), + StorageType::File => write!(f, "File"), + StorageType::Oss => write!(f, "Oss"), + StorageType::Azblob => write!(f, "Azblob"), + StorageType::Gcs => write!(f, "Gcs"), + } + } +} + impl StorageType { pub fn test_on(&self) -> bool { let _ = dotenv::dotenv(); diff --git a/tests-integration/tests/http.rs b/tests-integration/tests/http.rs index d413bf45fb..81f38811c8 100644 --- a/tests-integration/tests/http.rs +++ b/tests-integration/tests/http.rs @@ -503,63 +503,78 @@ pub async fn test_config_api(store_type: StorageType) { let res_get = client.get("/config").send().await; assert_eq!(res_get.status(), StatusCode::OK); - let expected_toml_str = r#" - mode = "standalone" - enable_memory_catalog = false - rpc_addr = "127.0.0.1:3001" - rpc_runtime_size = 8 - heartbeat_interval_millis = 5000 + let expected_toml_str = format!( + r#" + mode = "standalone" + enable_memory_catalog = false + rpc_addr = "127.0.0.1:3001" + rpc_runtime_size = 8 + heartbeat_interval_millis = 5000 - [http_opts] - addr = "127.0.0.1:4000" - timeout = "30s" - body_limit = "64MiB" + [http_opts] + addr = "127.0.0.1:4000" + timeout = "30s" + body_limit = "64MiB" - [wal] - file_size = "256MiB" - purge_threshold = "4GiB" - purge_interval = "10m" - read_batch_size = 128 - sync_write = false + [wal] + file_size = "256MiB" + purge_threshold = "4GiB" + purge_interval = "10m" + read_batch_size = 128 + sync_write = false - [storage] - type = "File" + [storage] + type = "{}" - [storage.compaction] - max_inflight_tasks = 4 - max_files_in_level0 = 8 - max_purge_tasks = 32 - sst_write_buffer_size = "8MiB" + [storage.compaction] + max_inflight_tasks = 4 + max_files_in_level0 = 8 + max_purge_tasks = 32 + sst_write_buffer_size = "8MiB" - [storage.manifest] - checkpoint_margin = 10 - gc_duration = "10m" - checkpoint_on_startup = false - compress = false + [storage.manifest] + checkpoint_margin = 10 + gc_duration = "10m" + checkpoint_on_startup = false + compress = false - [storage.flush] - max_flush_tasks = 8 - region_write_buffer_size = "32MiB" - picker_schedule_interval = "5m" - auto_flush_interval = "1h" + [storage.flush] + max_flush_tasks = 8 + region_write_buffer_size = "32MiB" + picker_schedule_interval = "5m" + auto_flush_interval = "1h" - [procedure] - max_retry_times = 3 - retry_delay = "500ms" + [procedure] + max_retry_times = 3 + retry_delay = "500ms" - [logging] - enable_jaeger_tracing = false"#; + [logging] + enable_jaeger_tracing = false"#, + store_type + ); let body_text = drop_lines_with_inconsistent_results(res_get.text().await); assert_eq!( normalize_str(body_text.as_str()), - normalize_str(expected_toml_str) + normalize_str(&expected_toml_str) ); } fn drop_lines_with_inconsistent_results(input: String) -> String { input .lines() - .filter(|line| !line.trim().starts_with("dir =") && !line.trim().starts_with("data_home =")) + .filter(|line| { + // ignores + !line.trim().starts_with("dir =") + && !line.trim().starts_with("data_home =") + && !line.trim().starts_with("bucket =") + && !line.trim().starts_with("root =") + && !line.trim().starts_with("endpoint =") + && !line.trim().starts_with("region =") + && !line.trim().starts_with("cache_path =") + && !line.trim().starts_with("cache_capacity =") + && !line.trim().starts_with("sas_token =") + && !line.trim().starts_with("scope =") + }) .collect::>() .join("\n") }