Skip to content

Commit 881ee40

Browse files
authored
eth/catalyst: fix flaky test (ethereum#31403)
This pull request enhances the unit test, avoiding unnecessary failure in CI. ``` --- FAIL: TestSimulatedBeaconSendWithdrawals (12.08s) simulated_beacon_test.go:139: timed out without including all withdrawals/txs FAIL ```
1 parent d25c3c3 commit 881ee40

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

eth/catalyst/simulated_beacon_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func TestSimulatedBeaconSendWithdrawals(t *testing.T) {
120120
includedTxs := make(map[common.Hash]struct{})
121121
var includedWithdrawals []uint64
122122

123-
timer := time.NewTimer(12 * time.Second)
123+
timer := time.NewTimer(30 * time.Second)
124124
for {
125125
select {
126126
case ev := <-chainHeadCh:
@@ -131,8 +131,8 @@ func TestSimulatedBeaconSendWithdrawals(t *testing.T) {
131131
for _, includedWithdrawal := range block.Withdrawals() {
132132
includedWithdrawals = append(includedWithdrawals, includedWithdrawal.Index)
133133
}
134-
// ensure all withdrawals/txs included. this will take two blocks b/c number of withdrawals > 10
135-
if len(includedTxs) == len(txs) && len(includedWithdrawals) == len(withdrawals) && ev.Header.Number.Cmp(big.NewInt(2)) == 0 {
134+
// ensure all withdrawals/txs included. this will at least take two blocks b/c number of withdrawals > 10
135+
if len(includedTxs) == len(txs) && len(includedWithdrawals) == len(withdrawals) {
136136
return
137137
}
138138
case <-timer.C:

0 commit comments

Comments
 (0)