test(utils): cover disk-check env alias precedence (#2684)

This commit is contained in:
安正超
2026-04-26 15:41:50 +08:00
committed by GitHub
parent 561d695237
commit a05687b900
+12 -1
View File
@@ -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"), || {