fix: improve TestSimulatedBeaconSendWithdrawals reliability (fixes #31169)

- Reduced block generation period from 1s to 0.5s to speed up block production.
- Increased test timeout from 12s to 30s to ensure completion.

The changes prevent intermittent timeouts in the flaky test while maintaining the test's original logic.
This commit is contained in:
hzq12177 2025-02-19 01:04:19 +08:00
parent 864e717b56
commit a134f53f0b

View file

@ -86,7 +86,8 @@ func TestSimulatedBeaconSendWithdrawals(t *testing.T) {
// short period (1 second) for testing purposes
var gasLimit uint64 = 10_000_000
genesis := core.DeveloperGenesisBlock(gasLimit, &testAddr)
node, ethService, mock := startSimulatedBeaconEthService(t, genesis, 1)
// Increase block generation frequency by reducing the period to 0.5 seconds
node, ethService, mock := startSimulatedBeaconEthService(t, genesis, 0.5)
_ = mock
defer node.Close()
@ -119,7 +120,8 @@ func TestSimulatedBeaconSendWithdrawals(t *testing.T) {
includedTxs := make(map[common.Hash]struct{})
var includedWithdrawals []uint64
timer := time.NewTimer(12 * time.Second)
// Increase timeout to 30 seconds to ensure the test has enough time to complete
timer := time.NewTimer(30 * time.Second)
for {
select {
case ev := <-chainHeadCh: