Restore usage of string for -network flag

This commit is contained in:
Alexander Ewetumo 2017-10-24 16:13:19 +01:00
parent ca221f41f5
commit aed88e234e
1 changed files with 7 additions and 6 deletions

View File

@ -3,6 +3,7 @@ package integration
import ( import (
"bytes" "bytes"
"flag" "flag"
"fmt"
"io" "io"
"os" "os"
"path/filepath" "path/filepath"
@ -14,7 +15,7 @@ import (
) )
var ( var (
networkSelected = flag.Int("network", 777, "-network=NETWORKID to select network used for tests") networkSelected = flag.String("network", "statuschain", "-network=NETWORKID to select network used for tests")
// TestConfig defines the default config usable at package-level. // TestConfig defines the default config usable at package-level.
TestConfig *common.TestConfig TestConfig *common.TestConfig
@ -117,14 +118,14 @@ func EnsureNodeSync(nodeManager common.NodeManager) {
// GetNetworkID returns appropriate network id for test based on // GetNetworkID returns appropriate network id for test based on
// default or provided -network flag. // default or provided -network flag.
func GetNetworkID() int { func GetNetworkID() int {
switch *networkSelected { switch strings.ToLower(*networkSelected) {
case params.MainNetworkID: case fmt.Sprintf("%d", params.MainNetworkID), "mainnet":
return params.MainNetworkID return params.MainNetworkID
case params.RinkebyNetworkID: case fmt.Sprintf("%d", params.RinkebyNetworkID), "rinkeby":
return params.RinkebyNetworkID return params.RinkebyNetworkID
case params.RopstenNetworkID: case fmt.Sprintf("%d", params.RopstenNetworkID), "ropsten":
return params.RopstenNetworkID return params.RopstenNetworkID
case params.StatusChainNetworkID: case fmt.Sprintf("%d", params.StatusChainNetworkID), "statuschain":
return params.StatusChainNetworkID return params.StatusChainNetworkID
} }