containers

package
v14.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Current Git branch osmosis repo/version. It is meant to be built locally.
	// It is used when skipping upgrade by setting OSMOSIS_E2E_SKIP_UPGRADE to true).
	// This image should be pre-built with `make docker-build-debug` either in CI or locally.
	CurrentBranchOsmoRepository = "osmosis"
	CurrentBranchOsmoTag        = "debug"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ImageConfig

type ImageConfig struct {
	InitRepository string
	InitTag        string

	OsmosisRepository string
	OsmosisTag        string

	RelayerRepository string
	RelayerTag        string
}

ImageConfig contains all images and their respective tags needed for running e2e tests.

func NewImageConfig

func NewImageConfig(isUpgrade, isFork bool) ImageConfig

Returns ImageConfig needed for running e2e test. If isUpgrade is true, returns images for running the upgrade If isFork is true, utilizes provided fork height to initiate fork logic

type Manager

type Manager struct {
	ImageConfig
	// contains filtered or unexported fields
}

Manager is a wrapper around all Docker instances, and the Docker API. It provides utilities to run and interact with all Docker containers used within e2e testing.

func NewManager

func NewManager(isUpgrade bool, isFork bool, isDebugLogEnabled bool) (docker *Manager, err error)

NewManager creates a new Manager instance and initializes all Docker specific utilies. Returns an error if initialiation fails.

func (*Manager) ClearResources

func (m *Manager) ClearResources() error

ClearResources removes all outstanding Docker resources created by the Manager.

func (*Manager) ExecCmd

func (m *Manager) ExecCmd(t *testing.T, containerName string, command []string, success string) (bytes.Buffer, bytes.Buffer, error)

ExecCmd executes command by running it on the node container (specified by containerName) success is the output of the command that needs to be observed for the command to be deemed successful. It is found by checking if stdout or stderr contains the success string anywhere within it. returns container std out, container std err, and error if any. An error is returned if the command fails to execute or if the success string is not found in the output.

func (*Manager) ExecHermesCmd

func (m *Manager) ExecHermesCmd(t *testing.T, command []string, success string) (bytes.Buffer, bytes.Buffer, error)

ExecHermesCmd executes command on the hermes relaer container.

func (*Manager) ExecTxCmd

func (m *Manager) ExecTxCmd(t *testing.T, chainId string, containerName string, command []string) (bytes.Buffer, bytes.Buffer, error)

ExecTxCmd Runs ExecTxCmdWithSuccessString searching for `code: 0`

func (*Manager) ExecTxCmdWithSuccessString

func (m *Manager) ExecTxCmdWithSuccessString(t *testing.T, chainId string, containerName string, command []string, successStr string) (bytes.Buffer, bytes.Buffer, error)

ExecTxCmdWithSuccessString Runs ExecCmd, with flags for txs added. namely adding flags `--chain-id={chain-id} -b=block --yes --keyring-backend=test "--log_format=json"`, and searching for `successStr`

func (*Manager) GetHostPort

func (m *Manager) GetHostPort(containerName string, portId string) (string, error)

GetHostPort returns the port-forwarding address of the running host necessary to connect to the portId exposed inside the container. The container is determined by containerName. Returns the host-port or error if any.

func (*Manager) GetNodeResource

func (m *Manager) GetNodeResource(containerName string) (*dockertest.Resource, error)

GetNodeResource returns the node resource for containerName.

func (*Manager) PurgeResource

func (m *Manager) PurgeResource(resource *dockertest.Resource) error

PurgeResource purges the container resource and returns an error if any.

func (*Manager) RemoveNodeResource

func (m *Manager) RemoveNodeResource(containerName string) error

RemoveNodeResource removes a node container specified by containerName. Returns error if any.

func (*Manager) RunChainInitResource

func (m *Manager) RunChainInitResource(chainId string, chainVotingPeriod, chainExpeditedVotingPeriod int, validatorConfigBytes []byte, mountDir string, forkHeight int) (*dockertest.Resource, error)

RunChainInitResource runs a chain init container to initialize genesis and configs for a chain with chainId. The chain is to be configured with chainVotingPeriod and validators deserialized from validatorConfigBytes. The genesis and configs are to be mounted on the init container as volume on mountDir path. Returns the container resource and error if any. This method does not Purge the container. The caller must deal with removing the resource.

func (*Manager) RunHermesResource

func (m *Manager) RunHermesResource(chainAID, osmoARelayerNodeName, osmoAValMnemonic, chainBID, osmoBRelayerNodeName, osmoBValMnemonic string, hermesCfgPath string) (*dockertest.Resource, error)

RunHermesResource runs a Hermes container. Returns the container resource and error if any. the name of the hermes container is "<chain A id>-<chain B id>-relayer"

func (*Manager) RunNodeResource

func (m *Manager) RunNodeResource(chainId string, containerName, valCondifDir string) (*dockertest.Resource, error)

RunNodeResource runs a node container. Assings containerName to the container. Mounts the container on valConfigDir volume on the running host. Returns the container resource and error if any.

Jump to

Keyboard shortcuts

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