Documentation ¶
Overview ¶
Package testsuite provides a suite of end-to-end tests for the IBC relayer. This file contains the implementation of the E2ETestSuite struct and its methods. The E2ETestSuite struct provides methods for setting up the relayer, creating clients, connections, and channels, and executing packet flows between chains. It also provides methods for retrieving client, connection, and channel states and sequences. All methods in this file use the relayer package to interact with the relayer and the interchaintest package to build and manage interchain networks.
Index ¶
- func GetAppKey(ctx context.Context, contract string) string
- type E2ETestSuite
- func (s *E2ETestSuite) ConvertToPlainString(input string) (string, error)
- func (s *E2ETestSuite) CrashNode(ctx context.Context, chain chains.Chain) error
- func (s *E2ETestSuite) CrashRelayer(ctx context.Context, callbacks ...func() error) error
- func (s *E2ETestSuite) CreateChannel(ctx context.Context, pathName, portID string, order ibc.Order) error
- func (s *E2ETestSuite) CreateClient(ctx context.Context) error
- func (s *E2ETestSuite) CreateConnection(ctx context.Context) error
- func (s *E2ETestSuite) DeployXCallMockApp(ctx context.Context, port string) error
- func (s *E2ETestSuite) GeneratePathName() string
- func (s *E2ETestSuite) GetChains(chainOpts ...testconfig.ChainOptionConfiguration) (chains.Chain, chains.Chain)
- func (s *E2ETestSuite) GetChannel(ctx context.Context, chain chains.Chain, channelSuffix int, portID string) (*chantypes.Channel, error)
- func (s *E2ETestSuite) GetChannelSequence(ctx context.Context, chain chains.Chain) (int, error)
- func (s *E2ETestSuite) GetChannels(ctx context.Context, chainID string) ([]ibc.ChannelOutput, error)
- func (s *E2ETestSuite) GetClientSequence(ctx context.Context, chain chains.Chain) (int, error)
- func (s *E2ETestSuite) GetClientState(ctx context.Context, chain chains.Chain, clientSuffix int) (any, error)
- func (s *E2ETestSuite) GetConnectionState(ctx context.Context, chain chains.Chain, suffix int) (*conntypes.ConnectionEnd, error)
- func (s *E2ETestSuite) GetNextConnectionSequence(ctx context.Context, chain chains.Chain) (int, error)
- func (s *E2ETestSuite) GetPathName(idx int64) string
- func (s *E2ETestSuite) GetRelayerExecReporter() *testreporter.RelayerExecReporter
- func (s *E2ETestSuite) GetRelayerWallets(relayer ibc.Relayer) (ibc.Wallet, ibc.Wallet, error)
- func (s *E2ETestSuite) Recover(ctx context.Context, waitDuration time.Duration) error
- func (s *E2ETestSuite) ResumeNode(ctx context.Context, chain chains.Chain) error
- func (s *E2ETestSuite) SendPacket(ctx context.Context, src, target chains.Chain, msg string, timeout uint64) (chains.PacketTransferResponse, error)
- func (s *E2ETestSuite) SetCfg() error
- func (s *E2ETestSuite) SetupChainsAndRelayer(ctx context.Context, channelOpts ...func(*ibc.CreateChannelOptions)) ibc.Relayer
- func (s *E2ETestSuite) SetupMockDApp(ctx context.Context, portId string) error
- func (s *E2ETestSuite) SetupRelayer(ctx context.Context) (ibc.Relayer, error)
- func (s *E2ETestSuite) SetupXCall(ctx context.Context, portId string, duration int) error
- func (s *E2ETestSuite) StartRelayer(relayer ibc.Relayer, pathName string) error
- func (s *E2ETestSuite) StopRelayer(ctx context.Context, relayer ibc.Relayer) error
- func (s *E2ETestSuite) UpdateClients(ctx context.Context, relayer ibc.Relayer, pathName string)
- func (s *E2ETestSuite) WriteBlockHeight(ctx context.Context, chainID string, height uint64) error
- func (s *E2ETestSuite) WriteCurrentBlockHeight(ctx context.Context, chain chains.Chain) func() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type E2ETestSuite ¶
type E2ETestSuite struct { suite.Suite DockerClient *dockerclient.Client CurrentPathName string // contains filtered or unexported fields }
E2ETestSuite has methods and functionality which can be shared among all test suites.
func (*E2ETestSuite) ConvertToPlainString ¶
func (s *E2ETestSuite) ConvertToPlainString(input string) (string, error)
func (*E2ETestSuite) CrashRelayer ¶
func (s *E2ETestSuite) CrashRelayer(ctx context.Context, callbacks ...func() error) error
func (*E2ETestSuite) CreateChannel ¶
func (s *E2ETestSuite) CreateChannel(ctx context.Context, pathName, portID string, order ibc.Order) error
CreateChannel creates a channel on the interchain network.
func (*E2ETestSuite) CreateClient ¶
func (s *E2ETestSuite) CreateClient(ctx context.Context) error
CreateClient creates a client on the interchain network.
func (*E2ETestSuite) CreateConnection ¶
func (s *E2ETestSuite) CreateConnection(ctx context.Context) error
CreateConnection creates a connection on the interchain network.
func (*E2ETestSuite) DeployXCallMockApp ¶
func (s *E2ETestSuite) DeployXCallMockApp(ctx context.Context, port string) error
func (*E2ETestSuite) GeneratePathName ¶
func (s *E2ETestSuite) GeneratePathName() string
GeneratePathName generates the path name using the test suites name
func (*E2ETestSuite) GetChains ¶
func (s *E2ETestSuite) GetChains(chainOpts ...testconfig.ChainOptionConfiguration) (chains.Chain, chains.Chain)
GetChains returns two chains that can be used in a test. The pair returned is unique to the current test being run. Note: this function does not create containers.
func (*E2ETestSuite) GetChannel ¶
func (s *E2ETestSuite) GetChannel(ctx context.Context, chain chains.Chain, channelSuffix int, portID string) (*chantypes.Channel, error)
GetChannel returns the channel for the given chain and channel suffix.
func (*E2ETestSuite) GetChannelSequence ¶
GetChannelSequence returns the channel sequence for the given chain.
func (*E2ETestSuite) GetChannels ¶
func (s *E2ETestSuite) GetChannels(ctx context.Context, chainID string) ([]ibc.ChannelOutput, error)
GetChannels returns all channels for the given chain ID.
func (*E2ETestSuite) GetClientSequence ¶
GetClientSequence returns the client sequence for the given chain.
func (*E2ETestSuite) GetClientState ¶
func (s *E2ETestSuite) GetClientState(ctx context.Context, chain chains.Chain, clientSuffix int) (any, error)
GetClientState returns the client state for the given chain.
func (*E2ETestSuite) GetConnectionState ¶
func (s *E2ETestSuite) GetConnectionState(ctx context.Context, chain chains.Chain, suffix int) (*conntypes.ConnectionEnd, error)
GetConnectionState returns the connection state for the given chain.
func (*E2ETestSuite) GetNextConnectionSequence ¶
func (s *E2ETestSuite) GetNextConnectionSequence(ctx context.Context, chain chains.Chain) (int, error)
GetNextConnectionSequence returns the next connection sequence for the given chain.
func (*E2ETestSuite) GetPathName ¶
func (s *E2ETestSuite) GetPathName(idx int64) string
GetPathName returns the name of a path at a specific index. This can be used in tests when the path name is required.
func (*E2ETestSuite) GetRelayerExecReporter ¶
func (s *E2ETestSuite) GetRelayerExecReporter() *testreporter.RelayerExecReporter
GetRelayerExecReporter returns a testreporter.RelayerExecReporter instances using the current test's testing.T.
func (*E2ETestSuite) GetRelayerWallets ¶
GetRelayerWallets returns the relayer wallets associated with the chains.
func (*E2ETestSuite) Recover ¶
Recover recovers a relay and waits for the relay to catch up to the current height of the stopped chains. This is because relay needs to sync with the counterchain network when it was on crashed state.
func (*E2ETestSuite) ResumeNode ¶
Resume Node
func (*E2ETestSuite) SendPacket ¶
func (s *E2ETestSuite) SendPacket(ctx context.Context, src, target chains.Chain, msg string, timeout uint64) (chains.PacketTransferResponse, error)
SendPacket sends a packet from src to dst
func (*E2ETestSuite) SetCfg ¶
func (s *E2ETestSuite) SetCfg() error
func (*E2ETestSuite) SetupChainsAndRelayer ¶
func (s *E2ETestSuite) SetupChainsAndRelayer(ctx context.Context, channelOpts ...func(*ibc.CreateChannelOptions)) ibc.Relayer
SetupChainsAndRelayer create two chains, a relayer, establishes a connection and creates a channel using the given channel options. The relayer returned by this function has not yet started. It should be started with E2ETestSuite.StartRelayer if needed. This should be called at the start of every test, unless fine grained control is required.
func (*E2ETestSuite) SetupMockDApp ¶
func (s *E2ETestSuite) SetupMockDApp(ctx context.Context, portId string) error
func (*E2ETestSuite) SetupRelayer ¶
SetupRelayer sets up the relayer, creates interchain networks, builds chains, and starts the relayer. It returns a Relayer interface and an error if any.
func (*E2ETestSuite) SetupXCall ¶
func (*E2ETestSuite) StartRelayer ¶
func (s *E2ETestSuite) StartRelayer(relayer ibc.Relayer, pathName string) error
StartRelayer starts the given relayer.
func (*E2ETestSuite) StopRelayer ¶
StopRelayer stops the given relayer.
func (*E2ETestSuite) UpdateClients ¶
UpdateClients updates clients on chainA and chainB
func (*E2ETestSuite) WriteBlockHeight ¶
func (*E2ETestSuite) WriteCurrentBlockHeight ¶
func (s *E2ETestSuite) WriteCurrentBlockHeight(ctx context.Context, chain chains.Chain) func() error
WriteBlockHeight writes the block height to the given file.