Documentation ¶
Index ¶
- Constants
- func CheckLegacyProposal(version string) bool
- func RetrieveUpgradesList(upgradesPath string) ([]string, error)
- type EvmosVersions
- type Manager
- func (m *Manager) BuildImage(name, version, dockerFile, contextDir string, args map[string]string) error
- func (m *Manager) Client() *docker.Client
- func (m *Manager) ContainerID() string
- func (m *Manager) CreateDepositProposalExec(chainID string, id int) (string, error)
- func (m *Manager) CreateExec(cmd []string, containerID string) (string, error)
- func (m *Manager) CreateModuleQueryExec(moduleName, subCommand, chainID string) (string, error)
- func (m *Manager) CreateSubmitProposalExec(targetVersion, chainID string, upgradeHeight uint, legacy bool, ...) (string, error)
- func (m *Manager) CreateVoteProposalExec(chainID string, id int, flags ...string) (string, error)
- func (m *Manager) ExportState(targetDir string) error
- func (m *Manager) GetLogs(containerID string) (stdOut, stdErr string, err error)
- func (m *Manager) GetNodeHeight(ctx context.Context) (int, error)
- func (m *Manager) GetNodeVersion(ctx context.Context) (string, error)
- func (m *Manager) KillCurrentNode() error
- func (m *Manager) RemoveNetwork() error
- func (m *Manager) RunExec(ctx context.Context, exec string) (outBuf bytes.Buffer, errBuf bytes.Buffer, err error)
- func (m *Manager) RunNode(node *Node) error
- func (m *Manager) WaitForHeight(ctx context.Context, height int) (string, error)
- type Node
- type Params
- type VersionConfig
Constants ¶
const (
// LocalVersionTag defines the docker image ImageTag when building locally
LocalVersionTag = "latest"
)
The constants used in the upgrade tests are defined here
Variables ¶
This section is empty.
Functions ¶
func CheckLegacyProposal ¶
CheckLegacyProposal checks if the running node requires a legacy proposal
func RetrieveUpgradesList ¶
RetrieveUpgradesList parses the app/upgrades folder and returns a slice of semver upgrade versions in ascending order, e.g ["v1.0.0", "v1.0.1", "v1.1.0", ... , "v10.0.0"]
Types ¶
type EvmosVersions ¶
type EvmosVersions []string
EvmosVersions is a custom comparator for sorting semver version strings.
func (EvmosVersions) Less ¶
func (v EvmosVersions) Less(i, j int) bool
Less compares semver versions strings properly
func (EvmosVersions) Swap ¶
func (v EvmosVersions) Swap(i, j int)
Swap swaps the elements with indexes i and j. It is needed to sort the slice.
type Manager ¶
type Manager struct { // CurrentNode stores the currently running docker container CurrentNode *dockertest.Resource // HeightBeforeStop stores the last block height that was reached before the last running node container // was stopped HeightBeforeStop int // UpgradeHeight stores the upgrade height for the latest upgrade proposal that was submitted UpgradeHeight uint // contains filtered or unexported fields }
Manager defines a docker pool instance, used to build, run, interact with and stop docker containers running Evmos nodes.
func NewManager ¶
NewManager creates new docker pool and network and returns a populated Manager instance
func (*Manager) BuildImage ¶
func (m *Manager) BuildImage(name, version, dockerFile, contextDir string, args map[string]string) error
BuildImage builds a docker image to run in the provided context directory with <name>:<version> as the image target
func (*Manager) ContainerID ¶
ContainerID returns the docker container ID of the currently running Node
func (*Manager) CreateDepositProposalExec ¶
CreateDepositProposalExec creates a gov tx to deposit for the proposal with the given id
func (*Manager) CreateExec ¶
CreateExec creates docker exec command for specified container
func (*Manager) CreateModuleQueryExec ¶
CreateModuleQueryExec creates a Evmos module query
func (*Manager) CreateSubmitProposalExec ¶
func (m *Manager) CreateSubmitProposalExec(targetVersion, chainID string, upgradeHeight uint, legacy bool, flags ...string) (string, error)
CreateSubmitProposalExec creates a gov tx to submit an upgrade proposal to the chain
func (*Manager) CreateVoteProposalExec ¶
CreateVoteProposalExec creates gov tx to vote 'yes' on the proposal with the given id
func (*Manager) ExportState ¶
ExportState executes the 'docker cp' command to copy container .evmosd dir to the specified target dir (local)
See https://docs.docker.com/engine/reference/commandline/cp/
func (*Manager) GetNodeHeight ¶
GetNodeHeight calls the Evmos CLI in the current node container to get the current block height
func (*Manager) GetNodeVersion ¶
GetNodeVersion calls the Evmos CLI in the current node container to get the current node version
func (*Manager) KillCurrentNode ¶
KillCurrentNode stops the execution of the currently used docker container
func (*Manager) RemoveNetwork ¶
RemoveNetwork removes the Manager's used network from the pool
func (*Manager) RunExec ¶
func (m *Manager) RunExec(ctx context.Context, exec string) (outBuf bytes.Buffer, errBuf bytes.Buffer, err error)
RunExec runs the provided docker exec call
func (*Manager) RunNode ¶
RunNode creates a docker container from the provided node instance and runs it. To make sure the node started properly, get requests are sent to the JSON-RPC server repeatedly with a timeout of 60 seconds. In case the node fails to start, the container logs are returned along with the error.
type Node ¶
type Node struct { RunOptions *dockertest.RunOptions // contains filtered or unexported fields }
Node represents an Evmos node in the context of the upgrade tests. It contains fields to store the used repository, version as well as custom run options for dockertest.
func NewNode ¶
NewNode creates a new instance of the node with a set of sensible default RunOptions for dockertest.
func (*Node) Mount ¶
Mount sets the container mount point, which is used as the value for 'docker run --volume'.
See https://docs.docker.com/engine/reference/builder/#volume
func (*Node) SetCmd ¶
SetCmd sets the container entry command and overrides the image CMD instruction.
func (*Node) SetEnvVars ¶
SetEnvVars allows to set additional container environment variables by passing a slice of strings that each fit the pattern "VAR_NAME=value".
func (*Node) UseRunOptions ¶
func (n *Node) UseRunOptions()
UseRunOptions sets a flag to allow the node Manager to run the container with additional run options.
type Params ¶
type Params struct { // MountPath defines the path where the docker container is mounted MountPath string // Versions defines the slice of versions that are run during the upgrade tests Versions []VersionConfig // ChainID defines the chain ID used for the upgrade tests ChainID string // SkipCleanup defines if the docker containers are removed after the tests SkipCleanup bool // WorkDirRoot defines the working directory WorkDirRoot string }
Params defines the parameters for the upgrade test suite
func LoadUpgradeParams ¶
LoadUpgradeParams loads the upgrade parameters from the environment variables
type VersionConfig ¶
type VersionConfig struct { // UpgradeName defines the upgrade name to use in the proposal UpgradeName string // ImageTag defines the version tag to use in the docker image ImageTag string // ImageName defines the image name for the docker image ImageName string }
VersionConfig defines a struct that contains the version and the source repository for an upgrade