Skip to content

Commit 61bd569

Browse files
overtruehouseme
andauthored
test(admin): cover pools list response serialization (rustfs#2862)
Signed-off-by: houseme <housemecn@gmail.com> Co-authored-by: houseme <housemecn@gmail.com>
1 parent 44d2b6a commit 61bd569

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

rustfs/src/app/admin_usecase.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,33 @@ mod tests {
647647
assert_eq!(item.status, "active");
648648
}
649649

650+
#[test]
651+
fn admin_pool_list_item_serializes_admin_api_fields() {
652+
let item = DefaultAdminUsecase::pool_list_item_from_status(PoolStatus {
653+
id: 1,
654+
cmd_line: "pool-1".to_string(),
655+
last_update: OffsetDateTime::UNIX_EPOCH,
656+
decommission: None,
657+
});
658+
659+
let value = serde_json::to_value(item).unwrap();
660+
661+
assert_eq!(
662+
value,
663+
serde_json::json!({
664+
"id": 1,
665+
"cmdline": "pool-1",
666+
"lastUpdate": "1970-01-01T00:00:00Z",
667+
"totalSize": 0,
668+
"currentSize": 0,
669+
"usedSize": 0,
670+
"used": 0.0,
671+
"status": "active",
672+
"decommissionInfo": null
673+
})
674+
);
675+
}
676+
650677
#[test]
651678
fn admin_pool_list_item_saturates_used_size_when_current_exceeds_total() {
652679
let pool = PoolStatus {

0 commit comments

Comments
 (0)