Skip to content

Commit 671ccc0

Browse files
committed
Add test for feature gates in CacheConfigs.cache_type_by_name
1 parent ec40cec commit 671ccc0

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

src/config.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2874,3 +2874,26 @@ fn test_get_cache_levels_missing_config() {
28742874
"unexpected error: {err}"
28752875
);
28762876
}
2877+
2878+
#[test]
2879+
#[cfg(not(any_cache_remote))]
2880+
fn test_cache_type_by_name_all_unknown_without_features() {
2881+
let configs = CacheConfigs::default();
2882+
for name in [
2883+
"s3",
2884+
"redis",
2885+
"memcached",
2886+
"gcs",
2887+
"gha",
2888+
"azure",
2889+
"webdav",
2890+
"oss",
2891+
"cos",
2892+
] {
2893+
let err = configs.cache_type_by_name(name).unwrap_err().to_string();
2894+
assert!(
2895+
err.contains("Unknown cache level") && err.contains("--features"),
2896+
"expected feature hint for '{name}': {err}"
2897+
);
2898+
}
2899+
}

0 commit comments

Comments
 (0)