mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Fix flaky test_rpc_block_reprocessing (#7595)
The test occasionally fails, likely because the 10ms fixed delay after block processing isn't insufficient when the system is under load. https://github.com/sigp/lighthouse/pull/7522#issuecomment-2914595667 Replace single assertion with retry loop.
This commit is contained in:
@@ -1252,11 +1252,25 @@ async fn test_rpc_block_reprocessing() {
|
|||||||
tokio::time::sleep(QUEUED_RPC_BLOCK_DELAY).await;
|
tokio::time::sleep(QUEUED_RPC_BLOCK_DELAY).await;
|
||||||
|
|
||||||
rig.assert_event_journal(&[WorkType::RpcBlock.into()]).await;
|
rig.assert_event_journal(&[WorkType::RpcBlock.into()]).await;
|
||||||
// Add an extra delay for block processing
|
|
||||||
tokio::time::sleep(Duration::from_millis(10)).await;
|
let max_retries = 3;
|
||||||
// head should update to next block now since the duplicate
|
let mut success = false;
|
||||||
// cache handle was dropped.
|
for _ in 0..max_retries {
|
||||||
assert_eq!(next_block_root, rig.head_root());
|
// Add an extra delay for block processing
|
||||||
|
tokio::time::sleep(Duration::from_millis(10)).await;
|
||||||
|
// head should update to the next block now since the duplicate
|
||||||
|
// cache handle was dropped.
|
||||||
|
if next_block_root == rig.head_root() {
|
||||||
|
success = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert!(
|
||||||
|
success,
|
||||||
|
"expected head_root to be {:?} but was {:?}",
|
||||||
|
next_block_root,
|
||||||
|
rig.head_root()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Ensure that backfill batches get rate-limited and processing is scheduled at specified intervals.
|
/// Ensure that backfill batches get rate-limited and processing is scheduled at specified intervals.
|
||||||
|
|||||||
Reference in New Issue
Block a user