Documentation ¶
Index ¶
- Constants
- func ApplyMockIO(c *cobra.Command) (*strings.Reader, *bytes.Buffer, *bytes.Buffer)
- func ExecuteT(t *testing.T, cmd, input string) (stdout, stderr string)
- func ExtractPortFromAddress(listenAddress string) string
- func NewTestCaseDir(t *testing.T) (string, func())
- func StatusOK(statusCode int) bool
- func WaitForHeight(height int64, port string)
- func WaitForHeightTM(height int64, port string)
- func WaitForLCDStart(port string)
- func WaitForNextHeightTM(port string)
- func WaitForNextNBlocksTM(n int64, port string)
- func WaitForRPC(laddr string)
- func WaitForStart(url string)
- func WaitForTMStart(port string)
- type Process
Constants ¶
const (
// Tests expect a ledger device initialized to the following mnemonic
TestMnemonic = "equip will roof matter pink blind book anxiety banner elbow sun young"
)
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 ApplyMockIO ¶
ApplyMockIO replaces stdin/out/err with buffers that can be used during testing.
func ExecuteT ¶
ExecuteT executes the command, pipes any input to STDIN and return STDOUT, logging STDOUT/STDERR to t.
func ExtractPortFromAddress ¶
ExtractPortFromAddress extract port from listenAddress The listenAddress must be some strings like tcp://0.0.0.0:12345
func NewTestCaseDir ¶
NewTestCaseDir creates a new temporary directory for a test case. Returns the directory path and a cleanup function. nolint: errcheck
func WaitForHeight ¶
Wait for height from the LCD API on localhost
func WaitForHeightTM ¶
Wait for the given height from the Tendermint RPC on localhost
func WaitForLCDStart ¶
func WaitForLCDStart(port string)
wait for tendermint to start by querying the LCD
func WaitForNextHeightTM ¶
func WaitForNextHeightTM(port string)
Wait for the next tendermint block from the Tendermint RPC on localhost
func WaitForNextNBlocksTM ¶
Wait for N tendermint blocks to pass using the Tendermint RPC on localhost
func WaitForStart ¶
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 ¶
func WaitForTMStart(port string)
wait for tendermint to start by querying tendermint
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:"-"` StdinPipe io.WriteCloser `json:"-"` StdoutPipe io.ReadCloser `json:"-"` StderrPipe io.ReadCloser `json:"-"` }
execution process
func CreateProcess ¶
Same as StartProcess but doesn't start the process
func GoExecuteT ¶
Execute the command, launch goroutines to log stdout/err to t. Caller should wait for .Wait() or .Stop() to terminate.
func GoExecuteTWithStdout ¶
Same as GoExecuteT but spawns a go routine to ReadAll off stdout.
func StartProcess ¶
dir: The working directory. If "", os.Getwd() is used. name: Command name args: Args to command. (should not include name)