diff --git a/src/cmd_all/src/standalone.rs b/src/cmd_all/src/standalone.rs index 819aba03d865e..fb58fe79f8377 100644 --- a/src/cmd_all/src/standalone.rs +++ b/src/cmd_all/src/standalone.rs @@ -344,6 +344,7 @@ mod test { heap_profiling_dir: None, dangerous_max_idle_secs: None, connector_rpc_endpoint: None, + temp_secret_file_dir: None, }, ), compute_opts: Some( @@ -367,6 +368,7 @@ mod test { async_stack_trace: None, heap_profiling_dir: None, connector_rpc_endpoint: None, + temp_secret_file_dir: None, }, ), frontend_opts: Some( @@ -383,6 +385,7 @@ mod test { config_path: "src/config/test.toml", metrics_level: None, enable_barrier_read: None, + temp_secret_file_dir: None, }, ), compactor_opts: None, diff --git a/src/common/secret/src/secret_manager.rs b/src/common/secret/src/secret_manager.rs index 9ce343c38d2ba..03d60872be6e9 100644 --- a/src/common/secret/src/secret_manager.rs +++ b/src/common/secret/src/secret_manager.rs @@ -33,6 +33,7 @@ static INSTANCE: std::sync::OnceLock = std::sync::OnceLock:: #[derive(Debug)] pub struct LocalSecretManager { secrets: RwLock>>, + /// The local directory used to write secrets into file, so that it can be passed into some libararies secret_file_dir: PathBuf, } @@ -59,6 +60,10 @@ impl LocalSecretManager { /// # Panics /// Panics if the secret manager is not initialized. pub fn global() -> &'static LocalSecretManager { + // Initialize the secret manager for unit tests. + #[cfg(debug_assertions)] + LocalSecretManager::init(None); + INSTANCE.get().unwrap() }