mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-05-29 18:51:22 +00:00
extend full_bucket_discard_pending test
This commit is contained in:
parent
e53e4b9059
commit
c895ec386a
@ -479,14 +479,22 @@ mod tests {
|
|||||||
Some((&first_disconnected, NodeStatus::Connected)),
|
Some((&first_disconnected, NodeStatus::Connected)),
|
||||||
bucket.iter().last()
|
bucket.iter().last()
|
||||||
);
|
);
|
||||||
/*
|
|
||||||
assert_eq!(
|
let num_connected = bucket
|
||||||
bucket.position(&first_disconnected.key).map(|p| p.0),
|
.iter()
|
||||||
bucket.first_connected_pos
|
.filter(|(_, s)| *s == NodeStatus::Connected)
|
||||||
);
|
.count();
|
||||||
assert_eq!(1, bucket.num_connected());
|
let num_disconnected = bucket
|
||||||
assert_eq!(K_VALUE.get() - 1, bucket.num_disconnected());
|
.iter()
|
||||||
*/
|
.filter(|(_, s)| *s == NodeStatus::Disconnected)
|
||||||
|
.count();
|
||||||
|
let position = bucket
|
||||||
|
.iter()
|
||||||
|
.position(|(n, _)| n.key.as_ref() == first_disconnected.key.as_ref());
|
||||||
|
|
||||||
|
assert_eq!(1, num_connected);
|
||||||
|
assert_eq!(K_VALUE.get() - 1, num_disconnected);
|
||||||
|
assert_eq!(position, Some(num_disconnected));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user