test(admin): add route registration coverage for config admin APIs (#3148)

Add test assertions for all MinIO-compatible config admin routes
(get/set/del-config-kv, help-config-kv, list/clear/restore-config-history-kv,
GET/PUT /v3/config) and verify their compatibility alias paths.

Relates to rustfs/backlog#608
This commit is contained in:
houseme
2026-06-01 02:13:08 +08:00
committed by GitHub
parent a99ef64db2
commit 315c2e33f0
+22 -2
View File
@@ -14,8 +14,8 @@
use crate::admin::{
handlers::{
audit, bucket_meta, heal, health, kms, module_switch, oidc, plugins_catalog, plugins_instances, pools, profile_admin,
quota, rebalance, replication, site_replication, sts, system, tier, tls_debug, user,
audit, bucket_meta, config_admin, heal, health, kms, module_switch, oidc, plugins_catalog, plugins_instances, pools,
profile_admin, quota, rebalance, replication, site_replication, sts, system, tier, tls_debug, user,
},
router::{AdminOperation, S3Router},
};
@@ -52,6 +52,7 @@ fn register_admin_routes(router: &mut S3Router<AdminOperation>) {
tier::register_tier_route(router).expect("register tier route");
quota::register_quota_route(router).expect("register quota route");
bucket_meta::register_bucket_meta_route(router).expect("register bucket meta route");
config_admin::register_config_route(router).expect("register config admin route");
audit::register_audit_target_route(router).expect("register audit target route");
module_switch::register_module_switch_route(router).expect("register module switch route");
plugins_catalog::register_plugin_catalog_route(router).expect("register plugin catalog route");
@@ -113,6 +114,16 @@ fn test_register_routes_cover_representative_admin_paths() {
assert_route(&router, Method::DELETE, &admin_path("/v3/audit/target/audit_webhook/test-audit/reset"));
assert_route(&router, Method::GET, &admin_path("/v3/accountinfo"));
assert_route(&router, Method::GET, &admin_path("/v3/get-config-kv"));
assert_route(&router, Method::PUT, &admin_path("/v3/set-config-kv"));
assert_route(&router, Method::DELETE, &admin_path("/v3/del-config-kv"));
assert_route(&router, Method::GET, &admin_path("/v3/help-config-kv"));
assert_route(&router, Method::GET, &admin_path("/v3/list-config-history-kv"));
assert_route(&router, Method::DELETE, &admin_path("/v3/clear-config-history-kv"));
assert_route(&router, Method::PUT, &admin_path("/v3/restore-config-history-kv"));
assert_route(&router, Method::GET, &admin_path("/v3/config"));
assert_route(&router, Method::PUT, &admin_path("/v3/config"));
assert_route(&router, Method::POST, &admin_path("/v3/service"));
assert_route(&router, Method::GET, &admin_path("/v3/info"));
assert_route(&router, Method::GET, &admin_path("/v3/storageinfo"));
@@ -237,6 +248,15 @@ fn test_admin_alias_paths_match_existing_admin_routes() {
(Method::GET, compat_admin_alias_path("/v3/kms/status")),
(Method::POST, compat_admin_alias_path("/v3/kms/status")),
(Method::GET, compat_admin_alias_path("/v3/kms/key/status")),
(Method::GET, compat_admin_alias_path("/v3/get-config-kv")),
(Method::PUT, compat_admin_alias_path("/v3/set-config-kv")),
(Method::DELETE, compat_admin_alias_path("/v3/del-config-kv")),
(Method::GET, compat_admin_alias_path("/v3/help-config-kv")),
(Method::GET, compat_admin_alias_path("/v3/list-config-history-kv")),
(Method::DELETE, compat_admin_alias_path("/v3/clear-config-history-kv")),
(Method::PUT, compat_admin_alias_path("/v3/restore-config-history-kv")),
(Method::GET, compat_admin_alias_path("/v3/config")),
(Method::PUT, compat_admin_alias_path("/v3/config")),
] {
assert!(
router.contains_compatible_route(method.clone(), &path),