Documentation
¶
Index ¶
- Variables
- func CheckTestSkipForNetworks(t *testing.T, networks ...int)
- func EnsureNodeSync(ensureSync EnsureSync)
- func Eventually(f func() error, timeout, period time.Duration) (err error)
- func GetAccount1PKFile() string
- func GetAccount2PKFile() string
- func GetHeadHash() string
- func GetHeadHashFromNetworkID(id int) string
- func GetNetworkID() int
- func GetRemoteURL() (string, error)
- func GetRemoteURLFromNetworkID(id int) (url string, err error)
- func ImportTestAccount(keystoreDir, accountFile string) error
- func Init()
- func LoadFromFile(filename string) string
- func MakeTestNodeConfig(networkID int) (*params.NodeConfig, error)
- func MakeTestNodeConfigWithDataDir(name, dataDir string, networkID uint64) (*params.NodeConfig, error)
- func WaitClosed(c <-chan struct{}, d time.Duration) error
- type EnsureSync
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoRemoteURL is returned when network id has no associated url. ErrNoRemoteURL = errors.New("network id requires a remote URL") // ErrTimeout is returned when test times out ErrTimeout = errors.New("timeout") // TestConfig defines the default config usable at package-level. TestConfig *testConfig // RootDir is the main application directory RootDir string // TestDataDir is data directory used for tests TestDataDir string // TestNetworkNames network ID to name mapping TestNetworkNames = map[int]string{ params.MainNetworkID: "Mainnet", params.StatusChainNetworkID: "StatusChain", params.GoerliNetworkID: "Goerli", } )
Functions ¶
func CheckTestSkipForNetworks ¶
CheckTestSkipForNetworks checks if network for test is one of the prohibited ones and skips the test in this case.
func EnsureNodeSync ¶
func EnsureNodeSync(ensureSync EnsureSync)
EnsureNodeSync waits until node synchronzation is done to continue with tests afterwards. Panics in case of an error or a timeout.
func Eventually ¶ added in v0.35.0
Eventually will raise error if condition won't be met during the given timeout.
func GetAccount1PKFile ¶
func GetAccount1PKFile() string
GetAccount1PKFile returns the filename for Account1 keystore based on the current network. This allows running the e2e tests on the private network w/o access to the ACCOUNT_PASSWORD env variable
func GetAccount2PKFile ¶
func GetAccount2PKFile() string
GetAccount2PKFile returns the filename for Account2 keystore based on the current network. This allows running the e2e tests on the private network w/o access to the ACCOUNT_PASSWORD env variable
func GetHeadHash ¶
func GetHeadHash() string
GetHeadHash returns the hash associated with a given network id.
func GetHeadHashFromNetworkID ¶
GetHeadHashFromNetworkID returns the hash associated with a given network id.
func GetNetworkID ¶
func GetNetworkID() int
GetNetworkID returns appropriate network id for test based on default or provided -network flag.
func GetRemoteURL ¶
GetRemoteURL returns the url associated with a given network id.
func GetRemoteURLFromNetworkID ¶
GetRemoteURLFromNetworkID returns associated network url for giving network id.
func ImportTestAccount ¶
ImportTestAccount imports keystore from static resources, see "static/keys" folder
func LoadFromFile ¶
LoadFromFile is useful for loading test data, from testdata/filename into a variable nolint: errcheck
func MakeTestNodeConfig ¶
func MakeTestNodeConfig(networkID int) (*params.NodeConfig, error)
MakeTestNodeConfig defines a function to return a params.NodeConfig where specific network addresses are assigned based on provided network id.
func MakeTestNodeConfigWithDataDir ¶ added in v0.10.2
func MakeTestNodeConfigWithDataDir(name, dataDir string, networkID uint64) (*params.NodeConfig, error)
MakeTestNodeConfigWithDataDir defines a function to return a params.NodeConfig where specific network addresses are assigned based on provided network id, and assigns a given name and data dir.
func WaitClosed ¶
WaitClosed used to wait on a channel in tests
Types ¶
type EnsureSync ¶
EnsureSync waits until blockchain synchronization is complete and returns.