diff --git a/Cargo.lock b/Cargo.lock index 11fccb96d43a..60828b081b09 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3017,6 +3017,7 @@ dependencies = [ "log", "opendal", "parquet", + "rand 0.8.5", "serde", "storages-common-index", "storages-common-pruner", diff --git a/src/query/ee/src/test_kits/setup.rs b/src/query/ee/src/test_kits/setup.rs index 6b7ffeed1bdf..7ac412f545db 100644 --- a/src/query/ee/src/test_kits/setup.rs +++ b/src/query/ee/src/test_kits/setup.rs @@ -28,10 +28,11 @@ impl TestFixture { set_panic_hook(); std::env::set_var("UNIT_TEST", "TRUE"); - let thread_name = std::thread::current().name().unwrap().to_string(); - #[cfg(debug_assertions)] - common_base::base::GlobalInstance::init_testing(&thread_name); + { + let thread_name = std::thread::current().name().unwrap().to_string(); + common_base::base::GlobalInstance::init_testing(&thread_name); + } GlobalServices::init_with(config).await?; MockServices::init(config, public_key).await?; diff --git a/src/query/service/src/test_kits/fixture.rs b/src/query/service/src/test_kits/fixture.rs index 825d914a0ef5..802dcee386f9 100644 --- a/src/query/service/src/test_kits/fixture.rs +++ b/src/query/service/src/test_kits/fixture.rs @@ -96,19 +96,21 @@ pub struct TestFixture { } pub struct TestGuard { - thread_name: String, + _thread_name: String, } impl TestGuard { pub fn new(thread_name: String) -> Self { - Self { thread_name } + Self { + _thread_name: thread_name, + } } } impl Drop for TestGuard { fn drop(&mut self) { #[cfg(debug_assertions)] - common_base::base::GlobalInstance::drop_testing(&self.thread_name); + common_base::base::GlobalInstance::drop_testing(&self._thread_name); } } @@ -200,9 +202,11 @@ impl TestFixture { set_panic_hook(); std::env::set_var("UNIT_TEST", "TRUE"); - let thread_name = std::thread::current().name().unwrap().to_string(); #[cfg(debug_assertions)] - common_base::base::GlobalInstance::init_testing(&thread_name); + { + let thread_name = std::thread::current().name().unwrap().to_string(); + common_base::base::GlobalInstance::init_testing(&thread_name); + } GlobalServices::init_with(config).await?; OssLicenseManager::init(config.query.tenant_id.clone())?;