testcommon

package
v0.2.1-dev Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LookupEnvBool

func LookupEnvBool(t *testing.T, key string, defaultValue bool) bool

func LookupEnvInt

func LookupEnvInt(t *testing.T, key string, defaultValue int) int

func LookupEnvStringArray

func LookupEnvStringArray(key string, defaultValue []string) []string

Types

type Client

type Client struct {
	RpcConnectionType  RpcConnectionType               // what kind of rpc connection to use
	Clients            []cosmosclient.Client           // clients to attach to
	QueryAuths         []authtypes.QueryClient         // query clients for auth
	QueryBanks         []banktypes.QueryClient         // query clients for bank
	QueryDistributions []distributiontypes.QueryClient // query clients for distribution
	QueryEmissionses   []emissionstypes.QueryClient    // query clients for emissions
	QueryMints         []minttypes.QueryClient         // query clients for mint
	RpcCounterSeed     int64                           // if round-robin which RPC to use next, if random, seed to use
	RpcCounterMutex    *sync.Mutex                     // mutex for the counter
	Rand               *rand.Rand                      // random number generator
	// contains filtered or unexported fields
}

where to get ahold of a node

func NewClient

func NewClient(
	t *testing.T,
	rpcConnectionType RpcConnectionType,
	nodeRpcAddresses []string,
	alloraHomeDir string,
	seed int64,
) Client

create a new appchain client that we can use

func (*Client) AccountRegistryCreate

func (c *Client) AccountRegistryCreate(name string) (
	acc cosmosaccount.Account,
	mnemonic string,
	err error,
)

func (*Client) AccountRegistryGetByName

func (c *Client) AccountRegistryGetByName(name string) (
	cosmosaccount.Account,
	error,
)

func (*Client) BroadcastTx

func (c *Client) BroadcastTx(
	ctx context.Context,
	account cosmosaccount.Account,
	msgs ...sdktypes.Msg,
) (cosmosclient.Response, error)

func (*Client) Context

func (c *Client) Context() sdkclient.Context

func (*Client) QueryAuth

func (c *Client) QueryAuth() authtypes.QueryClient

/ Accessors for Query Clients. These don't have to be concurrency aware because they are read only, and the RPC endpoint should handle concurrency.

func (*Client) QueryBank

func (c *Client) QueryBank() banktypes.QueryClient

func (*Client) QueryDistribution

func (c *Client) QueryDistribution() distributiontypes.QueryClient

func (*Client) QueryEmissions

func (c *Client) QueryEmissions() emissionstypes.QueryClient

func (*Client) QueryMint

func (c *Client) QueryMint() minttypes.QueryClient

func (*Client) WaitForNextBlock

func (c *Client) WaitForNextBlock(ctx context.Context) error

func (*Client) WaitForTx

func (c *Client) WaitForTx(ctx context.Context, hash string) (*coretypes.ResultTx, error)

type RpcConnectionType

type RpcConnectionType = uint8
const (
	SingleRpc RpcConnectionType = iota
	RoundRobin
	RandomBasedOnDeterministicSeed
)

func LookupRpcMode

func LookupRpcMode(t *testing.T, key string, defaultValue RpcConnectionType) RpcConnectionType

type TestConfig

type TestConfig struct {
	T             *testing.T
	Ctx           context.Context
	Client        Client                // a testcommon.Client which holds several cosmosclient.Client instances
	AlloraHomeDir string                // home directory for the allora keystore
	FaucetAcc     cosmosaccount.Account // account info for the faucet
	FaucetAddr    string                // faucets address, string encoded bech32
	UpshotAcc     cosmosaccount.Account // account info for the upshot account
	UpshotAddr    string                // upshot address, string encoded bech32
	AliceAcc      cosmosaccount.Account // account info for the alice test account
	AliceAddr     string                // alice address, string encoded bech32
	BobAcc        cosmosaccount.Account // account info for the bob test account
	BobAddr       string                // bob address, string encoded bech32
	Cdc           codec.Codec           // common codec for encoding/decoding
	Seed          int                   // global non-mutable seed used for naming the test run
}

handle to various node data

func NewTestConfig

func NewTestConfig(
	t *testing.T,
	rpcConnectionType RpcConnectionType,
	nodeRpcAddresses []string,
	alloraHomeDir string,
	seed int,
) TestConfig

create a new config that we can use

Jump to

Keyboard shortcuts

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