Documentation ¶
Overview ¶
Package relayertest enables testing the relayer command-line interface from within Go unit tests.
Index ¶
- Constants
- type RunResult
- type System
- func (s *System) MustAddChain(t *testing.T, chainName string, pcw cmd.ProviderConfigWrapper)
- func (s *System) MustGetConfig(t *testing.T) (config cmd.ConfigInputWrapper)
- func (s *System) MustRun(t *testing.T, args ...string) RunResult
- func (s *System) MustRunWithInput(t *testing.T, in io.Reader, args ...string) RunResult
- func (s *System) MustRunWithLogger(t *testing.T, logger *zap.Logger, args ...string) RunResult
- func (s *System) Run(log *zap.Logger, args ...string) RunResult
- func (s *System) RunC(ctx context.Context, log *zap.Logger, args ...string) RunResult
- func (s *System) RunWithInput(log *zap.Logger, in io.Reader, args ...string) RunResult
- func (s *System) RunWithInputC(ctx context.Context, log *zap.Logger, in io.Reader, args ...string) RunResult
- func (s *System) WriteConfig(t *testing.T, contents []byte) error
Constants ¶
const ( ZeroMnemonic = "" /* 187-byte string literal not displayed */ ZeroCosmosAddr = "cosmos1r5v5srda7xfth3hn2s26txvrcrntldjumt8mhl" )
A fixed mnemonic and its resulting cosmos address, helpful for tests that need a mnemonic.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RunResult ¶
RunResult is the stdout and stderr resulting from a call to (*System).Run, and any error that was returned.
type System ¶
type System struct { // Temporary directory to be injected as --home argument. HomeDir string }
System is a system under test.
func NewSystem ¶
NewSystem creates a new system with a home dir associated with a temp dir belonging to t.
The returned System does not store a reference to t; some of its methods expect a *testing.T as an argument. This allows creating one instance of System to be shared with subtests.
func (*System) MustAddChain ¶
MustAddChain serializes pcw to disk and calls "chains add --file".
func (*System) MustGetConfig ¶
func (s *System) MustGetConfig(t *testing.T) (config cmd.ConfigInputWrapper)
MustAddChain serializes pcw to disk and calls "chains add --file".
func (*System) MustRunWithInput ¶
MustRunWithInput calls RunWithInput, but also calls t.Fatal if RunResult.Err is not nil.
func (*System) MustRunWithLogger ¶
func (*System) RunWithInput ¶
RunWithInput is shorthand for RunWithInputC(context.Background(), ...).
func (*System) RunWithInputC ¶
func (s *System) RunWithInputC(ctx context.Context, log *zap.Logger, in io.Reader, args ...string) RunResult
RunWithInputC executes the root command with the given context and args, providing in as the command's standard input, and returns a RunResult that has its Stdout and Stderr populated.