erigon-pulse/cmd/devnet/tests/generic_devnet_test.go
milen f690301c03
devnet: integration tests port clash fix (#9194)
Integration tests CI is failing due to a port clash in devnet tests. I
believe this is because there are 2 packages of devnet integration tests
and go can run tests from separate packages in parallel (by default it
does package level parallelism). A simple fix would be to just have all
devnet integration tests in 1 package and run all these tests
sequentially within the package (ie not use t.Parallel). This PR moves
all devnet integration tests in 1 package.

`"ContextStart devnet start failed: private api: could not create
listener: listen top 127.0.0.1:10090: bind: address already in use,
addr=localhost:10090"`

![Screenshot 2024-01-10 at 13 38
37](https://github.com/ledgerwatch/erigon/assets/94537774/06bda987-45e5-46ef-9e0b-3876b3f85c01)
2024-01-10 19:04:27 +00:00

66 lines
1.9 KiB
Go

//go:build integration
package tests
import (
"context"
"testing"
"time"
"github.com/stretchr/testify/require"
"github.com/ledgerwatch/erigon/cmd/devnet/accounts"
"github.com/ledgerwatch/erigon/cmd/devnet/admin"
"github.com/ledgerwatch/erigon/cmd/devnet/contracts/steps"
"github.com/ledgerwatch/erigon/cmd/devnet/requests"
"github.com/ledgerwatch/erigon/cmd/devnet/services"
"github.com/ledgerwatch/erigon/cmd/devnet/transactions"
)
func testDynamicTx(t *testing.T, ctx context.Context) {
t.Run("InitSubscriptions", func(t *testing.T) {
services.InitSubscriptions(ctx, []requests.SubMethod{requests.Methods.ETHNewHeads})
})
t.Run("PingErigonRpc", func(t *testing.T) {
require.Nil(t, admin.PingErigonRpc(ctx))
})
t.Run("CheckTxPoolContent", func(t *testing.T) {
transactions.CheckTxPoolContent(ctx, 0, 0, 0)
})
t.Run("SendTxWithDynamicFee", func(t *testing.T) {
const recipientAddress = "0x71562b71999873DB5b286dF957af199Ec94617F7"
const sendValue uint64 = 10000
_, err := transactions.SendTxWithDynamicFee(ctx, recipientAddress, accounts.DevAddress, sendValue)
require.Nil(t, err)
})
t.Run("AwaitBlocks", func(t *testing.T) {
require.Nil(t, transactions.AwaitBlocks(ctx, 2*time.Second))
})
}
func TestDynamicTxNode0(t *testing.T) {
runCtx, err := ContextStart(t, "")
require.Nil(t, err)
testDynamicTx(t, runCtx.WithCurrentNetwork(0).WithCurrentNode(0))
}
func TestDynamicTxAnyNode(t *testing.T) {
runCtx, err := ContextStart(t, "")
require.Nil(t, err)
testDynamicTx(t, runCtx.WithCurrentNetwork(0))
}
func TestCallContract(t *testing.T) {
runCtx, err := ContextStart(t, "")
require.Nil(t, err)
ctx := runCtx.WithCurrentNetwork(0)
t.Run("InitSubscriptions", func(t *testing.T) {
services.InitSubscriptions(ctx, []requests.SubMethod{requests.Methods.ETHNewHeads})
})
t.Run("DeployAndCallLogSubscriber", func(t *testing.T) {
_, err := contracts_steps.DeployAndCallLogSubscriber(ctx, accounts.DevAddress)
require.Nil(t, err)
})
}