Fix errors on network chain id validation in tests
This commit is contained in:
parent
d856660d09
commit
a257d1c201
|
@ -5,7 +5,6 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/status-im/status-go/e2e"
|
||||
"github.com/status-im/status-go/geth/params"
|
||||
. "github.com/status-im/status-go/testing"
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
@ -43,10 +42,7 @@ func (s *AccountsTestSuite) TestRPCEthAccountsWithUpstream() {
|
|||
// FIXME(tiabc): Stop skipping after https://github.com/status-im/status-go/issues/424
|
||||
s.T().Skip()
|
||||
|
||||
s.StartTestBackend(
|
||||
params.RopstenNetworkID,
|
||||
e2e.WithUpstream("https://ropsten.infura.io/z6GCTmjdP3FETEJmMBI4"),
|
||||
)
|
||||
s.StartTestBackend(e2e.WithUpstream("https://ropsten.infura.io/z6GCTmjdP3FETEJmMBI4"))
|
||||
defer s.StopTestBackend()
|
||||
|
||||
// log into test account
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
"github.com/status-im/status-go/e2e"
|
||||
"github.com/status-im/status-go/geth/account"
|
||||
"github.com/status-im/status-go/geth/common"
|
||||
"github.com/status-im/status-go/geth/params"
|
||||
. "github.com/status-im/status-go/testing"
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
|
|
@ -191,7 +191,7 @@ func (s *APIBackendTestSuite) TestRaceConditions() {
|
|||
// so this test should only check StatusBackend logic with a mocked version of the underlying NodeManager.
|
||||
func (s *APIBackendTestSuite) TestNetworkSwitching() {
|
||||
// get Ropsten config
|
||||
nodeConfig, err := e2e.MakeTestNodeConfig(e2e.GetNetworkID())
|
||||
nodeConfig, err := e2e.MakeTestNodeConfig(params.RopstenNetworkID)
|
||||
s.NoError(err)
|
||||
|
||||
s.False(s.Backend.IsNodeRunning())
|
||||
|
@ -211,7 +211,7 @@ func (s *APIBackendTestSuite) TestNetworkSwitching() {
|
|||
<-nodeStopped
|
||||
|
||||
// start new node with completely different config
|
||||
nodeConfig, err = e2e.MakeTestNodeConfig(e2e.GetNetworkID())
|
||||
nodeConfig, err = e2e.MakeTestNodeConfig(params.RinkebyNetworkID)
|
||||
s.NoError(err)
|
||||
|
||||
s.False(s.Backend.IsNodeRunning())
|
||||
|
@ -267,7 +267,7 @@ func (s *APIBackendTestSuite) TestRestartNode() {
|
|||
|
||||
firstHash, err := e2e.FirstBlockHash(s.Backend.NodeManager())
|
||||
s.NoError(err)
|
||||
s.Equal("0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177", firstHash)
|
||||
s.Equal("0x28c4da1cca48d0107ea5ea29a40ac15fca86899c52d02309fa12ea39b86d219c", firstHash)
|
||||
|
||||
s.True(s.Backend.IsNodeRunning())
|
||||
nodeRestarted, err := s.Backend.RestartNode()
|
||||
|
@ -278,5 +278,5 @@ func (s *APIBackendTestSuite) TestRestartNode() {
|
|||
// make sure we can read the first byte, and it is valid (for Rinkeby)
|
||||
firstHash, err = e2e.FirstBlockHash(s.Backend.NodeManager())
|
||||
s.NoError(err)
|
||||
s.Equal("0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177", firstHash)
|
||||
s.Equal("0x28c4da1cca48d0107ea5ea29a40ac15fca86899c52d02309fa12ea39b86d219c", firstHash)
|
||||
}
|
||||
|
|
|
@ -235,7 +235,7 @@ func (s *ManagerTestSuite) TestNodeStartStop() {
|
|||
|
||||
func (s *ManagerTestSuite) TestNetworkSwitching() {
|
||||
// get Ropsten config
|
||||
nodeConfig, err := e2e.MakeTestNodeConfig(e2e.GetNetworkID())
|
||||
nodeConfig, err := e2e.MakeTestNodeConfig(params.RopstenNetworkID)
|
||||
s.NoError(err)
|
||||
s.False(s.NodeManager.IsNodeRunning())
|
||||
nodeStarted, err := s.NodeManager.StartNode(nodeConfig)
|
||||
|
@ -255,7 +255,7 @@ func (s *ManagerTestSuite) TestNetworkSwitching() {
|
|||
s.False(s.NodeManager.IsNodeRunning())
|
||||
|
||||
// start new node with completely different config
|
||||
nodeConfig, err = e2e.MakeTestNodeConfig(e2e.GetNetworkID())
|
||||
nodeConfig, err = e2e.MakeTestNodeConfig(params.RinkebyNetworkID)
|
||||
s.NoError(err)
|
||||
nodeStarted, err = s.NodeManager.StartNode(nodeConfig)
|
||||
s.NoError(err)
|
||||
|
@ -308,7 +308,7 @@ func (s *ManagerTestSuite) TestResetChainData() {
|
|||
// make sure we can read the first byte, and it is valid (for Rinkeby)
|
||||
firstHash, err := e2e.FirstBlockHash(s.NodeManager)
|
||||
s.NoError(err)
|
||||
s.Equal("0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177", firstHash)
|
||||
s.Equal("0x28c4da1cca48d0107ea5ea29a40ac15fca86899c52d02309fa12ea39b86d219c", firstHash)
|
||||
}
|
||||
|
||||
func (s *ManagerTestSuite) TestRestartNode() {
|
||||
|
@ -325,7 +325,7 @@ func (s *ManagerTestSuite) TestRestartNode() {
|
|||
// make sure we can read the first byte, and it is valid (for Rinkeby)
|
||||
firstHash, err := e2e.FirstBlockHash(s.NodeManager)
|
||||
s.NoError(err)
|
||||
s.Equal("0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177", firstHash)
|
||||
s.Equal("0x28c4da1cca48d0107ea5ea29a40ac15fca86899c52d02309fa12ea39b86d219c", firstHash)
|
||||
}
|
||||
|
||||
// TODO(adam): race conditions should be tested with -race flag and unit tests, if possible.
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
|
||||
"github.com/status-im/status-go/e2e"
|
||||
"github.com/status-im/status-go/geth/node"
|
||||
"github.com/status-im/status-go/geth/params"
|
||||
"github.com/status-im/status-go/geth/rpc"
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
|
|
@ -6,13 +6,14 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/status-im/status-go/e2e"
|
||||
"github.com/status-im/status-go/geth/node"
|
||||
"github.com/status-im/status-go/geth/params"
|
||||
. "github.com/status-im/status-go/testing"
|
||||
"github.com/stretchr/testify/suite"
|
||||
"math/big"
|
||||
)
|
||||
|
||||
func TestRPCTestSuite(t *testing.T) {
|
||||
|
@ -30,7 +31,7 @@ func (s *RPCTestSuite) SetupTest() {
|
|||
|
||||
func (s *RPCTestSuite) TestCallRPC() {
|
||||
for _, upstreamEnabled := range []bool{false, true} {
|
||||
nodeConfig, err := e2e.MakeTestNodeConfig(e2e.GetNetworkID())
|
||||
nodeConfig, err := e2e.MakeTestNodeConfig(params.RinkebyNetworkID)
|
||||
s.NoError(err)
|
||||
|
||||
nodeConfig.IPCEnabled = false
|
||||
|
@ -140,7 +141,7 @@ func (s *RPCTestSuite) TestCallRawResult() {
|
|||
// TestCallContextResult checks if result passed to CallContext
|
||||
// is set accordingly to its underlying memory layout.
|
||||
func (s *RPCTestSuite) TestCallContextResult() {
|
||||
s.StartTestNode(params.StatusChainNetworkID)
|
||||
s.StartTestNode()
|
||||
defer s.StopTestNode()
|
||||
|
||||
s.Require().NoError(EnsureNodeSync(s.NodeManager))
|
||||
|
|
|
@ -83,10 +83,7 @@ func (s *TransactionsTestSuite) TestCallRPCSendTransactionUpstream() {
|
|||
// FIXME(tiabc): Stop skipping after https://github.com/status-im/status-go/issues/424
|
||||
s.T().Skip()
|
||||
|
||||
s.StartTestBackend(
|
||||
params.RopstenNetworkID,
|
||||
e2e.WithUpstream("https://ropsten.infura.io/nKmXgiFgc2KqtoQ8BCGJ"),
|
||||
)
|
||||
s.StartTestBackend(e2e.WithUpstream("https://ropsten.infura.io/nKmXgiFgc2KqtoQ8BCGJ"))
|
||||
defer s.StopTestBackend()
|
||||
|
||||
err := s.Backend.AccountManager().SelectAccount(TestConfig.Account2.Address, TestConfig.Account2.Password)
|
||||
|
|
|
@ -13,7 +13,6 @@ import (
|
|||
whisper "github.com/ethereum/go-ethereum/whisper/whisperv5"
|
||||
"github.com/status-im/status-go/e2e"
|
||||
"github.com/status-im/status-go/geth/common"
|
||||
"github.com/status-im/status-go/geth/params"
|
||||
"github.com/status-im/status-go/static"
|
||||
. "github.com/status-im/status-go/testing"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
@ -45,8 +44,8 @@ type WhisperJailTestSuite struct {
|
|||
Jail common.JailManager
|
||||
}
|
||||
|
||||
func (s *WhisperJailTestSuite) StartTestBackend(networkID int, opts ...e2e.TestNodeOption) {
|
||||
s.BackendTestSuite.StartTestBackend(networkID, opts...)
|
||||
func (s *WhisperJailTestSuite) StartTestBackend(opts ...e2e.TestNodeOption) {
|
||||
s.BackendTestSuite.StartTestBackend(opts...)
|
||||
|
||||
s.WhisperAPI = whisper.NewPublicWhisperAPI(s.WhisperService())
|
||||
s.Jail = s.Backend.JailManager()
|
||||
|
|
Loading…
Reference in New Issue