Skip to content

Commit fe97848

Browse files
authored
test(admin): cover pool used-size saturation (rustfs#2863)
1 parent e209fc6 commit fe97848

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

rustfs/src/app/admin_usecase.rs

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

650+
#[test]
651+
fn admin_pool_list_item_saturates_used_size_when_current_exceeds_total() {
652+
let pool = PoolStatus {
653+
id: 0,
654+
cmd_line: "pool-0".to_string(),
655+
last_update: OffsetDateTime::UNIX_EPOCH,
656+
decommission: Some(PoolDecommissionInfo {
657+
total_size: 100,
658+
current_size: 150,
659+
..Default::default()
660+
}),
661+
};
662+
663+
let item = DefaultAdminUsecase::pool_list_item_from_status(pool);
664+
665+
assert_eq!(item.total_size, 100);
666+
assert_eq!(item.current_size, 150);
667+
assert_eq!(item.used_size, 0);
668+
assert_eq!(item.used, 0.0);
669+
}
670+
650671
#[test]
651672
fn admin_pool_list_item_maps_running_decommission_status() {
652673
let pool = PoolStatus {

0 commit comments

Comments
 (0)