Skip to content

Commit

Permalink
core: fix flacky go-unittest TestNewTransactionPoolWithReplaceTx (#867)
Browse files Browse the repository at this point in the history
  • Loading branch information
bas-vk authored Aug 25, 2024
1 parent 58d4703 commit b8f3323
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions core/node/crypto/chain_txpool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,15 @@ import (

"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/core/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/river-build/river/core/node/base/test"
"github.com/river-build/river/core/node/crypto"
"github.com/river-build/river/core/node/infra"
"github.com/stretchr/testify/require"
)

func TestNewTransactionPoolWithReplaceTx(t *testing.T) {
var (
require = require.New(t)
assert = assert.New(t)
N = 3
ctx, cancel = test.NewTestContext()
resubmitPolicy = crypto.NewTransactionPoolDeadlinePolicy(250 * time.Millisecond)
Expand Down Expand Up @@ -75,5 +72,7 @@ func TestNewTransactionPoolWithReplaceTx(t *testing.T) {
require.Equal(types.ReceiptStatusSuccessful, receipt.Status)
}

assert.EqualValues(0, txPool.PendingTransactionsCount(), "tx pool must have no pending tx")
require.Eventually(func() bool {
return txPool.PendingTransactionsCount() == 0
}, 20*time.Second, 100*time.Millisecond, "tx pool must have no pending tx")
}

0 comments on commit b8f3323

Please sign in to comment.