From a05687b900e17bfb56e6dc5dd517d34865ec9c39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E6=AD=A3=E8=B6=85?= Date: Sun, 26 Apr 2026 15:41:50 +0800 Subject: [PATCH] test(utils): cover disk-check env alias precedence (#2684) --- crates/utils/src/envs.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/utils/src/envs.rs b/crates/utils/src/envs.rs index 9316577c4..96bb05264 100644 --- a/crates/utils/src/envs.rs +++ b/crates/utils/src/envs.rs @@ -663,7 +663,9 @@ pub fn apply_external_env_compat() -> ExternalEnvCompatReport { #[cfg(test)] mod tests { - use super::{apply_external_env_compat, build_external_env_compat_report_from_entries, get_env_str}; + use super::{ + apply_external_env_compat, build_external_env_compat_report_from_entries, get_env_bool_with_aliases, get_env_str, + }; fn source_key(suffix: &str) -> String { let mut key = super::external_env_prefix().to_string(); @@ -750,6 +752,15 @@ mod tests { }); } + #[test] + fn rustfs_bool_env_takes_precedence_over_minio_alias() { + temp_env::with_var("RUSTFS_UNSAFE_BYPASS_DISK_CHECK", Some("false"), || { + temp_env::with_var("MINIO_CI", Some("1"), || { + assert!(!get_env_bool_with_aliases("RUSTFS_UNSAFE_BYPASS_DISK_CHECK", &["MINIO_CI"], true,)); + }); + }); + } + #[test] fn apply_external_env_compat_copies_missing_rustfs_keys() { temp_env::with_var("MINIO_ROOT_USER", Some("compat-admin"), || {