Fix flaky cargo test

This commit is contained in:
Wildan M 2026-07-12 15:58:55 +07:00
parent ad20e03eeb
commit 027befb50a
No known key found for this signature in database
GPG Key ID: 01AC53185C679C79
2 changed files with 8 additions and 1 deletions

View File

@ -209,6 +209,11 @@ pub fn get_config() -> &'static CookbookConfig {
return CONFIG.get().expect("Configuration is not initialized");
}
/// Fallible version of get_config(), because it's not loaded when testing
pub fn try_get_config() -> Option<&'static CookbookConfig> {
return CONFIG.get();
}
pub fn translate_mirror(original_url: &str) -> String {
let config = CONFIG.get().expect("Configuration is not initialized");

View File

@ -23,7 +23,9 @@ fn auto_deps_from_dynamic_linking(
) -> BTreeSet<PackageName> {
let mut paths = BTreeSet::new();
let mut visited = BTreeSet::new();
let verbose = crate::config::get_config().cook.verbose;
let verbose = crate::config::try_get_config()
.map(|s| s.cook.verbose)
.unwrap_or(true);
// Base directories may need to be updated for packages that place binaries in odd locations.
let mut walk = VecDeque::new();