mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-31 01:09:23 +00:00
fix(scanner): publish bounded observational usage (#5742)
* fix(scanner): publish bounded observational usage * test(ci): serialize embedded integration ports * test(cache): isolate generation-change timeout * fix(scanner): address observational usage review Co-Authored-By: heihutu <heihutu@gmail.com> --------- Co-authored-by: Anthony Martin <949506+anthonymartin@users.noreply.github.com> Co-authored-by: houseme <housemecn@gmail.com> Co-authored-by: heihutu <heihutu@gmail.com>
This commit is contained in:
@@ -401,6 +401,11 @@ pub struct AccountInfo {
|
||||
pub server: BackendInfo,
|
||||
pub policy: serde_json::Value, // Use iam/policy::parse to parse the result, to be done by the caller.
|
||||
pub buckets: Vec<BucketAccessInfo>,
|
||||
/// Whether the usage values came from a fully converged scanner cycle.
|
||||
/// `false` means the values are a newer structurally complete observation
|
||||
/// while another convergence pass remains pending.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub usage_snapshot_converged: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
@@ -798,6 +803,20 @@ mod tests {
|
||||
assert_eq!(value["object_versions_histogram"], serde_json::json!({}));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn account_info_exposes_observational_usage_state_additively() {
|
||||
let info = AccountInfo {
|
||||
usage_snapshot_converged: Some(false),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let value = serde_json::to_value(&info).unwrap();
|
||||
assert_eq!(value["usage_snapshot_converged"], false);
|
||||
|
||||
let legacy_shape = serde_json::to_value(AccountInfo::default()).unwrap();
|
||||
assert!(!legacy_shape.as_object().unwrap().contains_key("usage_snapshot_converged"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_account_status_try_from_invalid() {
|
||||
let result = AccountStatus::try_from("invalid");
|
||||
|
||||
Reference in New Issue
Block a user