testutil

package
v0.5.0-rc8-hotfix2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2019 License: Apache-2.0 Imports: 11 Imported by: 4

Documentation

Index

Constants

View Source
const TestGasLimit uint64 = 20000

TestGasLimit represents the gas limit used for test actions

View Source
const TestGasPriceInt64 = 0

TestGasPriceInt64 represents the gas price for test actions in int64

Variables

View Source
var ErrTimeout = errors.New("timed out")

ErrTimeout is returned when time is up

View Source
var TestGasPrice = big.NewInt(unit.Qev)

TestGasPrice represents the gas price for test actions in big int

Functions

func CleanupPath

func CleanupPath(t *testing.T, path string)

CleanupPath detects the existence of test DB file and removes it if found

func RandomPort added in v0.4.4

func RandomPort() int

RandomPort returns a random port number between 30000 and 50000

func SignalChan

func SignalChan(interval, timeout time.Duration) <-chan struct{}

SignalChan returns a channel that will be written every interval until timeout

func SignedExecution added in v0.4.0

func SignedExecution(contractAddr string, executorPriKey keypair.PrivateKey, nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte) (action.SealedEnvelope, error)

SignedExecution return a signed execution

func SignedTransfer added in v0.4.0

func SignedTransfer(recipientAddr string, senderPriKey keypair.PrivateKey, nonce uint64, amount *big.Int, payload []byte, gasLimit uint64, gasPrice *big.Int) (action.SealedEnvelope, error)

SignedTransfer return a signed transfer

func SignedVote added in v0.4.0

func SignedVote(voteeAddr string, voterPriKey keypair.PrivateKey, nonce uint64, gasLimit uint64, gasPrice *big.Int) (action.SealedEnvelope, error)

SignedVote return a signed vote

func TimestampNow added in v0.4.0

func TimestampNow() time.Time

TimestampNow returns current time from new clock

func TimestampNowFromClock added in v0.4.0

func TimestampNowFromClock(c clock.Clock) time.Time

TimestampNowFromClock get now time from specific clock

func WaitUntil

func WaitUntil(interval, timeout time.Duration, f CheckCondition) error

WaitUntil periodically checks whether the condition specified in CheckCondition function is satisfied If an error is returned, it either comes from CheckCondition function or time is up before the given condition is satisfied

Types

type CheckCondition

type CheckCondition func() (bool, error)

CheckCondition defines a func type that checks whether a certain condition is satisfied

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL