runner

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrChainAlreadyExists = errors.New("chain already exists")
)

Functions

This section is empty.

Types

type ChainDetails

type ChainDetails struct {
	RpcUrl    string
	GrpcUrl   string
	EvmRpcUrl string

	ChainId      string
	StakingDenom string
}

ChainDetails wraps information about the properties & endpoints of a chain.

func (ChainDetails) EvmClient

func (c ChainDetails) EvmClient() (*ethclient.Client, error)

EvmClient dials the underlying EVM RPC url and returns an ethclient.

func (ChainDetails) GrpcConn

func (c ChainDetails) GrpcConn() (*grpc.ClientConn, error)

GrpcConn creates a new connection to the underlying Grpc url.

type Chains

type Chains struct {
	// contains filtered or unexported fields
}

Chains wraps a map of name -> details about how to connect to a chain. It prevents registering multiple chains with the same name & encapsulates panicking if attempting to access a chain that does not exist.

func NewChains

func NewChains() Chains

NewChains creates an empty Chains map.

func (Chains) MustGetChain

func (c Chains) MustGetChain(name string) *ChainDetails

MustGetChain returns the chain of a given name, or panics if a chain with that name has not been registered.

func (*Chains) Register

func (c *Chains) Register(name string, chain *ChainDetails) error

Register adds a chain to the map. It returns an error if a ChainDetails with that name has already been registered.

type LiveNodeRunner

type LiveNodeRunner struct {
	// contains filtered or unexported fields
}

LiveNodeRunner implements NodeRunner for an already-running chain. If a LiveNodeRunner is used, end-to-end tests are run against a live chain.

func NewLiveNodeRunner

func NewLiveNodeRunner(config LiveNodeRunnerConfig) *LiveNodeRunner

NewLiveNodeRunner creates a new LiveNodeRunner.

func (LiveNodeRunner) Shutdown

func (LiveNodeRunner) Shutdown()

Shutdown implements NodeRunner. As the chains are externally operated, this is a no-op.

func (LiveNodeRunner) StartChains

func (r LiveNodeRunner) StartChains() Chains

StartChains implements NodeRunner. It initializes connections to the chain based on parameters. It attempts to ping the necessary endpoints and panics if they cannot be reached.

type LiveNodeRunnerConfig

type LiveNodeRunnerConfig struct {
	NemoRpcUrl    string
	NemoGrpcUrl   string
	NemoEvmRpcUrl string
}

LiveNodeRunnerConfig implements NodeRunner. It connects to a running network via the RPC, GRPC, and EVM urls.

type NmtoolRunner added in v0.1.3

type NmtoolRunner struct {
	// contains filtered or unexported fields
}

NmtoolRunner implements a NodeRunner that spins up local chains with nmtool. It has support for the following: - running a Nemo node - optionally, running an IBC node with a channel opened to the Nemo node - optionally, start the Nemo node on one version and upgrade to another

func NewNmtoolRunner added in v0.1.3

func NewNmtoolRunner(config NmtoolRunnerConfig) *NmtoolRunner

NewNmtoolRunner creates a new NmtoolRunner.

func (*NmtoolRunner) Shutdown added in v0.1.3

func (k *NmtoolRunner) Shutdown()

Shutdown implements NodeRunner. For NmtoolRunner, it shuts down the local nmtool network. To prevent shutting down the chain (eg. to preserve logs or examine post-test state) use the `SkipShutdown` option on the config.

func (*NmtoolRunner) StartChains added in v0.1.3

func (k *NmtoolRunner) StartChains() Chains

StartChains implements NodeRunner. For NmtoolRunner, it sets up, runs, and connects to a local chain via nmtool.

type NmtoolRunnerConfig added in v0.1.3

type NmtoolRunnerConfig struct {
	NemoConfigTemplate string

	ImageTag   string
	IncludeIBC bool

	EnableAutomatedUpgrade  bool
	NemoUpgradeName         string
	NemoUpgradeHeight       int64
	NemoUpgradeBaseImageTag string

	SkipShutdown bool
}

type NodeRunner

type NodeRunner interface {
	StartChains() Chains
	Shutdown()
}

NodeRunner is responsible for starting and managing docker containers to run a node.

Jump to

Keyboard shortcuts

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