tests

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ACCOUNTS = []string{"alice", "bob", "charlie", "igor"}
)

nolint

Functions

func Clean added in v0.2.0

func Clean()

clean the directories

func ExecuteT

func ExecuteT(t *testing.T, cmd string) (out string)

Execute the command, return stdout, logging stdout/err to t.

func InitServerForTest added in v0.2.0

func InitServerForTest(t *testing.T)

Init Basecoin Test

func StartLCDServerForTest added in v0.2.0

func StartLCDServerForTest(t *testing.T, home, chainID string) (cmd *exec.Cmd, port string)

expects TestInitBaseCoin to have been run

func StartNodeServerForTest added in v0.2.0

func StartNodeServerForTest(t *testing.T, home string) *exec.Cmd

expects TestInitBaseCoin to have been run

func StartServer added in v0.2.0

func StartServer() error

expects TestInitBaseCoin to have been run

func TestInitBasecoin added in v0.2.0

func TestInitBasecoin(t *testing.T, home string) string

Init Basecoin Test

func WaitForHeight

func WaitForHeight(height int64, port string)

Uses localhost

func WaitForRPC

func WaitForRPC(laddr string)

Wait for the RPC server to respond to /status

func WaitForStart

func WaitForStart(port string)

wait for tendermint to start

Types

type Process

type Process struct {
	ExecPath     string
	Args         []string
	Pid          int
	StartTime    time.Time
	EndTime      time.Time
	Cmd          *exec.Cmd        `json:"-"`
	ExitState    *os.ProcessState `json:"-"`
	WaitCh       chan struct{}    `json:"-"`
	StdinPipe    io.WriteCloser   `json:"-"`
	StdoutBuffer *bytes.Buffer    `json:"-"`
	StderrBuffer *bytes.Buffer    `json:"-"`
}

execution process

func GoExecuteT

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 StartProcess

func StartProcess(dir string, name string, args []string, outFile, errFile io.WriteCloser) (*Process, error)

dir: The working directory. If "", os.Getwd() is used. name: Command name args: Args to command. (should not include name) outFile, errFile: If not nil, will use, otherwise new Buffers will be allocated. Either way, Process.Cmd.StdoutPipe and Process.Cmd.StderrPipe will be nil respectively.

func (*Process) Stop

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

stop the process

func (*Process) Wait

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