fetcher/state: Extend test for same RID, different nodes

The extension of the test shows that Node B's fetch cannot be dequeued because
the RID is in the active fetch set.

It can then be dequeued once Node A has been fetched from.
This commit is contained in:
Fintan Halpenny 2026-06-22 17:52:58 +01:00
parent 4a05e52ba1
commit df1e3e6129
1 changed files with 11 additions and 0 deletions

View File

@ -101,6 +101,17 @@ fn fetch_same_repo_different_nodes_queues_second() {
let active = state.get_active_fetch(&repo_1); let active = state.get_active_fetch(&repo_1);
assert!(active.is_some()); assert!(active.is_some());
assert_eq!(*active.unwrap().from(), node_a); assert_eq!(*active.unwrap().from(), node_a);
// Cannot dequeue for node_b since the repo is active
assert!(state.dequeue(&node_b).is_none());
// Clearing the orphaned entry (as a fix, or a restart, would) unblocks it.
state.fetched(command::Fetched {
from: node_a,
rid: repo_1,
});
let dequeued = state.dequeue(&node_b).expect("repo is fetchable again");
assert_eq!(dequeued.rid, repo_1);
} }
#[test] #[test]