interchaintest

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackupConfig

func BackupConfig(chain chains.Chain) error

for saving data in particular format

func CleanBackupConfig

func CleanBackupConfig()

func CreateLogFile

func CreateLogFile(name string) (*os.File, error)

func DefaultBlockDatabaseFilepath

func DefaultBlockDatabaseFilepath() string

DefaultBlockDatabaseFilepath is the default filepath to the sqlite database for tracking blocks and transactions.

func DockerSetup

func DockerSetup(t *testing.T) (*client.Client, string)

DockerSetup returns a new Docker Client and the ID of a configured network, associated with t.

If any part of the setup fails, t.Fatal is called.

func GetLocalFileContent

func GetLocalFileContent(fileName string) ([]byte, error)

func KeepDockerVolumesOnFailure

func KeepDockerVolumesOnFailure(b bool)

KeepDockerVolumesOnFailure sets whether volumes associated with a particular test are retained or deleted following a test failure.

The value is false by default, but can be initialized to true by setting the environment variable IBCTEST_SKIP_FAILURE_CLEANUP to a non-empty value. Alternatively, importers of the interchaintest package may call KeepDockerVolumesOnFailure(true).

func New

func New(t *testing.T, cfg Config, logger *zap.Logger, dockerClient *client.Client, network string) ibc.Relayer

New returns an implementation of ibc.Relayer depending on the provided RelayerType.

func RestoreConfig

func RestoreConfig(chain chains.Chain) error

Types

type Config

type Config struct {
	// Tag is the tag used for the relayer image.
	Tag string `mapstructure:"tag"`
	// Image is the image that should be used for the relayer.
	Image string `mapstructure:"image"`
}

Config holds configuration values for the relayer used in the tests.

type Interchain

type Interchain struct {

	// Map of chain to additional genesis wallets to include at chain start.
	AdditionalGenesisWallets map[chains.Chain][]ibc.WalletAmount
	// contains filtered or unexported fields
}

Interchain represents a full IBC network, encompassing a collection of one or more chains, one or more relayer instances, and initial account configuration.

func NewInterchain

func NewInterchain() *Interchain

NewInterchain returns a new Interchain.

Typical usage involves multiple calls to AddChain, one or more calls to AddRelayer, one or more calls to AddLink, and then finally a single call to Build.

func (*Interchain) AddChain

func (ic *Interchain) AddChain(chain chains.Chain, additionalGenesisWallets ...ibc.WalletAmount) *Interchain

AddChain adds the given chain to the Interchain, using the chain ID reported by the chain's config. If the given chain already exists, or if another chain with the same configured chain ID exists, AddChain panics.

func (ic *Interchain) AddLink(link InterchainLink) *Interchain

AddLink adds the given link to the Interchain. If any validation fails, AddLink panics.

func (*Interchain) AddRelayer

func (ic *Interchain) AddRelayer(relayer ibc.Relayer, name string) *Interchain

AddRelayer adds the given relayer with the given name to the Interchain.

func (*Interchain) BuildChains

func (*Interchain) BuildRelayer

func (*Interchain) Close

func (ic *Interchain) Close() error

Close cleans up any resources created during Build, and returns any relevant errors.

func (*Interchain) WithLog

func (ic *Interchain) WithLog(log *zap.Logger) *Interchain

WithLog sets the logger on the interchain object. Usually the default nop logger is fine, but sometimes it can be helpful to see more verbose logs, typically by passing zaptest.NewLogger(t).

type InterchainBuildOptions

type InterchainBuildOptions struct {
	TestName string

	Client    *client.Client
	NetworkID string

	// If set, ic.Build does not create paths or links in the relayer,
	// but it does still configure keys and wallets for declared relayer-chain links.
	// This is useful for tests that need lower-level access to configuring relayers.
	SkipPathCreation bool

	// Optional. Git sha for test invocation. Once Go 1.18 supported,
	// may be deprecated in favor of runtime/debug.ReadBuildInfo.
	GitSha string

	// If set, saves block history to a sqlite3 database to aid debugging.
	BlockDatabaseFile string
}

InterchainBuildOptions describes configuration for (*Interchain).Build.

type InterchainLink struct {
	// Chains involved.
	Chain1, Chain2 chains.Chain

	// Relayer to use for link.
	Relayer ibc.Relayer
}

InterchainLink describes a link between two chains, by specifying the chain names, the relayer name, and the name of the path to create.

type RelayerFactory

type RelayerFactory interface {
	// Build returns a Relayer associated with the given arguments.
	Build(t *testing.T, cli *client.Client, networkID string) ibc.Relayer

	// Name returns a descriptive name of the factory,
	// indicating details of the Relayer that will be built.
	Name() string

	// Capabilities is an indication of the features this relayer supports.
	// Tests for any unsupported features will be skipped rather than failed.
	Capabilities() map[relayer.Capability]bool
}

func NewICONRelayerFactory

func NewICONRelayerFactory(logger *zap.Logger, options ...relayer.RelayerOption) RelayerFactory

Directories

Path Synopsis
_internal
blockdb
Package blockdb saves chain and block data for inspection later to aid in debugging ibctest failures.
Package blockdb saves chain and block data for inspection later to aid in debugging ibctest failures.
dockerutil
Package dockerutil contains helpers for interacting with Docker containers.
Package dockerutil contains helpers for interacting with Docker containers.
mocktesting
Package mocktesting contains a mock instance of *testing.T which is useful for testing ibctest's interactions with Go tests.
Package mocktesting contains a mock instance of *testing.T which is useful for testing ibctest's interactions with Go tests.
Package relayer contains general functionality relevant to individual relayer implementations.
Package relayer contains general functionality relevant to individual relayer implementations.
centralized
Package rly provides an interface to the cosmos relayer running in a Docker container.
Package rly provides an interface to the cosmos relayer running in a Docker container.
Package testreporter contains a Reporter for collecting detailed test reports.
Package testreporter contains a Reporter for collecting detailed test reports.
Package testutil includes convenience functions and types to help with testing
Package testutil includes convenience functions and types to help with testing

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL