From 6ed3af96736fa61325b011e245c85565d1ecb786 Mon Sep 17 00:00:00 2001 From: Sam Hughes Date: Thu, 7 Nov 2024 23:30:13 -0800 Subject: [PATCH] chore(cubestore): Expose parts of Config::test for customization --- rust/cubestore/cubestore/src/config/mod.rs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/rust/cubestore/cubestore/src/config/mod.rs b/rust/cubestore/cubestore/src/config/mod.rs index 3a03bf2d0c374..b4c15a0486bc0 100644 --- a/rust/cubestore/cubestore/src/config/mod.rs +++ b/rust/cubestore/cubestore/src/config/mod.rs @@ -1547,10 +1547,24 @@ impl Config { } pub fn test(name: &str) -> Config { - let query_timeout = 15; + Self::make_test_config(Self::test_config_obj(name)) + } + + /// Possibly there is nothing test-specific about this; its purpose is to be publicly used by Config::test. + pub fn make_test_config(config_obj_impl: ConfigObjImpl) -> Config { Config { injector: Injector::new(), - config_obj: Arc::new(ConfigObjImpl { + config_obj: Arc::new(config_obj_impl), + } + } + + /// Constructs the underlying ConfigObjImpl used in `Config::test`, so that you can modify it + /// before passing it to Config::make_test_config. + pub fn test_config_obj(name: &str) -> ConfigObjImpl { + let query_timeout = 15; + // Git blame history preserving block + { + ConfigObjImpl { data_dir: env::current_dir() .unwrap() .join(format!("{}-local-store", name)), @@ -1654,7 +1668,7 @@ impl Config { remote_files_cleanup_delay_secs: 3600, remote_files_cleanup_batch_size: 50000, create_table_max_retries: 3, - }), + } } }