erigon-pulse/cmd/devnet/tests/bor_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

87 lines
3.1 KiB
Go

//go:build integration
package tests
import (
"context"
"testing"
"github.com/stretchr/testify/require"
"github.com/ledgerwatch/erigon-lib/chain/networkname"
accounts_steps "github.com/ledgerwatch/erigon/cmd/devnet/accounts/steps"
contracts_steps "github.com/ledgerwatch/erigon/cmd/devnet/contracts/steps"
"github.com/ledgerwatch/erigon/cmd/devnet/requests"
"github.com/ledgerwatch/erigon/cmd/devnet/services"
)
func TestStateSync(t *testing.T) {
runCtx, err := ContextStart(t, networkname.BorDevnetChainName)
require.Nil(t, err)
var ctx context.Context = runCtx
t.Run("InitSubscriptions", func(t *testing.T) {
services.InitSubscriptions(ctx, []requests.SubMethod{requests.Methods.ETHNewHeads})
})
t.Run("CreateAccountWithFunds", func(t *testing.T) {
_, err := accounts_steps.CreateAccountWithFunds(ctx, networkname.DevChainName, "root-funder", 200.0)
require.Nil(t, err)
})
t.Run("CreateAccountWithFunds", func(t *testing.T) {
_, err := accounts_steps.CreateAccountWithFunds(ctx, networkname.BorDevnetChainName, "child-funder", 200.0)
require.Nil(t, err)
})
t.Run("DeployChildChainReceiver", func(t *testing.T) {
var err error
ctx, err = contracts_steps.DeployChildChainReceiver(ctx, "child-funder")
require.Nil(t, err)
})
t.Run("DeployRootChainSender", func(t *testing.T) {
var err error
ctx, err = contracts_steps.DeployRootChainSender(ctx, "root-funder")
require.Nil(t, err)
})
t.Run("GenerateSyncEvents", func(t *testing.T) {
require.Nil(t, contracts_steps.GenerateSyncEvents(ctx, "root-funder", 10, 2, 2))
})
t.Run("ProcessRootTransfers", func(t *testing.T) {
require.Nil(t, contracts_steps.ProcessRootTransfers(ctx, "root-funder", 10, 2, 2))
})
t.Run("BatchProcessRootTransfers", func(t *testing.T) {
require.Nil(t, contracts_steps.BatchProcessRootTransfers(ctx, "root-funder", 1, 10, 2, 2))
})
}
func TestChildChainExit(t *testing.T) {
t.Skip("FIXME: step CreateAccountWithFunds fails: Failed to get transfer tx: failed to search reserves for hashes: no block heads subscription")
runCtx, err := ContextStart(t, networkname.BorDevnetChainName)
require.Nil(t, err)
var ctx context.Context = runCtx
t.Run("CreateAccountWithFunds", func(t *testing.T) {
_, err := accounts_steps.CreateAccountWithFunds(ctx, networkname.DevChainName, "root-funder", 200.0)
require.Nil(t, err)
})
t.Run("CreateAccountWithFunds", func(t *testing.T) {
_, err := accounts_steps.CreateAccountWithFunds(ctx, networkname.BorDevnetChainName, "child-funder", 200.0)
require.Nil(t, err)
})
t.Run("DeployRootChainReceiver", func(t *testing.T) {
var err error
ctx, err = contracts_steps.DeployRootChainReceiver(ctx, "root-funder")
require.Nil(t, err)
})
t.Run("DeployChildChainSender", func(t *testing.T) {
var err error
ctx, err = contracts_steps.DeployChildChainSender(ctx, "child-funder")
require.Nil(t, err)
})
t.Run("ProcessChildTransfers", func(t *testing.T) {
require.Nil(t, contracts_steps.ProcessChildTransfers(ctx, "child-funder", 1, 2, 2))
})
//t.Run("BatchProcessTransfers", func(t *testing.T) {
// require.Nil(t, contracts_steps.BatchProcessTransfers(ctx, "child-funder", 1, 10, 2, 2))
//})
}