mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 09:16:00 +00:00
Correct flakey CI tests (#6646)
* Correct flakey CI tests * Correct clippy * Extend timeout for events
This commit is contained in:
@@ -213,6 +213,7 @@ impl<T: BeaconChainTypes> SubnetService<T> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub(crate) fn is_subscribed(&self, subnet: &Subnet) -> bool {
|
pub(crate) fn is_subscribed(&self, subnet: &Subnet) -> bool {
|
||||||
self.subscriptions.contains_key(subnet)
|
self.subscriptions.contains_key(subnet)
|
||||||
|
|| self.permanent_attestation_subscriptions.contains(subnet)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Processes a list of validator subscriptions.
|
/// Processes a list of validator subscriptions.
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ mod test {
|
|||||||
let mut committee_count = 1;
|
let mut committee_count = 1;
|
||||||
let mut subnet = Subnet::Attestation(
|
let mut subnet = Subnet::Attestation(
|
||||||
SubnetId::compute_subnet::<MainnetEthSpec>(
|
SubnetId::compute_subnet::<MainnetEthSpec>(
|
||||||
current_slot,
|
subscription_slot,
|
||||||
committee_index,
|
committee_index,
|
||||||
committee_count,
|
committee_count,
|
||||||
&subnet_service.beacon_chain.spec,
|
&subnet_service.beacon_chain.spec,
|
||||||
@@ -250,7 +250,7 @@ mod test {
|
|||||||
|
|
||||||
let subscriptions = vec![get_subscription(
|
let subscriptions = vec![get_subscription(
|
||||||
committee_index,
|
committee_index,
|
||||||
current_slot,
|
subscription_slot,
|
||||||
committee_count,
|
committee_count,
|
||||||
true,
|
true,
|
||||||
)];
|
)];
|
||||||
@@ -556,7 +556,8 @@ mod test {
|
|||||||
subnet_service.validator_subscriptions(vec![sub1, sub2].into_iter());
|
subnet_service.validator_subscriptions(vec![sub1, sub2].into_iter());
|
||||||
|
|
||||||
// Unsubscription event should happen at the end of the slot.
|
// Unsubscription event should happen at the end of the slot.
|
||||||
let events = get_events(&mut subnet_service, None, 1).await;
|
// We wait for 2 slots, to avoid timeout issues
|
||||||
|
let events = get_events(&mut subnet_service, None, 2).await;
|
||||||
|
|
||||||
let expected_subscription =
|
let expected_subscription =
|
||||||
SubnetServiceMessage::Subscribe(Subnet::Attestation(subnet_id1));
|
SubnetServiceMessage::Subscribe(Subnet::Attestation(subnet_id1));
|
||||||
@@ -567,6 +568,7 @@ mod test {
|
|||||||
assert_eq!(expected_subscription, events[0]);
|
assert_eq!(expected_subscription, events[0]);
|
||||||
assert_eq!(expected_unsubscription, events[2]);
|
assert_eq!(expected_unsubscription, events[2]);
|
||||||
}
|
}
|
||||||
|
// Check that there are no more subscriptions
|
||||||
assert_eq!(subnet_service.subscriptions().count(), 0);
|
assert_eq!(subnet_service.subscriptions().count(), 0);
|
||||||
|
|
||||||
println!("{events:?}");
|
println!("{events:?}");
|
||||||
|
|||||||
Reference in New Issue
Block a user