mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-28 16:07:05 +00:00
test(admin): cover orphan resync status cleanup (#2816)
This commit is contained in:
@@ -3382,6 +3382,57 @@ mod tests {
|
|||||||
assert!(state.resync_status.contains_key("remote-b-deployment"));
|
assert!(state.resync_status.contains_key("remote-b-deployment"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_remove_sites_prunes_orphan_resync_status_without_matching_site() {
|
||||||
|
let mut state = SiteReplicationState {
|
||||||
|
name: "local".to_string(),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
state.peers.insert(
|
||||||
|
"remote-a-deployment".to_string(),
|
||||||
|
PeerInfo {
|
||||||
|
deployment_id: "remote-a-deployment".to_string(),
|
||||||
|
..peer("remote-a", "https://remote-a.example.com")
|
||||||
|
},
|
||||||
|
);
|
||||||
|
state.peers.insert(
|
||||||
|
"remote-b-deployment".to_string(),
|
||||||
|
PeerInfo {
|
||||||
|
deployment_id: "remote-b-deployment".to_string(),
|
||||||
|
..peer("remote-b", "https://remote-b.example.com")
|
||||||
|
},
|
||||||
|
);
|
||||||
|
state.resync_status.insert(
|
||||||
|
"remote-a-deployment".to_string(),
|
||||||
|
SRResyncOpStatus {
|
||||||
|
resync_id: "active-a".to_string(),
|
||||||
|
status: "success".to_string(),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
);
|
||||||
|
state.resync_status.insert(
|
||||||
|
"removed-deployment".to_string(),
|
||||||
|
SRResyncOpStatus {
|
||||||
|
resync_id: "orphaned".to_string(),
|
||||||
|
status: "success".to_string(),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
let state = remove_sites(
|
||||||
|
state,
|
||||||
|
SRRemoveReq {
|
||||||
|
site_names: vec!["missing-site".to_string()],
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
assert!(state.peers.contains_key("remote-a-deployment"));
|
||||||
|
assert!(state.peers.contains_key("remote-b-deployment"));
|
||||||
|
assert!(state.resync_status.contains_key("remote-a-deployment"));
|
||||||
|
assert!(!state.resync_status.contains_key("removed-deployment"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_remove_sites_clears_state_when_local_site_is_removed() {
|
fn test_remove_sites_clears_state_when_local_site_is_removed() {
|
||||||
let mut state = SiteReplicationState {
|
let mut state = SiteReplicationState {
|
||||||
|
|||||||
Reference in New Issue
Block a user