Documentation
¶
Index ¶
- Constants
- Variables
- func BalanceFor(accAddr string, conn *grpc.ClientConn) uint64
- func BalanceNoPanicFor(accAddr string, conn *grpc.ClientConn) (uint64, error)
- func CallContract(addr, contractAddr string, code []byte, conn *grpc.ClientConn) []byte
- func CircuAccounts() int
- func CircuRepeatRandom() bool
- func CircuRepeatTxTimes() int
- func CircuUnitAccounts() int
- func Closing(quitCh <-chan os.Signal) bool
- func CollAccounts() int
- func CollUnitAccounts() int
- func ContractAccounts() int
- func ContractRepeatRandom() bool
- func ContractRepeatTxTimes() int
- func ContractTestEnable() bool
- func ContractUnitAccounts() int
- func GenTestAddr(count int) []string
- func GetBoolCfgVal(def interface{}, keys ...string) (bool, error)
- func GetBoolSpecCfgVal(cfgData CfgData, def interface{}, keys ...string) (bool, error)
- func GetCfgVal(def interface{}, keys ...string) (interface{}, error)
- func GetFloatArrayCfgVal(def interface{}, keys ...string) ([]float64, error)
- func GetFloatArraySpecCfgVal(cfgData CfgData, def interface{}, keys ...string) ([]float64, error)
- func GetFloatCfgVal(def interface{}, keys ...string) (float64, error)
- func GetFloatSpecCfgVal(cfgData CfgData, def interface{}, keys ...string) (float64, error)
- func GetIniKV(iniBuf, key string) string
- func GetIntArrayCfgVal(def interface{}, keys ...string) ([]int, error)
- func GetIntArraySpecCfgVal(cfgData CfgData, def interface{}, keys ...string) ([]int, error)
- func GetIntCfgVal(def interface{}, keys ...string) (int, error)
- func GetIntSpecCfgVal(cfgData CfgData, def interface{}, keys ...string) (int, error)
- func GetSpecCfgVal(cfgData CfgData, def interface{}, keys ...string) (v interface{}, err error)
- func GetStrArrayCfgVal(def interface{}, keys ...string) ([]string, error)
- func GetStrArraySpecCfgVal(cfgData CfgData, def interface{}, keys ...string) ([]string, error)
- func GetStringCfgVal(def interface{}, keys ...string) (string, error)
- func GetStringSpecCfgVal(cfgData CfgData, def interface{}, keys ...string) (string, error)
- func InitConf(cfgFile string) error
- func LoadConf() error
- func LoadJSONFromFile(fileName string, result interface{}) error
- func MinerAccounts(keyFiles ...string) ([]string, []*acc.Account)
- func MinerAddrs() []string
- func NonceFor(addr string, conn *grpc.ClientConn) uint64
- func ParseIPlist(fileName string) ([]string, error)
- func PeerAddrs() []string
- func PrepareEnv(count int) error
- func RemoveKeystoreFiles(addrs ...string)
- func SplitAddrAccounts() int
- func SplitAddrRepeatRandom() bool
- func SplitAddrRepeatTxTimes() int
- func SplitAddrTestEnable() bool
- func SplitAddrUnitAccounts() int
- func StartDockerNodes() error
- func StartLocalNodes(peerCount int) ([]*os.Process, error)
- func StartProcess(args ...string) (*os.Process, error)
- func StopLocalNodes(processes ...*os.Process) error
- func StopNodes() error
- func TearDown(count int) error
- func TickerDurationTxs() time.Duration
- func TimesToUpdateAddrs() int
- func TokenAccounts() int
- func TokenBalanceFor(addr string, tokenHash string, tokenIndex uint32, conn *grpc.ClientConn) uint64
- func TokenRepeatRandom() bool
- func TokenRepeatTxTimes() int
- func TokenTestEnable() bool
- func TokenUnitAccounts() int
- func TryRecordError(err error) bool
- func TxTestEnable() bool
- func UnlockAccount(addr string) *acc.Account
- func WaitBalanceEnough(addr string, amount uint64, conn *grpc.ClientConn, timeout time.Duration) (uint64, error)
- func WaitBalanceEqual(addr string, amount uint64, conn *grpc.ClientConn, timeout time.Duration) (uint64, error)
- func WaitERC20AllowanceEqualTo(addr, contractAddr string, amount uint64, code []byte, conn *grpc.ClientConn, ...) error
- func WaitERC20BalanceEqualTo(addr, contractAddr string, amount uint64, code []byte, conn *grpc.ClientConn, ...) error
- func WaitTokenBalanceEnough(addr string, amount uint64, thash string, idx uint32, conn *grpc.ClientConn, ...) (uint64, error)
- func WaitTokenBalanceEqualTo(addr string, amount uint64, thash string, idx uint32, conn *grpc.ClientConn, ...) error
- type CfgData
Constants ¶
const ( // RPCTimeout defines rpc timeout RPCTimeout = 10 * time.Second // RPCInterval defines rpc query interval RPCInterval = 300 * time.Millisecond )
Variables ¶
var ( // NewNodes flag indicates to need to start nodes NewNodes = flag.Bool("nodes", true, "need to start nodes?") // EnableDocker flag indicates to need start docker EnableDocker = flag.Bool("docker", false, "test in docker containers?") // LocalConf defines local test devconfig LocalConf = struct { ConfDir, WorkDir, KeyDir string }{"./.devconfig/", "./.devconfig/", "./.devconfig/keyfile/"} // DockerConf defines docker test devconfig DockerConf = struct { ConfDir, WorkDir, KeyDir string }{"../docker/.devconfig/", "../docker/.devconfig/", "../docker/.devconfig/keyfile/"} )
var ( // ErrItems record functional errors during integration tests ErrItems = make([]error, 0, maxErrItems) )
Functions ¶
func BalanceFor ¶
func BalanceFor(accAddr string, conn *grpc.ClientConn) uint64
BalanceFor get balance of accAddr
func BalanceNoPanicFor ¶ added in v0.5.0
func BalanceNoPanicFor(accAddr string, conn *grpc.ClientConn) (uint64, error)
BalanceNoPanicFor returns accAddr's balance without panic
func CallContract ¶ added in v0.5.0
func CallContract(addr, contractAddr string, code []byte, conn *grpc.ClientConn) []byte
CallContract calls contract with code
func CircuRepeatTxTimes ¶
func CircuRepeatTxTimes() int
CircuRepeatTxTimes return circuRepeatTxTimes
func ContractAccounts ¶ added in v0.5.0
func ContractAccounts() int
ContractAccounts return contractAccounts
func ContractRepeatRandom ¶ added in v0.5.0
func ContractRepeatRandom() bool
ContractRepeatRandom return circuRepeatRandom
func ContractRepeatTxTimes ¶ added in v0.5.0
func ContractRepeatTxTimes() int
ContractRepeatTxTimes return contractRepeatTxTimes
func ContractTestEnable ¶ added in v0.5.0
func ContractTestEnable() bool
ContractTestEnable return contractTestEnable
func ContractUnitAccounts ¶ added in v0.5.0
func ContractUnitAccounts() int
ContractUnitAccounts return contractUnitAccounts
func GetBoolCfgVal ¶
GetBoolCfgVal get bool value
func GetBoolSpecCfgVal ¶
GetBoolSpecCfgVal get bool value
func GetFloatArrayCfgVal ¶
GetFloatArrayCfgVal get float array value
func GetFloatArraySpecCfgVal ¶
GetFloatArraySpecCfgVal get float array value
func GetFloatCfgVal ¶
GetFloatCfgVal get float value
func GetFloatSpecCfgVal ¶
GetFloatSpecCfgVal get float value
func GetIntArrayCfgVal ¶
GetIntArrayCfgVal get int array value
func GetIntArraySpecCfgVal ¶
GetIntArraySpecCfgVal get int array value
func GetIntCfgVal ¶
GetIntCfgVal get int config value
func GetIntSpecCfgVal ¶
GetIntSpecCfgVal get int config vlaue
func GetSpecCfgVal ¶
GetSpecCfgVal get special cfg value from param cfgdata
func GetStrArrayCfgVal ¶
GetStrArrayCfgVal get string array value
func GetStrArraySpecCfgVal ¶
GetStrArraySpecCfgVal get string array value
func GetStringCfgVal ¶
GetStringCfgVal get string cfg value
func GetStringSpecCfgVal ¶
GetStringSpecCfgVal get string cfg value
func LoadJSONFromFile ¶
LoadJSONFromFile load json from file to result
func MinerAccounts ¶
MinerAccounts get miners' accounts
func NonceFor ¶ added in v0.5.0
func NonceFor(addr string, conn *grpc.ClientConn) uint64
NonceFor returns address' nonce in blockchain state
func ParseIPlist ¶
ParseIPlist parse ip list from json file
func PeerAddrs ¶
func PeerAddrs() []string
PeerAddrs gets execute transactions peers addresses from config file
func RemoveKeystoreFiles ¶
func RemoveKeystoreFiles(addrs ...string)
RemoveKeystoreFiles removes key store files
func SplitAddrRepeatRandom ¶
func SplitAddrRepeatRandom() bool
SplitAddrRepeatRandom return splitAddrRepeatRandom
func SplitAddrRepeatTxTimes ¶
func SplitAddrRepeatTxTimes() int
SplitAddrRepeatTxTimes return splitAddrRepeatTxTimes
func SplitAddrTestEnable ¶
func SplitAddrTestEnable() bool
SplitAddrTestEnable return splitAddrTestEnable
func SplitAddrUnitAccounts ¶
func SplitAddrUnitAccounts() int
SplitAddrUnitAccounts return splitAddrUnitAccounts
func StartLocalNodes ¶
StartLocalNodes start local nodes
func StartProcess ¶
StartProcess starts a process with args and default process attributions
func StopLocalNodes ¶
StopLocalNodes stop local nodes
func TickerDurationTxs ¶
TickerDurationTxs get ticker duration for calc tx count
func TimesToUpdateAddrs ¶
func TimesToUpdateAddrs() int
TimesToUpdateAddrs return timesToUpdateAddrs
func TokenBalanceFor ¶
func TokenBalanceFor( addr string, tokenHash string, tokenIndex uint32, conn *grpc.ClientConn, ) uint64
TokenBalanceFor get token balance of addr
func TokenRepeatTxTimes ¶
func TokenRepeatTxTimes() int
TokenRepeatTxTimes return tokenRepeatTxTimes
func TryRecordError ¶
TryRecordError try to record error during integration test
func UnlockAccount ¶
UnlockAccount defines unlock account
func WaitBalanceEnough ¶
func WaitBalanceEnough(addr string, amount uint64, conn *grpc.ClientConn, timeout time.Duration) (uint64, error)
WaitBalanceEnough wait balance of addr is more than amount
func WaitBalanceEqual ¶
func WaitBalanceEqual(addr string, amount uint64, conn *grpc.ClientConn, timeout time.Duration) (uint64, error)
WaitBalanceEqual wait balance of addr is more than amount
func WaitERC20AllowanceEqualTo ¶ added in v0.5.0
func WaitERC20AllowanceEqualTo( addr, contractAddr string, amount uint64, code []byte, conn *grpc.ClientConn, timeout time.Duration, ) error
WaitERC20AllowanceEqualTo waits ERC20 allowance of addr equal to amount
func WaitERC20BalanceEqualTo ¶ added in v0.5.0
func WaitERC20BalanceEqualTo( addr, contractAddr string, amount uint64, code []byte, conn *grpc.ClientConn, timeout time.Duration, ) error
WaitERC20BalanceEqualTo waits ERC20 balance of addr equal to amount
Types ¶
type CfgData ¶
type CfgData map[string]*json.RawMessage
CfgData define config data responding conf.json
func InitSpecConf ¶
InitSpecConf inits config and return CfgData variable