mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-26 08:18:18 +00:00
test(admin): cover pools list response serialization (#2862)
Signed-off-by: houseme <housemecn@gmail.com> Co-authored-by: houseme <housemecn@gmail.com>
This commit is contained in:
@@ -647,6 +647,33 @@ mod tests {
|
||||
assert_eq!(item.status, "active");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn admin_pool_list_item_serializes_admin_api_fields() {
|
||||
let item = DefaultAdminUsecase::pool_list_item_from_status(PoolStatus {
|
||||
id: 1,
|
||||
cmd_line: "pool-1".to_string(),
|
||||
last_update: OffsetDateTime::UNIX_EPOCH,
|
||||
decommission: None,
|
||||
});
|
||||
|
||||
let value = serde_json::to_value(item).unwrap();
|
||||
|
||||
assert_eq!(
|
||||
value,
|
||||
serde_json::json!({
|
||||
"id": 1,
|
||||
"cmdline": "pool-1",
|
||||
"lastUpdate": "1970-01-01T00:00:00Z",
|
||||
"totalSize": 0,
|
||||
"currentSize": 0,
|
||||
"usedSize": 0,
|
||||
"used": 0.0,
|
||||
"status": "active",
|
||||
"decommissionInfo": null
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn admin_pool_list_item_saturates_used_size_when_current_exceeds_total() {
|
||||
let pool = PoolStatus {
|
||||
|
||||
Reference in New Issue
Block a user