mirror of
https://github.com/rustfs/rustfs.git
synced 2026-11-16 13:00:52 +00:00
feat(gateway): serve admin usage and catalog reads
Register data usage, plugin catalog and module-switch GET reads through
the existing AdminBridge and handlers under both admin aliases. Keep
neighboring methods and object-lambda routing on their existing paths.
Validation on 65057691: unchanged-production legacy baseline passed;
restored-source scoped tests passed 78/78. The new native HTTP matrix
covers 28 success and 236 refusal or routing-boundary rows. Exact replies
are pinned for both aliases and ordinary and bucket Hosts.
Three independent no-fault controls and 21 effective mutations passed
in one compiled cohort: selector removal/widening/lambda, each handler
binding, each IAM gate and action, both narrowed data-usage any-of gates,
signature verification, lambda dispatch, response bytes/status/request
id/content type and Keystone precedence. Exact refusal observations also
caught the disabled-key signature mutation. No existing assertion was
removed or weakened.
Gateway and default all-targets Clippy, script tests, test wiring and the
local prepush guards passed. No gateway pin or API changed.
Not verified: production listeners and full middleware, session
credentials, non-default persisted usage/module-switch data, full
workspace tests or CI.
This commit is contained in:
@@ -936,6 +936,12 @@ pub(crate) fn claims_native_admin_route(method: &Method, uri: &Uri) -> bool {
|
||||
| "/minio/admin/v4/runtime/capabilities"
|
||||
| "/rustfs/admin/v3/object-data-cache/stats"
|
||||
| "/minio/admin/v3/object-data-cache/stats"
|
||||
| "/rustfs/admin/v3/datausageinfo"
|
||||
| "/minio/admin/v3/datausageinfo"
|
||||
| "/rustfs/admin/v4/plugins/catalog"
|
||||
| "/minio/admin/v4/plugins/catalog"
|
||||
| "/rustfs/admin/v3/module-switches"
|
||||
| "/minio/admin/v3/module-switches"
|
||||
)
|
||||
&& parse_object_lambda_request(method, uri).is_none()
|
||||
}
|
||||
|
||||
@@ -17,8 +17,10 @@
|
||||
//! downstream: the gateway signature verifier and the real admin handlers.
|
||||
|
||||
use super::{GatewayAssembly, GatewayAssemblyError, GatewayStack};
|
||||
use crate::admin::handlers::module_switch::GetModuleSwitchesHandler;
|
||||
use crate::admin::handlers::object_data_cache::ObjectDataCacheStatsHandler;
|
||||
use crate::admin::handlers::system::{RuntimeCapabilitiesHandler, ServerInfoHandler, StorageInfoHandler};
|
||||
use crate::admin::handlers::plugins_catalog::GetPluginCatalogHandler;
|
||||
use crate::admin::handlers::system::{DataUsageInfoHandler, RuntimeCapabilitiesHandler, ServerInfoHandler, StorageInfoHandler};
|
||||
use crate::admin::operation::{AdminRequest, AdminResponse, Operation as AdminHandler};
|
||||
use crate::app::RequestEnvelope;
|
||||
use crate::runtime_sources::ServerContextSlot;
|
||||
@@ -29,15 +31,19 @@ use rustfs_gateway::{Decision, Handler, HandlerResult, Operation, Req, RequestCo
|
||||
use rustfs_gateway_adapter::{IamKeyLookup, RootSource};
|
||||
use rustfs_gateway_core::dialect::{ClaimedRoute, Dialect, DialectBuilder, DialectOverlay, OverlayRow};
|
||||
use rustfs_gateway_dialect_rustfs_admin::ops::{
|
||||
get_v3_info::GetV3Info, get_v3_object_data_cache_stats::GetV3ObjectDataCacheStats, get_v3_storageinfo::GetV3Storageinfo,
|
||||
get_v4_runtime_capabilities::GetV4RuntimeCapabilities,
|
||||
get_v3_datausageinfo::GetV3Datausageinfo, get_v3_info::GetV3Info, get_v3_module_switches::GetV3ModuleSwitches,
|
||||
get_v3_object_data_cache_stats::GetV3ObjectDataCacheStats, get_v3_storageinfo::GetV3Storageinfo,
|
||||
get_v4_plugins_catalog::GetV4PluginsCatalog, get_v4_runtime_capabilities::GetV4RuntimeCapabilities,
|
||||
};
|
||||
use rustfs_gateway_dialect_rustfs_admin::{AdminOperation, AdminResponse as WireResponse, CLAIMS, OVERLAY};
|
||||
use rustfs_s3_types::{Body, S3Result, s3_error};
|
||||
use std::sync::{Arc, OnceLock};
|
||||
|
||||
const OPERATIONS: [&str; 4] = [
|
||||
const OPERATIONS: [&str; 7] = [
|
||||
GetV3Info::NAME,
|
||||
GetV3Datausageinfo::NAME,
|
||||
GetV4PluginsCatalog::NAME,
|
||||
GetV3ModuleSwitches::NAME,
|
||||
GetV3Storageinfo::NAME,
|
||||
GetV4RuntimeCapabilities::NAME,
|
||||
GetV3ObjectDataCacheStats::NAME,
|
||||
@@ -68,7 +74,10 @@ pub(super) fn dialect() -> Result<Dialect, GatewayAssemblyError> {
|
||||
let builder = declare::<GetV3Info>(Dialect::assemble(overlay));
|
||||
let builder = declare::<GetV3Storageinfo>(builder);
|
||||
let builder = declare::<GetV4RuntimeCapabilities>(builder);
|
||||
declare::<GetV3ObjectDataCacheStats>(builder)
|
||||
let builder = declare::<GetV3ObjectDataCacheStats>(builder);
|
||||
let builder = declare::<GetV3Datausageinfo>(builder);
|
||||
let builder = declare::<GetV4PluginsCatalog>(builder);
|
||||
declare::<GetV3ModuleSwitches>(builder)
|
||||
.build()
|
||||
.map_err(GatewayAssemblyError::AdminDialect)
|
||||
}
|
||||
@@ -101,9 +110,21 @@ pub(super) fn assemble(
|
||||
handler: &RuntimeCapabilitiesHandler {},
|
||||
}))
|
||||
.register::<GetV3ObjectDataCacheStats, _>(Arc::new(AdminBridge {
|
||||
server_ctx: assembly.server_ctx,
|
||||
server_ctx: assembly.server_ctx.clone(),
|
||||
handler: &ObjectDataCacheStatsHandler {},
|
||||
}))
|
||||
.register::<GetV3Datausageinfo, _>(Arc::new(AdminBridge {
|
||||
server_ctx: assembly.server_ctx.clone(),
|
||||
handler: &DataUsageInfoHandler {},
|
||||
}))
|
||||
.register::<GetV4PluginsCatalog, _>(Arc::new(AdminBridge {
|
||||
server_ctx: assembly.server_ctx.clone(),
|
||||
handler: &GetPluginCatalogHandler {},
|
||||
}))
|
||||
.register::<GetV3ModuleSwitches, _>(Arc::new(AdminBridge {
|
||||
server_ctx: assembly.server_ctx,
|
||||
handler: &GetModuleSwitchesHandler {},
|
||||
}))
|
||||
.build()
|
||||
.map_err(GatewayAssemblyError::Service)?;
|
||||
Ok(GatewayStack {
|
||||
|
||||
@@ -28,8 +28,9 @@ use rustfs_gateway::Answer;
|
||||
use rustfs_gateway::{Decision, Handler, HandlerResult, Operation, PathStyleOnly, Req, Resp, decide_with};
|
||||
use rustfs_gateway_dialect_rustfs_admin::AdminResponse as WireResponse;
|
||||
use rustfs_gateway_dialect_rustfs_admin::ops::{
|
||||
get_v3_info::GetV3Info, get_v3_object_data_cache_stats::GetV3ObjectDataCacheStats, get_v3_storageinfo::GetV3Storageinfo,
|
||||
get_v4_runtime_capabilities::GetV4RuntimeCapabilities,
|
||||
get_v3_datausageinfo::GetV3Datausageinfo, get_v3_info::GetV3Info, get_v3_module_switches::GetV3ModuleSwitches,
|
||||
get_v3_object_data_cache_stats::GetV3ObjectDataCacheStats, get_v3_storageinfo::GetV3Storageinfo,
|
||||
get_v4_plugins_catalog::GetV4PluginsCatalog, get_v4_runtime_capabilities::GetV4RuntimeCapabilities,
|
||||
};
|
||||
use rustfs_s3_types::Body;
|
||||
use rustfs_trusted_proxies::ClientInfo;
|
||||
@@ -41,6 +42,9 @@ fn native_admin_registers_only_system_reads_and_both_claims() {
|
||||
let dialect = dialect().unwrap();
|
||||
let mut expected = [
|
||||
GetV3Info::NAME,
|
||||
GetV3Datausageinfo::NAME,
|
||||
GetV4PluginsCatalog::NAME,
|
||||
GetV3ModuleSwitches::NAME,
|
||||
GetV3Storageinfo::NAME,
|
||||
GetV4RuntimeCapabilities::NAME,
|
||||
GetV3ObjectDataCacheStats::NAME,
|
||||
@@ -120,6 +124,9 @@ async fn native_admin_envelope_preserves_raw_alias_host_facts_and_optional_req_i
|
||||
service: builder
|
||||
.host_resolver(PathStyleOnly)
|
||||
.dialect(&dialect().unwrap())
|
||||
.register::<GetV3Datausageinfo, _>(Arc::new(Capture(captured.clone())))
|
||||
.register::<GetV4PluginsCatalog, _>(Arc::new(Capture(captured.clone())))
|
||||
.register::<GetV3ModuleSwitches, _>(Arc::new(Capture(captured.clone())))
|
||||
.register::<GetV3Info, _>(Arc::new(Capture(captured.clone())))
|
||||
.register::<GetV3Storageinfo, _>(Arc::new(Capture(captured.clone())))
|
||||
.register::<GetV4RuntimeCapabilities, _>(Arc::new(Capture(captured.clone())))
|
||||
@@ -128,6 +135,9 @@ async fn native_admin_envelope_preserves_raw_alias_host_facts_and_optional_req_i
|
||||
.unwrap(),
|
||||
};
|
||||
let paths = [
|
||||
"/minio/admin/v3/datausageinfo",
|
||||
"/minio/admin/v4/plugins/catalog",
|
||||
"/minio/admin/v3/module-switches",
|
||||
"/minio/admin/v3/info",
|
||||
"/minio/admin/v3/storageinfo",
|
||||
"/minio/admin/v4/runtime/capabilities",
|
||||
@@ -176,7 +186,13 @@ async fn native_admin_envelope_preserves_raw_alias_host_facts_and_optional_req_i
|
||||
async fn native_admin_authenticated_request_refuses_an_uninstalled_server_context() {
|
||||
let stack = assemble(assembly(), Arc::new(ScriptedIam { ready: false }), root().source()).unwrap();
|
||||
for path in [
|
||||
"/rustfs/admin/v3/datausageinfo",
|
||||
"/rustfs/admin/v4/plugins/catalog",
|
||||
"/rustfs/admin/v3/module-switches",
|
||||
"/rustfs/admin/v3/info",
|
||||
"/minio/admin/v3/datausageinfo",
|
||||
"/minio/admin/v4/plugins/catalog",
|
||||
"/minio/admin/v3/module-switches",
|
||||
"/minio/admin/v3/info",
|
||||
"/rustfs/admin/v3/storageinfo",
|
||||
"/minio/admin/v3/storageinfo",
|
||||
|
||||
+239
-1
@@ -4550,6 +4550,10 @@ mod tests {
|
||||
("storage-allowed", Some("admin:StorageInfo"), false, true, false),
|
||||
("storage-denied", Some("admin:StorageInfo"), true, true, false),
|
||||
("storage-proxy", Some("admin:StorageInfo"), false, true, true),
|
||||
("usage-allowed", Some("admin:DataUsageInfo"), false, true, false),
|
||||
("usage-denied", Some("admin:DataUsageInfo"), true, true, false),
|
||||
("list-allowed", Some("s3:ListBucket"), false, true, false),
|
||||
("list-denied", Some("s3:ListBucket"), true, true, false),
|
||||
] {
|
||||
iam.create_user(
|
||||
key,
|
||||
@@ -4567,12 +4571,19 @@ mod tests {
|
||||
.unwrap();
|
||||
if let Some(action) = action {
|
||||
let mut statement = serde_json::json!({"Effect":"Allow","Action":action});
|
||||
if action.starts_with("s3:") {
|
||||
statement["Resource"] = serde_json::json!("*");
|
||||
}
|
||||
if source_ip {
|
||||
statement["Condition"] = serde_json::json!({"IpAddress":{"aws:SourceIp":"10.0.0.0/8"}});
|
||||
}
|
||||
let mut statements = vec![statement];
|
||||
if denied {
|
||||
statements.push(serde_json::json!({"Effect":"Deny","Action":action}));
|
||||
statements.push(if action.starts_with("s3:") {
|
||||
serde_json::json!({"Effect":"Deny","Action":action,"Resource":"*"})
|
||||
} else {
|
||||
serde_json::json!({"Effect":"Deny","Action":action})
|
||||
});
|
||||
}
|
||||
let document = serde_json::json!({"Version":"2012-10-17","Statement":statements});
|
||||
iam.set_policy(key, Policy::parse_config(&serde_json::to_vec(&document).unwrap()).unwrap())
|
||||
@@ -4603,6 +4614,233 @@ mod tests {
|
||||
(env, slot, legacy)
|
||||
}
|
||||
|
||||
const CATALOG_READS: [&str; 3] = ["/v3/datausageinfo", "/v4/plugins/catalog", "/v3/module-switches"];
|
||||
|
||||
// Each caller uses a fresh process because ECStore publishes once-only endpoint state.
|
||||
async fn catalog_reads_contract(use_native: bool) {
|
||||
let (_env, slot, legacy) = admin_fixture().await;
|
||||
let mut config = config::Config::new("127.0.0.1:9001", Vec::new());
|
||||
config.s3_stack = config::S3Stack::Gateway;
|
||||
config.console_enable = false;
|
||||
let edge = select_s3_stack(&config, legacy.clone(), || Ok(assembly(slot))).unwrap();
|
||||
let mut failures = Vec::new();
|
||||
let mut check = |condition: bool, label: String| {
|
||||
if !condition {
|
||||
failures.push(label);
|
||||
}
|
||||
};
|
||||
for suffix in CATALOG_READS {
|
||||
for prefix in ["/rustfs/admin", "/minio/admin"] {
|
||||
let path = format!("{prefix}{suffix}");
|
||||
for host in ["localhost", "bucket.s3.example.test"] {
|
||||
let root =
|
||||
answer(legacy.clone(), signed(&path, "detail=a%2Fb", host, ROOT, ROOT_SECRET, Signed::Header)).await;
|
||||
check(root.0 == StatusCode::OK, format!("root {path} {host}: {} {:?}", root.0, refusal(&root.2)));
|
||||
let expected: serde_json::Value = serde_json::from_slice(&root.2).unwrap();
|
||||
eprintln!("catalog-baseline {path} {host}: status={} headers={:?} json={expected}", root.0, root.1);
|
||||
for key in [
|
||||
ROOT,
|
||||
"info-allowed",
|
||||
"usage-allowed",
|
||||
"list-allowed",
|
||||
"info-no-policy",
|
||||
"info-denied",
|
||||
"usage-denied",
|
||||
"list-denied",
|
||||
"storage-allowed",
|
||||
] {
|
||||
let allowed = key == ROOT
|
||||
|| if suffix == "/v3/datausageinfo" {
|
||||
key == "usage-allowed" || key == "list-allowed"
|
||||
} else {
|
||||
key == "info-allowed"
|
||||
};
|
||||
let secret = if key == ROOT { ROOT_SECRET } else { USER_SECRET };
|
||||
let request = || signed(&path, "detail=a%2Fb", host, key, secret, Signed::Header);
|
||||
let old = answer(legacy.clone(), request()).await;
|
||||
let new = if use_native {
|
||||
answer(edge.clone(), request()).await
|
||||
} else {
|
||||
answer(legacy.clone(), request()).await
|
||||
};
|
||||
let label = format!("{key} {path} {host}");
|
||||
let status = if allowed { StatusCode::OK } else { StatusCode::FORBIDDEN };
|
||||
check(
|
||||
old.0 == status && new.0 == status,
|
||||
format!("{label}: status legacy={} selected={}", old.0, new.0),
|
||||
);
|
||||
if allowed && old.0 == status && new.0 == status {
|
||||
check(
|
||||
old.1.get(http::header::CONTENT_TYPE) == new.1.get(http::header::CONTENT_TYPE)
|
||||
&& new.1[http::header::CONTENT_TYPE] == "application/json",
|
||||
format!("{label}: content type"),
|
||||
);
|
||||
check(new.1.get("x-request-id").is_some_and(|v| v == REQUEST_ID), format!("{label}: request id"));
|
||||
let old: serde_json::Value = serde_json::from_slice(&old.2).unwrap();
|
||||
let new: serde_json::Value = serde_json::from_slice(&new.2).unwrap();
|
||||
check(
|
||||
old == expected && new == expected,
|
||||
format!("{label}: complete JSON old={old} new={new} root={expected}"),
|
||||
);
|
||||
} else if !allowed {
|
||||
check(
|
||||
refusal(&old.2).0 == "AccessDenied" && refusal(&new.2) == refusal(&old.2),
|
||||
format!("{label}: refusal"),
|
||||
);
|
||||
}
|
||||
}
|
||||
for (label, key, secret, anonymous, form, code) in [
|
||||
("disabled", "info-disabled", USER_SECRET, false, Signed::Header, "InvalidAccessKeyId"),
|
||||
(
|
||||
"unknown",
|
||||
"missing-catalog-user",
|
||||
USER_SECRET,
|
||||
false,
|
||||
Signed::Header,
|
||||
"InvalidAccessKeyId",
|
||||
),
|
||||
(
|
||||
"bad-signature",
|
||||
ROOT,
|
||||
"wrong-catalog-secret",
|
||||
false,
|
||||
Signed::Header,
|
||||
"SignatureDoesNotMatch",
|
||||
),
|
||||
("anonymous", ROOT, ROOT_SECRET, true, Signed::Header, "AccessDenied"),
|
||||
("presigned", ROOT, ROOT_SECRET, false, Signed::Query, "AccessDenied"),
|
||||
] {
|
||||
let request = || {
|
||||
if anonymous {
|
||||
HttpRequest::builder()
|
||||
.method(Method::GET)
|
||||
.uri(&path)
|
||||
.header("host", host)
|
||||
.body(Empty::new())
|
||||
.unwrap()
|
||||
} else {
|
||||
signed(&path, "", host, key, secret, form)
|
||||
}
|
||||
};
|
||||
let old = answer(legacy.clone(), request()).await;
|
||||
let new = if use_native {
|
||||
answer(edge.clone(), request()).await
|
||||
} else {
|
||||
answer(legacy.clone(), request()).await
|
||||
};
|
||||
eprintln!(
|
||||
"catalog-compare {label} {path} {host}: legacy={} {:?}, selected={} {:?}",
|
||||
old.0,
|
||||
refusal(&old.2),
|
||||
new.0,
|
||||
refusal(&new.2)
|
||||
);
|
||||
let legacy_status = if label == "presigned" {
|
||||
StatusCode::OK
|
||||
} else {
|
||||
StatusCode::FORBIDDEN
|
||||
};
|
||||
check(old.0 == legacy_status, format!("{label} {path}: legacy status {}", old.0));
|
||||
if use_native {
|
||||
check(
|
||||
new.0 == StatusCode::FORBIDDEN && refusal(&new.2).0 == code,
|
||||
format!("{label} {path}: native status/code {} {:?}", new.0, refusal(&new.2)),
|
||||
);
|
||||
match label {
|
||||
"disabled" | "anonymous" => {
|
||||
let (old_message, new_message) = if label == "disabled" {
|
||||
("check key failed", "The Access Key Id you provided does not exist in our records.")
|
||||
} else {
|
||||
("Signature is required", "the request is not allowed")
|
||||
};
|
||||
check(
|
||||
refusal(&old.2) == (code.to_owned(), old_message.to_owned())
|
||||
&& refusal(&new.2) == (code.to_owned(), new_message.to_owned()),
|
||||
format!("{label} {path} {host}: exact refusal messages"),
|
||||
);
|
||||
}
|
||||
"presigned" => check(
|
||||
refusal(&old.2) == (String::new(), String::new())
|
||||
&& refusal(&new.2)
|
||||
== ("AccessDenied".to_owned(), "the request is not allowed".to_owned()),
|
||||
format!("{label} {path} {host}: admin signature floor"),
|
||||
),
|
||||
_ => check(refusal(&old.2) == refusal(&new.2), format!("{label} {path}: exact refusal")),
|
||||
}
|
||||
} else {
|
||||
check(
|
||||
old.0 == new.0 && refusal(&old.2) == refusal(&new.2),
|
||||
format!("{label} {path}: baseline repeat"),
|
||||
);
|
||||
}
|
||||
}
|
||||
for query in ["lambdaArn=arn", "lambdaArn=", "lambdaArn"] {
|
||||
let request = || signed(&path, query, host, ROOT, ROOT_SECRET, Signed::Header);
|
||||
let old = answer(legacy.clone(), request()).await;
|
||||
let new = if use_native {
|
||||
answer(edge.clone(), request()).await
|
||||
} else {
|
||||
answer(legacy.clone(), request()).await
|
||||
};
|
||||
check(
|
||||
old.0 != StatusCode::OK && old.0 == new.0 && refusal(&old.2) == refusal(&new.2),
|
||||
format!("{path}?{query} {host}: lambda precedence"),
|
||||
);
|
||||
}
|
||||
for (method, tail) in [
|
||||
(Method::PUT, ""),
|
||||
(Method::POST, ""),
|
||||
(Method::HEAD, ""),
|
||||
(Method::GET, "/"),
|
||||
(Method::GET, "-neighbor"),
|
||||
] {
|
||||
let target = format!("{path}{tail}");
|
||||
let request = || {
|
||||
let mut headers = HeaderMap::new();
|
||||
headers.insert(http::header::HOST, host.parse().unwrap());
|
||||
signed_request_with_headers(
|
||||
Signed::Header,
|
||||
method.clone(),
|
||||
&target,
|
||||
"",
|
||||
ROOT,
|
||||
ROOT_SECRET,
|
||||
headers,
|
||||
)
|
||||
};
|
||||
let old = answer(legacy.clone(), request()).await;
|
||||
let new = if use_native {
|
||||
answer(edge.clone(), request()).await
|
||||
} else {
|
||||
answer(legacy.clone(), request()).await
|
||||
};
|
||||
eprintln!(
|
||||
"catalog-neighbor {method} {target} {host}: legacy={} {:?}, selected={} {:?}",
|
||||
old.0,
|
||||
refusal(&old.2),
|
||||
new.0,
|
||||
refusal(&new.2)
|
||||
);
|
||||
check(old.0 == new.0 && old.2 == new.2, format!("{method} {target} {host}: adjacent route"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
assert!(failures.is_empty(), "{}", failures.join("\n"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[serial_test::serial]
|
||||
async fn native_admin_catalog_reads_legacy_baseline() {
|
||||
catalog_reads_contract(false).await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[serial_test::serial]
|
||||
async fn native_admin_catalog_reads_real_signature_iam_and_wire() {
|
||||
catalog_reads_contract(true).await;
|
||||
}
|
||||
|
||||
const SYSTEM_READS: [(&str, &str); 3] = [
|
||||
("/v3/storageinfo", "storage"),
|
||||
("/v4/runtime/capabilities", "info"),
|
||||
|
||||
@@ -316,6 +316,12 @@ mod tests {
|
||||
for (method, target) in [
|
||||
(Method::GET, "/rustfs/admin/v3/info"),
|
||||
(Method::GET, "/minio/admin/v3/info"),
|
||||
(Method::GET, "/rustfs/admin/v3/datausageinfo"),
|
||||
(Method::GET, "/minio/admin/v3/datausageinfo"),
|
||||
(Method::GET, "/rustfs/admin/v4/plugins/catalog"),
|
||||
(Method::GET, "/minio/admin/v4/plugins/catalog"),
|
||||
(Method::GET, "/rustfs/admin/v3/module-switches"),
|
||||
(Method::GET, "/minio/admin/v3/module-switches"),
|
||||
(Method::POST, "/?Action=AssumeRole&Version=2011-06-15"),
|
||||
(Method::GET, "/bucket?replication-metrics"),
|
||||
(Method::GET, console_path.as_str()),
|
||||
@@ -365,7 +371,9 @@ mod tests {
|
||||
assert_eq!(response.body(), &"console");
|
||||
assert_eq!(legacy_calls.load(Ordering::SeqCst), 0);
|
||||
assert_eq!(console_calls.load(Ordering::SeqCst), 1);
|
||||
} else if stack == S3Stack::Gateway && matches!(target, "/rustfs/admin/v3/info" | "/minio/admin/v3/info") {
|
||||
} else if stack == S3Stack::Gateway
|
||||
&& (target.starts_with("/rustfs/admin/") || target.starts_with("/minio/admin/"))
|
||||
{
|
||||
assert_eq!(response.status(), StatusCode::OK);
|
||||
assert_eq!(response.body(), &"admin");
|
||||
assert_eq!(legacy_calls.load(Ordering::SeqCst), 0);
|
||||
@@ -382,7 +390,7 @@ mod tests {
|
||||
usize::from(
|
||||
stack == S3Stack::Gateway
|
||||
&& header.is_none()
|
||||
&& matches!(target, "/rustfs/admin/v3/info" | "/minio/admin/v3/info")
|
||||
&& (target.starts_with("/rustfs/admin/") || target.starts_with("/minio/admin/"))
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -408,6 +416,12 @@ mod tests {
|
||||
let mut service = gateway_stack().with_native_admin(Some(Named("admin")));
|
||||
for host in ["localhost", "bucket.s3.example.test"] {
|
||||
for target in [
|
||||
"/rustfs/admin/v3/datausageinfo",
|
||||
"/minio/admin/v3/datausageinfo?detail=1",
|
||||
"/rustfs/admin/v4/plugins/catalog",
|
||||
"/minio/admin/v4/plugins/catalog?detail=1",
|
||||
"/rustfs/admin/v3/module-switches",
|
||||
"/minio/admin/v3/module-switches?detail=1",
|
||||
"/rustfs/admin/v3/info",
|
||||
"/minio/admin/v3/info?detail=1",
|
||||
"/rustfs/admin/v3/storageinfo",
|
||||
@@ -426,10 +440,20 @@ mod tests {
|
||||
assert_eq!(answered_by(&mut service, req).await, "admin", "{host} {target}");
|
||||
}
|
||||
}
|
||||
for suffix in ["/v3/storageinfo", "/v4/runtime/capabilities", "/v3/object-data-cache/stats"] {
|
||||
for suffix in [
|
||||
"/v3/storageinfo",
|
||||
"/v4/runtime/capabilities",
|
||||
"/v3/object-data-cache/stats",
|
||||
"/v3/datausageinfo",
|
||||
"/v4/plugins/catalog",
|
||||
"/v3/module-switches",
|
||||
] {
|
||||
for prefix in ["/rustfs/admin", "/minio/admin"] {
|
||||
for (method, tail) in [
|
||||
(Method::POST, ""),
|
||||
(Method::PUT, ""),
|
||||
(Method::HEAD, ""),
|
||||
(Method::DELETE, ""),
|
||||
(Method::GET, "/"),
|
||||
(Method::GET, "-neighbor"),
|
||||
(Method::GET, "?lambdaArn=arn"),
|
||||
|
||||
Reference in New Issue
Block a user