containers

package
v27.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: Apache-2.0 Imports: 18 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 e2e-docker-build-debug` either in CI or locally.
	CurrentBranchOsmoRepository = "osmosis"
	CurrentBranchOsmoTag        = "debug"
)
View Source
const (
	GasLimit = 400000
)

Variables

View Source
var (
	Fees = txfeestypes.ConsensusMinFee.Mul(osmomath.NewDec(GasLimit)).Ceil().TruncateInt64() // We set consensus min fee = .0025 uosmo / gas * 400000 gas = 1000

)

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 utilities. Returns an error if initialisation 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, checkTxHash, returnTxHashInfoAsJSON bool) (bytes.Buffer, bytes.Buffer, error)
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) ExecQueryTxHash

func (m *Manager) ExecQueryTxHash(t *testing.T, containerName, txHash string, returnAsJson bool) (bytes.Buffer, bytes.Buffer, error)

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} --yes --keyring-backend=test "--log_format=json" --gas=400000`, and searching for `successStr`

func (*Manager) ExecTxCmdWithSuccessStringJSON

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

UNFORKINGNOTE: Figure out a better way to do this instead of copying the same method for JSON and YAML

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, rejectConfigDefaults bool) (*dockertest.Resource, error)

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

type TxResponse

type TxResponse struct {
	Code      int      `yaml:"code" json:"code"`
	Codespace string   `yaml:"codespace" json:"codespace"`
	Data      string   `yaml:"data" json:"data"`
	GasUsed   string   `yaml:"gas_used" json:"gas_used"`
	GasWanted string   `yaml:"gas_wanted" json:"gas_wanted"`
	Height    string   `yaml:"height" json:"height"`
	Info      string   `yaml:"info" json:"info"`
	Logs      []string `yaml:"logs" json:"logs"`
	Timestamp string   `yaml:"timestamp" json:"timestamp"`
	Tx        string   `yaml:"tx" json:"tx"`
	TxHash    string   `yaml:"txhash" json:"txhash"`
	RawLog    string   `yaml:"raw_log" json:"raw_log"`
	Events    []string `yaml:"events" json:"events"`
}

Jump to

Keyboard shortcuts

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