Update makefiles and make changes regards review
This commit is contained in:
parent
681a2d2d83
commit
1cc90541da
8
Makefile
8
Makefile
|
@ -145,13 +145,7 @@ test-coverage: ##@tests Run unit and integration tests with covevare
|
|||
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/... -network=3
|
||||
build/env.sh go test -timeout 5m ./e2e/node/... -network=3
|
||||
build/env.sh go test -timeout 15m ./e2e/jail/...
|
||||
build/env.sh go test -timeout 20m ./e2e/rpc/... -network=3
|
||||
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 ./e2e/...
|
||||
build/env.sh go test -timeout 40m ./cmd/statusd
|
||||
|
||||
ci: mock-install mock test-coverage test-e2e ##@tests Run all tests in CI
|
||||
|
|
|
@ -47,7 +47,7 @@ func (s *AccountsTestSuite) TestRPCEthAccountsWithUpstream() {
|
|||
return
|
||||
}
|
||||
|
||||
addr, err := GetRemoteURLForNetworkID()
|
||||
addr, err := GetRemoteURL()
|
||||
s.NoError(err)
|
||||
s.StartTestBackend(e2e.WithUpstream(addr))
|
||||
defer s.StopTestBackend()
|
||||
|
|
|
@ -203,7 +203,7 @@ func (s *APIBackendTestSuite) TestNetworkSwitching() {
|
|||
|
||||
firstHash, err := e2e.FirstBlockHash(s.Backend.NodeManager())
|
||||
s.NoError(err)
|
||||
s.Equal(GetHeadHashForNetworkID(), firstHash)
|
||||
s.Equal(GetHeadHash(), firstHash)
|
||||
|
||||
// now stop node, and make sure that a new node, on different network can be started
|
||||
nodeStopped, err := s.Backend.StopNode()
|
||||
|
@ -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(GetHeadHashForNetworkID(), firstHash)
|
||||
s.Equal(GetHeadHash(), 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(GetHeadHashForNetworkID(), firstHash)
|
||||
s.Equal(GetHeadHash(), 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(GetHeadHashForNetworkID(), firstHash)
|
||||
s.Equal(GetHeadHash(), 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(GetHeadHashForNetworkID(), firstHash)
|
||||
s.Equal(GetHeadHash(), firstHash)
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@ func (s *ManagerTestSuite) TestNetworkSwitching() {
|
|||
|
||||
firstHash, err := e2e.FirstBlockHash(s.NodeManager)
|
||||
s.NoError(err)
|
||||
s.Equal(GetHeadHashForNetworkID(), firstHash)
|
||||
s.Equal(GetHeadHash(), firstHash)
|
||||
|
||||
// now stop node, and make sure that a new node, on different network can be started
|
||||
nodeStopped, err := s.NodeManager.StopNode()
|
||||
|
@ -282,7 +282,7 @@ func (s *ManagerTestSuite) TestStartNodeWithUpstreamEnabled() {
|
|||
nodeConfig, err := e2e.MakeTestNodeConfig(GetNetworkID())
|
||||
s.NoError(err)
|
||||
|
||||
networkURL, err := GetRemoteURLForNetworkID()
|
||||
networkURL, err := GetRemoteURL()
|
||||
s.NoError(err)
|
||||
|
||||
nodeConfig.UpstreamConfig.Enabled = true
|
||||
|
@ -316,7 +316,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(GetHeadHashForNetworkID(), firstHash)
|
||||
s.Equal(GetHeadHash(), firstHash)
|
||||
}
|
||||
|
||||
func (s *ManagerTestSuite) TestRestartNode() {
|
||||
|
@ -333,7 +333,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(GetHeadHashForNetworkID(), firstHash)
|
||||
s.Equal(GetHeadHash(), firstHash)
|
||||
}
|
||||
|
||||
// TODO(adam): race conditions should be tested with -race flag and unit tests, if possible.
|
||||
|
|
|
@ -44,7 +44,7 @@ func (s *RPCTestSuite) TestCallRPC() {
|
|||
nodeConfig.HTTPHost = "" // to make sure that no HTTP interface is started
|
||||
|
||||
if upstreamEnabled {
|
||||
networkURL, err := GetRemoteURLForNetworkID()
|
||||
networkURL, err := GetRemoteURL()
|
||||
s.NoError(err)
|
||||
|
||||
nodeConfig.UpstreamConfig.Enabled = true
|
||||
|
|
|
@ -88,7 +88,7 @@ func (s *TransactionsTestSuite) TestCallRPCSendTransactionUpstream() {
|
|||
return
|
||||
}
|
||||
|
||||
addr, err := GetRemoteURLForNetworkID()
|
||||
addr, err := GetRemoteURL()
|
||||
s.NoError(err)
|
||||
s.StartTestBackend(e2e.WithUpstream(addr))
|
||||
defer s.StopTestBackend()
|
||||
|
@ -321,7 +321,7 @@ func (s *TransactionsTestSuite) TestSendEtherTxUpstream() {
|
|||
return
|
||||
}
|
||||
|
||||
addr, err := GetRemoteURLForNetworkID()
|
||||
addr, err := GetRemoteURL()
|
||||
s.NoError(err)
|
||||
s.StartTestBackend(e2e.WithUpstream(addr))
|
||||
defer s.StopTestBackend()
|
||||
|
|
|
@ -16,10 +16,10 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
networkSelected = flag.String("network", "statuschain", "-network=NETWORKID to select network used for tests")
|
||||
networkSelected = flag.String("network", "statuschain", "-network=NETWORKID or -network=NETWORKNAME to select network used for tests")
|
||||
|
||||
// ErrStatusPrivateNetwork is returned when network id is for a private chain network, whoes URL must be provided.
|
||||
ErrStatusPrivateNetwork = errors.New("network id reserves for private chain network, provide URL")
|
||||
// ErrNoRemoteURL is returned when network id has no associated url.
|
||||
ErrNoRemoteURL = errors.New("network id requires a remote URL")
|
||||
|
||||
// TestConfig defines the default config usable at package-level.
|
||||
TestConfig *common.TestConfig
|
||||
|
@ -119,18 +119,19 @@ func EnsureNodeSync(nodeManager common.NodeManager) {
|
|||
}
|
||||
}
|
||||
|
||||
// GetRemoteURLFromID returns asociated network url for giving network id.
|
||||
func GetRemoteURLFromID(id int) (string, error) {
|
||||
// GetRemoteURLFromNetworkID returns asociated network url for giving network id.
|
||||
func GetRemoteURLFromNetworkID(id int) (url string, err error) {
|
||||
switch id {
|
||||
case params.MainNetworkID:
|
||||
return params.MainnetEthereumNetworkURL, nil
|
||||
url = params.MainnetEthereumNetworkURL
|
||||
case params.RinkebyNetworkID:
|
||||
return params.RinkebyEthereumNetworkURL, nil
|
||||
url = params.RinkebyEthereumNetworkURL
|
||||
case params.RopstenNetworkID:
|
||||
return params.RopstenEthereumNetworkURL, nil
|
||||
url = params.RopstenEthereumNetworkURL
|
||||
}
|
||||
|
||||
return "", ErrStatusPrivateNetwork
|
||||
err = ErrNoRemoteURL
|
||||
return
|
||||
}
|
||||
|
||||
// GetHeadHashFromNetworkID returns the hash associated with a given network id.
|
||||
|
@ -147,13 +148,13 @@ func GetHeadHashFromNetworkID(id int) string {
|
|||
return ""
|
||||
}
|
||||
|
||||
// GetRemoteURLForNetworkID returns the url associated with a given network id.
|
||||
func GetRemoteURLForNetworkID() (string, error) {
|
||||
return GetRemoteURLFromID(GetNetworkID())
|
||||
// GetRemoteURL returns the url associated with a given network id.
|
||||
func GetRemoteURL() (string, error) {
|
||||
return GetRemoteURLFromNetworkID(GetNetworkID())
|
||||
}
|
||||
|
||||
// GetHeadHashForNetworkID returns the hash associated with a given network id.
|
||||
func GetHeadHashForNetworkID() string {
|
||||
// GetHeadHash returns the hash associated with a given network id.
|
||||
func GetHeadHash() string {
|
||||
return GetHeadHashFromNetworkID(GetNetworkID())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue