tests

package
v0.31.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Tests expect a ledger device initialized to the following mnemonic
	TestMnemonic = "equip will roof matter pink blind book anxiety banner elbow sun young"
)

Variables

This section is empty.

Functions

func ExecuteT added in v0.16.0

func ExecuteT(t *testing.T, cmd, input string) (stdout, stderr string)

ExecuteT executes the command, pipes any input to STDIN and return STDOUT, logging STDOUT/STDERR to t. nolint: errcheck

func ExtractPortFromAddress added in v0.25.0

func ExtractPortFromAddress(listenAddress string) string

ExtractPortFromAddress extract port from listenAddress The listenAddress must be some strings like tcp://0.0.0.0:12345

func NewTestCaseDir added in v0.31.0

func NewTestCaseDir(t *testing.T) (string, func())

NewTestCaseDir creates a new temporary directory for a test case. Returns the directory path and a cleanup function. nolint: errcheck

func StatusOK added in v0.20.0

func StatusOK(statusCode int) bool

Whether or not an HTTP status code was "successful"

func WaitForHeight added in v0.16.0

func WaitForHeight(height int64, port string)

Wait for height from the LCD API on localhost

func WaitForHeightTM added in v0.20.0

func WaitForHeightTM(height int64, port string)

Wait for the given height from the Tendermint RPC on localhost

func WaitForLCDStart added in v0.20.0

func WaitForLCDStart(port string)

wait for tendermint to start by querying the LCD

func WaitForNextHeightTM added in v0.20.0

func WaitForNextHeightTM(port string)

Wait for the next tendermint block from the Tendermint RPC on localhost

func WaitForNextNBlocksTM added in v0.20.0

func WaitForNextNBlocksTM(n int64, port string)

Wait for N tendermint blocks to pass using the Tendermint RPC on localhost

func WaitForRPC added in v0.16.0

func WaitForRPC(laddr string)

Wait for the RPC server to respond to /status

func WaitForStart added in v0.16.0

func WaitForStart(url string)

WaitForStart waits for the node to start by pinging the url every 100ms for 10s until it returns 200. If it takes longer than 5s, it panics.

func WaitForTMStart added in v0.20.0

func WaitForTMStart(port string)

wait for tendermint to start by querying tendermint

Types

type Process added in v0.18.0

type Process struct {
	ExecPath   string
	Args       []string
	Pid        int
	StartTime  time.Time
	EndTime    time.Time
	Cmd        *exec.Cmd        `json:"-"`
	ExitState  *os.ProcessState `json:"-"`
	StdinPipe  io.WriteCloser   `json:"-"`
	StdoutPipe io.ReadCloser    `json:"-"`
	StderrPipe io.ReadCloser    `json:"-"`
}

execution process

func CreateProcess added in v0.20.0

func CreateProcess(dir string, name string, args []string) (*Process, error)

Same as StartProcess but doesn't start the process

func GoExecuteT added in v0.16.0

func GoExecuteT(t *testing.T, cmd string) (proc *Process)

Execute the command, launch goroutines to log stdout/err to t. Caller should wait for .Wait() or .Stop() to terminate.

func GoExecuteTWithStdout added in v0.20.0

func GoExecuteTWithStdout(t *testing.T, cmd string) (proc *Process)

Same as GoExecuteT but spawns a go routine to ReadAll off stdout.

func StartProcess added in v0.18.0

func StartProcess(dir string, name string, args []string) (*Process, error)

dir: The working directory. If "", os.Getwd() is used. name: Command name args: Args to command. (should not include name)

func (*Process) ReadAll added in v0.20.0

func (proc *Process) ReadAll() (stdout []byte, stderr []byte, err error)

ReadAll calls ioutil.ReadAll on the StdoutPipe and StderrPipe.

func (*Process) Stop added in v0.18.0

func (proc *Process) Stop(kill bool) error

stop the process

func (*Process) Wait added in v0.18.0

func (proc *Process) Wait()

wait for the process

Jump to

Keyboard shortcuts

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