Documentation ¶
Index ¶
- Variables
- func EditToml(filename string, f func(doc *tomledit.Document))
- func GetExecutableName() string
- func GetGenesisBalance(rawGenesis []byte, addr string) sdk.Coins
- func GetRequest(t *testing.T, url string) []byte
- func GetRequestWithHeaders(t *testing.T, url string, headers map[string]string, expCode int) []byte
- func GetRequestWithHeadersGreaterThanOrEqual(t *testing.T, url string, headers map[string]string, expCode int) []byte
- func IsV2() bool
- func IsVerbose() bool
- func LoadValidatorPubKey(t *testing.T, keyFile string) cryptotypes.PubKey
- func LoadValidatorPubKeyForNode(t *testing.T, sut *SystemUnderTest, nodeNumber int) cryptotypes.PubKey
- func MustCopyFile(src, dest string) *os.File
- func MustCopyFilesInDir(src, dest string)
- func MustRunShellCmd(t *testing.T, cmd string, args ...string) string
- func NodePath(n int, outputDir, name string) string
- func QueryCometValidatorPower(c RPCClient, pubKebBz []byte) int64
- func QueryCometValidatorPowerForNode(t *testing.T, sut *SystemUnderTest, nodeNumber int) int64
- func RequireTxFailure(t *testing.T, got string, containsMsgs ...string)
- func RequireTxSuccess(t *testing.T, got string)
- func RunRestQueries(t *testing.T, testCases ...RestTestCase)
- func RunRestQueriesIgnoreNumbers(t *testing.T, testCases ...RestTestCase)
- func RunShellCmd(cmd string, args ...string) (string, error)
- func RunTests(m *testing.M)
- func SetBool(doc *tomledit.Document, newVal bool, xpath ...string)
- func SetValue(doc *tomledit.Document, newVal string, xpath ...string)
- func StoreTempFile(t *testing.T, content []byte) *os.File
- func UpdatePort(doc *tomledit.Document, newPort int, xpath ...string)
- type CLIWrapper
- func (c CLIWrapper) AddKey(name string) string
- func (c CLIWrapper) AddKeyFromSeed(name, mnemoic string) string
- func (c CLIWrapper) AwaitTxCommitted(submitResp string, timeout ...time.Duration) (string, bool)
- func (c CLIWrapper) ChainID() string
- func (c CLIWrapper) CustomQuery(args ...string) string
- func (c CLIWrapper) FundAddress(destAddr, amount string) string
- func (c CLIWrapper) GetKeyAddr(name string) string
- func (c CLIWrapper) GetKeyAddrPrefix(name, prefix string) string
- func (c CLIWrapper) GetPubKeyByCustomField(addr, field string) string
- func (c CLIWrapper) Keys(args ...string) string
- func (c CLIWrapper) QueryBalance(addr, denom string) int64
- func (c CLIWrapper) QueryBalances(addr string) string
- func (c CLIWrapper) QueryTotalSupply(denom string) int64
- func (c CLIWrapper) Run(args ...string) string
- func (c CLIWrapper) RunAndWait(args ...string) string
- func (c CLIWrapper) RunCommandWithArgs(args ...string) string
- func (c CLIWrapper) SubmitAndVoteGovProposal(proposalJson string, args ...string) string
- func (c CLIWrapper) SubmitGovProposal(proposalJson string, args ...string) string
- func (c CLIWrapper) Version() string
- func (c CLIWrapper) WasmExecute(contractAddr, msg, from string, args ...string) string
- func (c CLIWrapper) WithAssertTXUncommitted() CLIWrapper
- func (c CLIWrapper) WithChainID(newChainID string) CLIWrapper
- func (c CLIWrapper) WithKeyringFlags(args ...string) []string
- func (c CLIWrapper) WithNodeAddress(nodeAddr string) CLIWrapper
- func (c CLIWrapper) WithQueryFlags(args ...string) []string
- func (c CLIWrapper) WithRunErrorMatcher(f RunErrorAssert) CLIWrapper
- func (c CLIWrapper) WithRunErrorsIgnored() CLIWrapper
- func (c CLIWrapper) WithRunSingleOutput() CLIWrapper
- func (c CLIWrapper) WithTXFlags(args ...string) []string
- func (c CLIWrapper) WithTargetNodeFlags(args ...string) []string
- type CleanupFn
- type EventConsumer
- type EventListener
- type GenesisMutator
- type ModifyConfigYamlInitializer
- type Node
- type RPCClient
- type RestTestCase
- type RunErrorAssert
- type SingleHostTestnetCmdInitializer
- type SystemUnderTest
- func (s *SystemUnderTest) APIAddress() string
- func (s *SystemUnderTest) AddFullnode(t *testing.T, beforeStart ...func(nodeNumber int, nodePath string)) Node
- func (s *SystemUnderTest) AllNodes(t *testing.T) []Node
- func (s *SystemUnderTest) AllPeers(t *testing.T) []string
- func (s *SystemUnderTest) AwaitBlockHeight(t *testing.T, targetHeight int64, timeout ...time.Duration)
- func (s *SystemUnderTest) AwaitChainStopped()
- func (s *SystemUnderTest) AwaitNBlocks(t *testing.T, n int64, timeout ...time.Duration)
- func (s *SystemUnderTest) AwaitNextBlock(t *testing.T, timeout ...time.Duration) int64
- func (s *SystemUnderTest) AwaitNodeUp(t *testing.T, rpcAddr string)
- func (s *SystemUnderTest) AwaitUpgradeInfo(t *testing.T)
- func (s *SystemUnderTest) BlockTime() time.Duration
- func (s *SystemUnderTest) CommitTimeout() time.Duration
- func (s *SystemUnderTest) CurrentHeight() int64
- func (s *SystemUnderTest) ExecBinary() string
- func (s *SystemUnderTest) ForEachNodeExecAndWait(t *testing.T, cmds ...[]string) [][]string
- func (s *SystemUnderTest) IsDirty() bool
- func (s *SystemUnderTest) Log(msg string)
- func (s *SystemUnderTest) Logf(msg string, args ...interface{})
- func (s *SystemUnderTest) MarkDirty()
- func (s *SystemUnderTest) ModifyGenesisCLI(t *testing.T, cmds ...[]string)
- func (s *SystemUnderTest) ModifyGenesisJSON(t *testing.T, mutators ...GenesisMutator)
- func (s *SystemUnderTest) NewEventListener(t *testing.T) *EventListener
- func (s *SystemUnderTest) NodeDir(i int) string
- func (s *SystemUnderTest) NodesCount() int
- func (s *SystemUnderTest) PrintBuffer()
- func (s *SystemUnderTest) RPCClient(t *testing.T) RPCClient
- func (s *SystemUnderTest) ReadGenesisJSON(t *testing.T) string
- func (s *SystemUnderTest) ResetChain(t *testing.T)
- func (s *SystemUnderTest) ResetDirtyChain(t *testing.T)
- func (s *SystemUnderTest) SetExecBinary(binary string)
- func (s *SystemUnderTest) SetTestnetInitializer(testnetInitializer TestnetInitializer)
- func (s *SystemUnderTest) SetupChain()
- func (s *SystemUnderTest) StartChain(t *testing.T, xargs ...string)
- func (s *SystemUnderTest) StopChain()
- func (s *SystemUnderTest) TestnetInitializer() TestnetInitializer
- type TestnetInitializer
Constants ¶
This section is empty.
Variables ¶
var ( // WorkDir is the directory where tests are executed. Path should be relative to this dir WorkDir string // ExecBinaryUnversionedRegExp regular expression to extract the unversioned binary name ExecBinaryUnversionedRegExp = regexp.MustCompile(`^(\w+)-?.*$`) MaxGas = 10_000_000 // DefaultApiPort is the port for the node to interact with DefaultApiPort = 1317 DefaultRpcPort = 26657 DefaultTelemetryPort = 7180 DefaultRestPort = 8080 DefaultGrpcPort = 9090 DefaultP2PPort = 16656 )
var ( Sut *SystemUnderTest Verbose bool )
var DefaultWaitTime = 30 * time.Second
Functions ¶
func GetExecutableName ¶
func GetExecutableName() string
func GetGenesisBalance ¶
GetGenesisBalance return the balance amount for an address from the given genesis json
func GetRequestWithHeaders ¶
func LoadValidatorPubKey ¶
func LoadValidatorPubKey(t *testing.T, keyFile string) cryptotypes.PubKey
LoadValidatorPubKey load validator nodes consensus pub key from disk
func LoadValidatorPubKeyForNode ¶
func LoadValidatorPubKeyForNode(t *testing.T, sut *SystemUnderTest, nodeNumber int) cryptotypes.PubKey
LoadValidatorPubKeyForNode load validator nodes consensus pub key for given node number
func MustCopyFile ¶
MustCopyFile copies the file from the source path `src` to the destination path `dest` and returns an open file handle to `dest`.
func MustCopyFilesInDir ¶
func MustCopyFilesInDir(src, dest string)
MustCopyFilesInDir copies all files (excluding directories) from the source directory `src` to the destination directory `dest`.
func QueryCometValidatorPowerForNode ¶
func QueryCometValidatorPowerForNode(t *testing.T, sut *SystemUnderTest, nodeNumber int) int64
QueryCometValidatorPowerForNode returns the validator's power from tendermint RPC endpoint. 0 when not found
func RequireTxFailure ¶
RequireTxFailure require the received response to contain any failure code and the passed msgs From CometBFT v1, an RPC error won't return ABCI response, and error must be parsed
func RequireTxSuccess ¶
RequireTxSuccess require the received response to contain the success code
func RunRestQueries ¶
func RunRestQueries(t *testing.T, testCases ...RestTestCase)
RunRestQueries runs given Rest testcases by making requests and checking response with expected output
func RunRestQueriesIgnoreNumbers ¶
func RunRestQueriesIgnoreNumbers(t *testing.T, testCases ...RestTestCase)
RunRestQueriesIgnoreNumbers runs given rest testcases by making requests and checking response with expected output ignoring number values This method is used when number values in response are non-deterministic
func StoreTempFile ¶
StoreTempFile creates a temporary file in the test's temporary directory with the provided content. It returns a pointer to the created file. Errors during the process are handled with test assertions.
Types ¶
type CLIWrapper ¶
type CLIWrapper struct { Debug bool // contains filtered or unexported fields }
CLIWrapper provides a more convenient way to interact with the CLI binary from the Go tests
func NewCLIWrapper ¶
func NewCLIWrapper(t *testing.T, sut *SystemUnderTest, verbose bool) *CLIWrapper
NewCLIWrapper constructor
func NewCLIWrapperX ¶
func NewCLIWrapperX( t *testing.T, execBinary string, nodeAddress string, chainID string, awaiter awaitNextBlock, nodesCount int, homeDir string, fees string, debug bool, assertErrorFn RunErrorAssert, runSingleOutput bool, expTXCommitted bool, ) *CLIWrapper
NewCLIWrapperX extended constructor
func (CLIWrapper) AddKey ¶
func (c CLIWrapper) AddKey(name string) string
AddKey add key to default keyring. Returns address
func (CLIWrapper) AddKeyFromSeed ¶
func (c CLIWrapper) AddKeyFromSeed(name, mnemoic string) string
AddKeyFromSeed recovers the key from given seed and add it to default keyring. Returns address
func (CLIWrapper) AwaitTxCommitted ¶
AwaitTxCommitted wait for tx committed on chain returns the server execution result and true when found within 3 blocks.
func (CLIWrapper) ChainID ¶
func (c CLIWrapper) ChainID() string
func (CLIWrapper) CustomQuery ¶
func (c CLIWrapper) CustomQuery(args ...string) string
CustomQuery main entrypoint for wasmd CLI queries
func (CLIWrapper) FundAddress ¶
func (c CLIWrapper) FundAddress(destAddr, amount string) string
FundAddress sends the token amount to the destination address
func (CLIWrapper) GetKeyAddr ¶
func (c CLIWrapper) GetKeyAddr(name string) string
GetKeyAddr returns Acc address
func (CLIWrapper) GetKeyAddrPrefix ¶
func (c CLIWrapper) GetKeyAddrPrefix(name, prefix string) string
GetKeyAddrPrefix returns key address with Beach32 prefix encoding for a key (acc|val|cons)
func (CLIWrapper) GetPubKeyByCustomField ¶
func (c CLIWrapper) GetPubKeyByCustomField(addr, field string) string
GetPubKeyByCustomField returns pubkey in base64 by custom field
func (CLIWrapper) Keys ¶
func (c CLIWrapper) Keys(args ...string) string
Keys wasmd keys CLI command
func (CLIWrapper) QueryBalance ¶
func (c CLIWrapper) QueryBalance(addr, denom string) int64
QueryBalance returns balance amount for given denom. 0 when not found
func (CLIWrapper) QueryBalances ¶
func (c CLIWrapper) QueryBalances(addr string) string
QueryBalances queries all balances for an account. Returns json response Example:`{"balances":[{"denom":"node0token","amount":"1000000000"},{"denom":"stake","amount":"400000003"}],"pagination":{}}`
func (CLIWrapper) QueryTotalSupply ¶
func (c CLIWrapper) QueryTotalSupply(denom string) int64
QueryTotalSupply returns total amount of tokens for a given denom. 0 when not found
func (CLIWrapper) Run ¶
func (c CLIWrapper) Run(args ...string) string
Run main entry for executing cli commands. When configured, method blocks until tx is committed.
func (CLIWrapper) RunAndWait ¶
func (c CLIWrapper) RunAndWait(args ...string) string
RunAndWait runs a cli command and waits for the server result when the TX is executed It returns the result of the transaction.
func (CLIWrapper) RunCommandWithArgs ¶
func (c CLIWrapper) RunCommandWithArgs(args ...string) string
RunCommandWithArgs use for run cli command, not tx
func (CLIWrapper) SubmitAndVoteGovProposal ¶
func (c CLIWrapper) SubmitAndVoteGovProposal(proposalJson string, args ...string) string
SubmitAndVoteGovProposal submit proposal, let all validators vote yes and return proposal id
func (CLIWrapper) SubmitGovProposal ¶
func (c CLIWrapper) SubmitGovProposal(proposalJson string, args ...string) string
SubmitGovProposal submit a gov v1 proposal
func (CLIWrapper) Version ¶
func (c CLIWrapper) Version() string
Version returns the current version of the client binary
func (CLIWrapper) WasmExecute ¶
func (c CLIWrapper) WasmExecute(contractAddr, msg, from string, args ...string) string
WasmExecute send MsgExecute to a contract
func (CLIWrapper) WithAssertTXUncommitted ¶
func (c CLIWrapper) WithAssertTXUncommitted() CLIWrapper
func (CLIWrapper) WithChainID ¶
func (c CLIWrapper) WithChainID(newChainID string) CLIWrapper
func (CLIWrapper) WithKeyringFlags ¶
func (c CLIWrapper) WithKeyringFlags(args ...string) []string
WithKeyringFlags append the test default keyring flags to the given args
func (CLIWrapper) WithNodeAddress ¶
func (c CLIWrapper) WithNodeAddress(nodeAddr string) CLIWrapper
func (CLIWrapper) WithQueryFlags ¶
func (c CLIWrapper) WithQueryFlags(args ...string) []string
WithQueryFlags append the test default query flags to the given args
func (CLIWrapper) WithRunErrorMatcher ¶
func (c CLIWrapper) WithRunErrorMatcher(f RunErrorAssert) CLIWrapper
WithRunErrorMatcher assert function to ensure run command error value
func (CLIWrapper) WithRunErrorsIgnored ¶
func (c CLIWrapper) WithRunErrorsIgnored() CLIWrapper
WithRunErrorsIgnored does not fail on any error
func (CLIWrapper) WithRunSingleOutput ¶
func (c CLIWrapper) WithRunSingleOutput() CLIWrapper
func (CLIWrapper) WithTXFlags ¶
func (c CLIWrapper) WithTXFlags(args ...string) []string
WithTXFlags append the test default TX flags to the given args. This includes - broadcast-mode: sync - output: json - chain-id - keyring flags - target-node
func (CLIWrapper) WithTargetNodeFlags ¶
func (c CLIWrapper) WithTargetNodeFlags(args ...string) []string
WithTargetNodeFlags append the test default target node address flags to the given args
type EventConsumer ¶
type EventConsumer func(e ctypes.ResultEvent) (more bool)
func CaptureAllEventsConsumer ¶
func CaptureAllEventsConsumer(t *testing.T, optMaxWaitTime ...time.Duration) (c EventConsumer, done func() []ctypes.ResultEvent)
CaptureAllEventsConsumer is an `EventConsumer` that captures all events until `done()` is called to stop or timeout happens. The consumer works async in the background and returns all the captured events when `done()` is called. This can be used to verify that certain events have happened. Example usage:
c, done := CaptureAllEventsConsumer(t) query := `tm.event='Tx'` cleanupFn := l.Subscribe(query, c) t.Cleanup(cleanupFn) // do something in your test that create events assert.Len(t, done(), 1) // then verify your assumption
func CaptureSingleEventConsumer ¶
func CaptureSingleEventConsumer() (EventConsumer, *ctypes.ResultEvent)
CaptureSingleEventConsumer consumes one event. No timeout
func TimeoutConsumer ¶
func TimeoutConsumer(t *testing.T, maxWaitTime time.Duration, next EventConsumer) EventConsumer
TimeoutConsumer is an event consumer decorator with a max wait time. Panics when wait time exceeded without a result returned
type EventListener ¶
type EventListener struct {
// contains filtered or unexported fields
}
EventListener watches for events on the chain
func NewEventListener ¶
func NewEventListener(t *testing.T, rpcAddr string) *EventListener
NewEventListener event listener
func (*EventListener) AwaitQuery ¶
func (l *EventListener) AwaitQuery(query string, optMaxWaitTime ...time.Duration) *ctypes.ResultEvent
AwaitQuery blocks and waits for a single result or timeout. This can be used with `broadcast-mode=async`. For query syntax See https://docs.cosmos.network/master/core/events.html#subscribing-to-events
func (*EventListener) Subscribe ¶
func (l *EventListener) Subscribe(query string, cb EventConsumer) func()
Subscribe to receive events for a topic. Does not block. For query syntax See https://docs.cosmos.network/master/core/events.html#subscribing-to-events
type GenesisMutator ¶
func SetConsensusMaxGas ¶
func SetConsensusMaxGas(t *testing.T, max int) GenesisMutator
SetConsensusMaxGas max gas that can be consumed in a block
func SetGovExpeditedVotingPeriod ¶
func SetGovExpeditedVotingPeriod(t *testing.T, period time.Duration) GenesisMutator
func SetGovVotingPeriod ¶
func SetGovVotingPeriod(t *testing.T, period time.Duration) GenesisMutator
type ModifyConfigYamlInitializer ¶
type ModifyConfigYamlInitializer struct {
// contains filtered or unexported fields
}
ModifyConfigYamlInitializer testnet cmd prior to --single-host param. Modifies the toml files.
func NewModifyConfigYamlInitializer ¶
func NewModifyConfigYamlInitializer(exec string, s *SystemUnderTest) *ModifyConfigYamlInitializer
func (ModifyConfigYamlInitializer) Initialize ¶
func (s ModifyConfigYamlInitializer) Initialize()
type RPCClient ¶
type RPCClient struct {
// contains filtered or unexported fields
}
RPCClient is a test helper to interact with a node via the RPC endpoint.
func (RPCClient) NewStream ¶
func (r RPCClient) NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error)
func (RPCClient) Validators ¶
Validators returns list of validators
type RestTestCase ¶
type RunErrorAssert ¶
RunErrorAssert is custom type that is satisfies by testify matchers as well
var ( // ErrOutOfGasMatcher requires error with "out of gas" message ErrOutOfGasMatcher RunErrorAssert = func(t assert.TestingT, err error, args ...interface{}) bool { const oogMsg = "out of gas" return expErrWithMsg(t, err, args, oogMsg) } // ErrTimeoutMatcher requires time out message ErrTimeoutMatcher RunErrorAssert = func(t assert.TestingT, err error, args ...interface{}) bool { const expMsg = "timed out waiting for tx to be included in a block" return expErrWithMsg(t, err, args, expMsg) } // ErrPostFailedMatcher requires post failed ErrPostFailedMatcher RunErrorAssert = func(t assert.TestingT, err error, args ...interface{}) bool { const expMsg = "post failed" return expErrWithMsg(t, err, args, expMsg) } )
type SingleHostTestnetCmdInitializer ¶
type SingleHostTestnetCmdInitializer struct {
// contains filtered or unexported fields
}
SingleHostTestnetCmdInitializer default testnet cmd that supports the --single-host param
func NewSingleHostTestnetCmdInitializer ¶
func NewSingleHostTestnetCmdInitializer( execBinary, workDir, chainID, outputDir string, initialNodesCount int, minGasPrice string, commitTimeout time.Duration, log func(string), ) *SingleHostTestnetCmdInitializer
NewSingleHostTestnetCmdInitializer constructor
func (SingleHostTestnetCmdInitializer) Initialize ¶
func (s SingleHostTestnetCmdInitializer) Initialize()
type SystemUnderTest ¶
type SystemUnderTest struct { ChainStarted bool // contains filtered or unexported fields }
SystemUnderTest blockchain provisioning
func GetSystemUnderTest ¶
func GetSystemUnderTest() *SystemUnderTest
func NewSystemUnderTest ¶
func NewSystemUnderTest(execBinary string, verbose bool, nodesCount int, blockTime time.Duration, initer ...TestnetInitializer) *SystemUnderTest
func (*SystemUnderTest) APIAddress ¶
func (s *SystemUnderTest) APIAddress() string
func (*SystemUnderTest) AddFullnode ¶
func (s *SystemUnderTest) AddFullnode(t *testing.T, beforeStart ...func(nodeNumber int, nodePath string)) Node
AddFullnode starts a new fullnode that connects to the existing chain but is not a validator.
func (*SystemUnderTest) AwaitBlockHeight ¶
func (s *SystemUnderTest) AwaitBlockHeight(t *testing.T, targetHeight int64, timeout ...time.Duration)
AwaitBlockHeight blocks until the target height is reached. An optional timeout parameter can be passed to abort early
func (*SystemUnderTest) AwaitChainStopped ¶
func (s *SystemUnderTest) AwaitChainStopped()
func (*SystemUnderTest) AwaitNBlocks ¶
AwaitNBlocks blocks until the current height + n block is reached. An optional timeout parameter can be passed to abort early
func (*SystemUnderTest) AwaitNextBlock ¶
AwaitNextBlock is a first class function that any caller can use to ensure a new block was minted. Returns the new height
func (*SystemUnderTest) AwaitNodeUp ¶
func (s *SystemUnderTest) AwaitNodeUp(t *testing.T, rpcAddr string)
AwaitNodeUp ensures the node is running
func (*SystemUnderTest) AwaitUpgradeInfo ¶
func (s *SystemUnderTest) AwaitUpgradeInfo(t *testing.T)
AwaitUpgradeInfo blocks util an upgrade info file is persisted to disk
func (*SystemUnderTest) BlockTime ¶
func (s *SystemUnderTest) BlockTime() time.Duration
func (*SystemUnderTest) CommitTimeout ¶
func (s *SystemUnderTest) CommitTimeout() time.Duration
CommitTimeout returns the max time to wait for a commit. Default to 90% of block time
func (*SystemUnderTest) CurrentHeight ¶
func (s *SystemUnderTest) CurrentHeight() int64
func (*SystemUnderTest) ExecBinary ¶
func (s *SystemUnderTest) ExecBinary() string
ExecBinary returns the path of the binary executable associated with the SystemUnderTest instance.
func (*SystemUnderTest) ForEachNodeExecAndWait ¶
func (s *SystemUnderTest) ForEachNodeExecAndWait(t *testing.T, cmds ...[]string) [][]string
ForEachNodeExecAndWait runs the given app executable commands for all cluster nodes synchronously The commands output is returned for each node.
func (*SystemUnderTest) IsDirty ¶
func (s *SystemUnderTest) IsDirty() bool
IsDirty true when non default genesis or other state modification were applied that might create incompatibility for tests
func (*SystemUnderTest) Log ¶
func (s *SystemUnderTest) Log(msg string)
func (*SystemUnderTest) Logf ¶
func (s *SystemUnderTest) Logf(msg string, args ...interface{})
func (*SystemUnderTest) MarkDirty ¶
func (s *SystemUnderTest) MarkDirty()
MarkDirty whole chain will be reset when marked dirty
func (*SystemUnderTest) ModifyGenesisCLI ¶
func (s *SystemUnderTest) ModifyGenesisCLI(t *testing.T, cmds ...[]string)
ModifyGenesisCLI executes the CLI commands to modify the genesis
func (*SystemUnderTest) ModifyGenesisJSON ¶
func (s *SystemUnderTest) ModifyGenesisJSON(t *testing.T, mutators ...GenesisMutator)
ModifyGenesisJSON resets the chain and executes the callbacks to update the json representation The mutator callbacks after each other receive the genesis as raw bytes and return the updated genesis for the next. example:
return func(genesis []byte) []byte { val, _ := json.Marshal(sdk.NewDecCoins(fees...)) state, _ := sjson.SetRawBytes(genesis, "app_state.globalfee.params.minimum_gas_prices", val) return state }
func (*SystemUnderTest) NewEventListener ¶
func (s *SystemUnderTest) NewEventListener(t *testing.T) *EventListener
NewEventListener constructor for Eventlistener with system rpc address
func (*SystemUnderTest) NodeDir ¶
func (s *SystemUnderTest) NodeDir(i int) string
NodeDir returns the workdir and path to the node home folder.
func (*SystemUnderTest) NodesCount ¶
func (s *SystemUnderTest) NodesCount() int
NodesCount returns the number of node instances used
func (*SystemUnderTest) PrintBuffer ¶
func (s *SystemUnderTest) PrintBuffer()
PrintBuffer prints the chain logs to the console
func (*SystemUnderTest) ReadGenesisJSON ¶
func (s *SystemUnderTest) ReadGenesisJSON(t *testing.T) string
ReadGenesisJSON returns current genesis.json content as raw string
func (*SystemUnderTest) ResetChain ¶
func (s *SystemUnderTest) ResetChain(t *testing.T)
ResetChain stops and clears all nodes state via 'unsafe-reset-all'
func (*SystemUnderTest) ResetDirtyChain ¶
func (s *SystemUnderTest) ResetDirtyChain(t *testing.T)
ResetDirtyChain reset chain when non default setup or state (dirty)
func (*SystemUnderTest) SetExecBinary ¶
func (s *SystemUnderTest) SetExecBinary(binary string)
SetExecBinary sets the executable binary for the system under test.
func (*SystemUnderTest) SetTestnetInitializer ¶
func (s *SystemUnderTest) SetTestnetInitializer(testnetInitializer TestnetInitializer)
SetTestnetInitializer sets the initializer for the testnet configuration.
func (*SystemUnderTest) SetupChain ¶
func (s *SystemUnderTest) SetupChain()
func (*SystemUnderTest) StartChain ¶
func (s *SystemUnderTest) StartChain(t *testing.T, xargs ...string)
func (*SystemUnderTest) StopChain ¶
func (s *SystemUnderTest) StopChain()
StopChain stops the system under test and executes all registered cleanup callbacks
func (*SystemUnderTest) TestnetInitializer ¶
func (s *SystemUnderTest) TestnetInitializer() TestnetInitializer
TestnetInitializer returns the testnet initializer associated with the SystemUnderTest.
type TestnetInitializer ¶
type TestnetInitializer interface {
Initialize()
}
func InitializerWithBinary ¶
func InitializerWithBinary(binary string, sut *SystemUnderTest) TestnetInitializer
InitializerWithBinary creates new SingleHostTestnetCmdInitializer from sut with given binary