Update regards review
This commit is contained in:
parent
ec18e0843e
commit
4d356e0873
4
Makefile
4
Makefile
|
@ -146,10 +146,10 @@ test-e2e: ##@tests Run e2e tests
|
|||
# order: reliability then alphabetical
|
||||
# TODO(tiabc): make a single command out of them adding `-p 1` flag.
|
||||
build/env.sh go test -timeout 5m ./e2e/accounts/...
|
||||
build/env.sh go test -timeout 5m ./e2e/api/...
|
||||
build/env.sh go test -timeout 5m ./e2e/api/... -network=4
|
||||
build/env.sh go test -timeout 5m ./e2e/node/...
|
||||
build/env.sh go test -timeout 15m ./e2e/jail/...
|
||||
build/env.sh go test -timeout 20m ./e2e/rpc/...
|
||||
build/env.sh go test -timeout 20m ./e2e/rpc/... -network=4
|
||||
build/env.sh go test -timeout 20m ./e2e/whisper/...
|
||||
build/env.sh go test -timeout 10m ./e2e/transactions/...
|
||||
build/env.sh go test -timeout 40m ./cmd/statusd
|
||||
|
|
|
@ -18,10 +18,10 @@ for running all test. It by default uses the `StatusChain` network.
|
|||
To use the `ropsten` network for testing using network name:
|
||||
|
||||
```bash
|
||||
go test -v ./e2e/... -network=rinkeby
|
||||
go test -v ./e2e/... -network=ropsten
|
||||
```
|
||||
|
||||
To use the `rinkeby` network for testing using network id:
|
||||
To use the `rinkeby` network with chain id `4` for testing:
|
||||
|
||||
```bash
|
||||
go test -v ./e2e/... -network=4
|
||||
|
|
|
@ -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,7 +42,7 @@ func (s *AccountsTestSuite) TestRPCEthAccountsWithUpstream() {
|
|||
// FIXME(tiabc): Stop skipping after https://github.com/status-im/status-go/issues/424
|
||||
s.T().Skip()
|
||||
|
||||
addr, err := GetNetworkURLFromID(params.RopstenNetworkID)
|
||||
addr, err := GetRemoteURLForNetworkID()
|
||||
s.NoError(err)
|
||||
s.StartTestBackend(e2e.WithUpstream(addr))
|
||||
defer s.StopTestBackend()
|
||||
|
|
|
@ -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(params.RopstenNetworkID)
|
||||
nodeConfig, err := e2e.MakeTestNodeConfig(GetNetworkID())
|
||||
s.NoError(err)
|
||||
|
||||
s.False(s.Backend.IsNodeRunning())
|
||||
|
@ -203,7 +203,7 @@ func (s *APIBackendTestSuite) TestNetworkSwitching() {
|
|||
|
||||
firstHash, err := e2e.FirstBlockHash(s.Backend.NodeManager())
|
||||
s.NoError(err)
|
||||
s.Equal("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d", firstHash)
|
||||
s.Equal(GetHeadHashForNetworkID(), firstHash)
|
||||
|
||||
// now stop node, and make sure that a new node, on different network can be started
|
||||
nodeStopped, err := s.Backend.StopNode()
|
||||
|
@ -211,7 +211,7 @@ func (s *APIBackendTestSuite) TestNetworkSwitching() {
|
|||
<-nodeStopped
|
||||
|
||||
// start new node with completely different config
|
||||
nodeConfig, err = e2e.MakeTestNodeConfig(params.RinkebyNetworkID)
|
||||
nodeConfig, err = e2e.MakeTestNodeConfig(GetNetworkID())
|
||||
s.NoError(err)
|
||||
|
||||
s.False(s.Backend.IsNodeRunning())
|
||||
|
@ -224,7 +224,7 @@ func (s *APIBackendTestSuite) TestNetworkSwitching() {
|
|||
// make sure we are on another network indeed
|
||||
firstHash, err = e2e.FirstBlockHash(s.Backend.NodeManager())
|
||||
s.NoError(err)
|
||||
s.Equal("0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177", firstHash)
|
||||
s.Equal(GetHeadHashForNetworkID(), firstHash)
|
||||
|
||||
nodeStopped, err = s.Backend.StopNode()
|
||||
s.NoError(err)
|
||||
|
@ -253,7 +253,7 @@ func (s *APIBackendTestSuite) TestResetChainData() {
|
|||
// 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(GetHeadHashForNetworkID(), firstHash)
|
||||
}
|
||||
|
||||
// FIXME(tiabc): There's also a test with the same name in geth/node/manager_test.go
|
||||
|
@ -275,7 +275,7 @@ func (s *APIBackendTestSuite) TestRestartNode() {
|
|||
|
||||
firstHash, err := e2e.FirstBlockHash(s.Backend.NodeManager())
|
||||
s.NoError(err)
|
||||
s.Equal("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d", firstHash)
|
||||
s.Equal(GetHeadHashForNetworkID(), firstHash)
|
||||
|
||||
s.True(s.Backend.IsNodeRunning())
|
||||
nodeRestarted, err := s.Backend.RestartNode()
|
||||
|
@ -286,5 +286,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("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d", firstHash)
|
||||
s.Equal(GetHeadHashForNetworkID(), firstHash)
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@ func (s *ManagerTestSuite) TestNetworkSwitching() {
|
|||
|
||||
firstHash, err := e2e.FirstBlockHash(s.NodeManager)
|
||||
s.NoError(err)
|
||||
s.Equal(GetNetworkHash(), firstHash)
|
||||
s.Equal(GetHeadHashForNetworkID(), firstHash)
|
||||
|
||||
// now stop node, and make sure that a new node, on different network can be started
|
||||
nodeStopped, err := s.NodeManager.StopNode()
|
||||
|
@ -266,7 +266,7 @@ func (s *ManagerTestSuite) TestNetworkSwitching() {
|
|||
// make sure we are on another network indeed
|
||||
firstHash, err = e2e.FirstBlockHash(s.NodeManager)
|
||||
s.NoError(err)
|
||||
s.Equal(GetNetworkHashFromID(params.RinkebyNetworkID), firstHash)
|
||||
s.Equal(GetHeadHashFromNetworkID(params.RinkebyNetworkID), firstHash)
|
||||
|
||||
nodeStopped, err = s.NodeManager.StopNode()
|
||||
s.NoError(err)
|
||||
|
@ -277,7 +277,7 @@ func (s *ManagerTestSuite) TestStartNodeWithUpstreamEnabled() {
|
|||
nodeConfig, err := e2e.MakeTestNodeConfig(params.RopstenNetworkID)
|
||||
s.NoError(err)
|
||||
|
||||
networkURL, err := GetNetworkURLFromID(params.RopstenNetworkID)
|
||||
networkURL, err := GetRemoteURLForNetworkID()
|
||||
s.NoError(err)
|
||||
|
||||
nodeConfig.UpstreamConfig.Enabled = true
|
||||
|
|
|
@ -11,7 +11,6 @@ import (
|
|||
"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"
|
||||
)
|
||||
|
@ -31,7 +30,7 @@ func (s *RPCTestSuite) SetupTest() {
|
|||
|
||||
func (s *RPCTestSuite) TestCallRPC() {
|
||||
for _, upstreamEnabled := range []bool{false, true} {
|
||||
nodeConfig, err := e2e.MakeTestNodeConfig(params.RinkebyNetworkID)
|
||||
nodeConfig, err := e2e.MakeTestNodeConfig(GetNetworkID())
|
||||
s.NoError(err)
|
||||
|
||||
nodeConfig.IPCEnabled = false
|
||||
|
@ -39,8 +38,11 @@ func (s *RPCTestSuite) TestCallRPC() {
|
|||
nodeConfig.HTTPHost = "" // to make sure that no HTTP interface is started
|
||||
|
||||
if upstreamEnabled {
|
||||
networkURL, err := GetRemoteURLForNetworkID()
|
||||
s.NoError(err)
|
||||
|
||||
nodeConfig.UpstreamConfig.Enabled = true
|
||||
nodeConfig.UpstreamConfig.URL = "https://rinkeby.infura.io/nKmXgiFgc2KqtoQ8BCGJ"
|
||||
nodeConfig.UpstreamConfig.URL = networkURL
|
||||
}
|
||||
|
||||
nodeStarted, err := s.NodeManager.StartNode(nodeConfig)
|
||||
|
|
|
@ -83,7 +83,7 @@ func (s *TransactionsTestSuite) TestCallRPCSendTransactionUpstream() {
|
|||
// FIXME(tiabc): Stop skipping after https://github.com/status-im/status-go/issues/424
|
||||
s.T().Skip()
|
||||
|
||||
addr, err := GetNetworkURLFromID(params.RopstenNetworkID)
|
||||
addr, err := GetRemoteURLForNetworkID()
|
||||
s.NoError(err)
|
||||
s.StartTestBackend(e2e.WithUpstream(addr))
|
||||
defer s.StopTestBackend()
|
||||
|
@ -311,7 +311,7 @@ func (s *TransactionsTestSuite) TestSendEtherTxUpstream() {
|
|||
// FIXME(tiabc): Stop skipping after https://github.com/status-im/status-go/issues/424
|
||||
s.T().Skip()
|
||||
|
||||
addr, err := GetNetworkURLFromID(params.RopstenNetworkID)
|
||||
addr, err := GetRemoteURLForNetworkID()
|
||||
s.NoError(err)
|
||||
s.StartTestBackend(e2e.WithUpstream(addr))
|
||||
defer s.StopTestBackend()
|
||||
|
|
|
@ -119,8 +119,8 @@ func EnsureNodeSync(nodeManager common.NodeManager) {
|
|||
}
|
||||
}
|
||||
|
||||
// GetNetworkURLFromID returns asociated network url for giving network id.
|
||||
func GetNetworkURLFromID(id int) (string, error) {
|
||||
// GetRemoteURLFromID returns asociated network url for giving network id.
|
||||
func GetRemoteURLFromID(id int) (string, error) {
|
||||
switch id {
|
||||
case params.MainNetworkID:
|
||||
return params.MainnetEthereumNetworkURL, nil
|
||||
|
@ -133,8 +133,8 @@ func GetNetworkURLFromID(id int) (string, error) {
|
|||
return "", ErrStatusPrivateNetwork
|
||||
}
|
||||
|
||||
// GetNetworkHashFromID returns the hash associated with a given network id.
|
||||
func GetNetworkHashFromID(id int) string {
|
||||
// GetHeadHashFromNetworkID returns the hash associated with a given network id.
|
||||
func GetHeadHashFromNetworkID(id int) string {
|
||||
switch id {
|
||||
case params.RinkebyNetworkID:
|
||||
return "0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177"
|
||||
|
@ -147,9 +147,14 @@ func GetNetworkHashFromID(id int) string {
|
|||
return ""
|
||||
}
|
||||
|
||||
// GetNetworkHash returns the hash associated with a given network id.
|
||||
func GetNetworkHash() string {
|
||||
return GetNetworkHashFromID(GetNetworkID())
|
||||
// GetRemoteURLForNetworkID returns the url associated with a given network id.
|
||||
func GetRemoteURLForNetworkID() (string, error) {
|
||||
return GetRemoteURLFromID(GetNetworkID())
|
||||
}
|
||||
|
||||
// GetHeadHashForNetworkID returns the hash associated with a given network id.
|
||||
func GetHeadHashForNetworkID() string {
|
||||
return GetHeadHashFromNetworkID(GetNetworkID())
|
||||
}
|
||||
|
||||
// GetNetworkID returns appropriate network id for test based on
|
||||
|
|
Loading…
Reference in New Issue