Documentation
¶
Index ¶
- Constants
- func AddEphemeralNode(network *tmpnet.Network, flags tmpnet.FlagsMap) *tmpnet.Node
- func CheckBootstrapIsPossible(network *tmpnet.Network)
- func ContextWithTimeout(duration time.Duration) context.Context
- func DefaultContext() context.Context
- func DescribeCChain(text string, args ...interface{}) bool
- func DescribePChain(text string, args ...interface{}) bool
- func DescribeXChain(text string, args ...interface{}) bool
- func DescribeXChainSerial(text string, args ...interface{}) bool
- func Eventually(condition func() bool, waitFor time.Duration, tick time.Duration, msg string)
- func InitSharedTestEnvironment(envBytes []byte)
- func NewEthClient(nodeURI tmpnet.NodeURI) ethclient.Client
- func NewWallet(keychain *secp256k1fx.Keychain, nodeURI tmpnet.NodeURI) primary.Wallet
- func SendEthTransaction(ethClient ethclient.Client, signedTx *types.Transaction) *types.Receipt
- func StartNetwork(network *tmpnet.Network, avalancheGoExecPath string, pluginDir string, ...)
- func SuggestGasPrice(ethClient ethclient.Client) *big.Int
- func WaitForHealthy(node *tmpnet.Node)
- func WithDefaultContext() common.Option
- func WithSuggestedGasPrice(ethClient ethclient.Client) common.Option
- type FlagVars
- type TestEnvironment
- func (te *TestEnvironment) AllocatePreFundedKey() *secp256k1.PrivateKey
- func (te *TestEnvironment) AllocatePreFundedKeys(count int) []*secp256k1.PrivateKey
- func (te *TestEnvironment) GetNetwork() *tmpnet.Network
- func (te *TestEnvironment) GetRandomNodeURI() tmpnet.NodeURI
- func (te *TestEnvironment) Marshal() []byte
- func (te *TestEnvironment) NewKeychain(count int) *secp256k1fx.Keychain
- func (te *TestEnvironment) StartPrivateNetwork(network *tmpnet.Network)
Constants ¶
const ( // A long default timeout used to timeout failed operations but // unlikely to induce flaking due to unexpected resource // contention. DefaultTimeout = 2 * time.Minute DefaultPollingInterval = tmpnet.DefaultPollingInterval // Setting this env will disable post-test bootstrap // checks. Useful for speeding up iteration during test // development. SkipBootstrapChecksEnvName = "E2E_SKIP_BOOTSTRAP_CHECKS" DefaultValidatorStartTimeDiff = tmpnet.DefaultValidatorStartTimeDiff DefaultGasLimit = uint64(21000) // Standard gas limit // An empty string prompts the use of the default path which ensures a // predictable target for github's upload-artifact action. DefaultNetworkDir = "" // Directory used to store private networks (specific to a single test) // under the shared network dir. PrivateNetworksDirName = "private_networks" )
const ( // Label for filtering a test that is not primarily a C-Chain test // but nonentheless uses the C-Chain. Intended to support // execution of all C-Chain tests by the coreth repo in an e2e job. UsesCChainLabel = "uses-c" )
Variables ¶
This section is empty.
Functions ¶
func AddEphemeralNode ¶
Adds an ephemeral node intended to be used by a single test.
func CheckBootstrapIsPossible ¶
Verify that a new node can bootstrap into the network. This function is safe to call from `Teardown` by virtue of not depending on ginkgo.DeferCleanup.
func ContextWithTimeout ¶
Helper simplifying use of a timed context by canceling the context on ginkgo teardown.
func DefaultContext ¶
Helper simplifying use of a timed context configured with the default timeout.
func DescribeCChain ¶
DescribeCChain annotates the tests for C-Chain.
func DescribePChain ¶
DescribePChain annotates the tests for P-Chain.
func DescribeXChain ¶
DescribeXChain annotates the tests for X-Chain.
func DescribeXChainSerial ¶
DescribeXChainSerial annotates serial tests for X-Chain.
func Eventually ¶
Re-implementation of testify/require.Eventually that is compatible with ginkgo. testify's version calls the condition function with a goroutine and ginkgo assertions don't work properly in goroutines.
func InitSharedTestEnvironment ¶
func InitSharedTestEnvironment(envBytes []byte)
func NewEthClient ¶
Create a new eth client targeting the specified node URI.
func SendEthTransaction ¶
Sends an eth transaction, waits for the transaction receipt to be issued and checks that the receipt indicates success.
func StartNetwork ¶ added in v1.10.18
func StartNetwork( network *tmpnet.Network, avalancheGoExecPath string, pluginDir string, shutdownDelay time.Duration, reuseNetwork bool, )
Start a temporary network with the provided avalanchego binary.
func SuggestGasPrice ¶
Determines the suggested gas price for the configured client that will maximize the chances of transaction acceptance.
func WaitForHealthy ¶
Wait for the given node to report healthy.
func WithDefaultContext ¶
Helper simplifying use via an option of a timed context configured with the default timeout.
Types ¶
type FlagVars ¶
type FlagVars struct {
// contains filtered or unexported fields
}
func RegisterFlags ¶
func RegisterFlags() *FlagVars
func (*FlagVars) AvalancheGoExecPath ¶
func (*FlagVars) NetworkDir ¶ added in v1.10.17
func (*FlagVars) NetworkShutdownDelay ¶ added in v1.11.3
func (*FlagVars) ReuseNetwork ¶ added in v1.11.9
func (*FlagVars) StopNetwork ¶ added in v1.11.9
type TestEnvironment ¶
type TestEnvironment struct { // The directory where the test network configuration is stored NetworkDir string // URIs used to access the API endpoints of nodes of the network URIs []tmpnet.NodeURI // The URI used to access the http server that allocates test data TestDataServerURI string // The duration to wait before shutting down private networks. A // non-zero value may be useful to ensure all metrics can be // scraped before shutdown. PrivateNetworkShutdownDelay time.Duration // contains filtered or unexported fields }
var Env *TestEnvironment
Env is used to access shared test fixture. Intended to be initialized from SynchronizedBeforeSuite.
func NewTestEnvironment ¶
func NewTestEnvironment(flagVars *FlagVars, desiredNetwork *tmpnet.Network) *TestEnvironment
Initialize a new test environment with a shared network (either pre-existing or newly created).
func (*TestEnvironment) AllocatePreFundedKey ¶ added in v1.10.18
func (te *TestEnvironment) AllocatePreFundedKey() *secp256k1.PrivateKey
Retrieve a funded key allocated for the caller's exclusive use.
func (*TestEnvironment) AllocatePreFundedKeys ¶ added in v1.10.18
func (te *TestEnvironment) AllocatePreFundedKeys(count int) []*secp256k1.PrivateKey
Retrieve the specified number of funded keys allocated for the caller's exclusive use.
func (*TestEnvironment) GetNetwork ¶
func (te *TestEnvironment) GetNetwork() *tmpnet.Network
Retrieve the network to target for testing.
func (*TestEnvironment) GetRandomNodeURI ¶
func (te *TestEnvironment) GetRandomNodeURI() tmpnet.NodeURI
Retrieve a random URI to naively attempt to spread API load across nodes.
func (*TestEnvironment) Marshal ¶
func (te *TestEnvironment) Marshal() []byte
func (*TestEnvironment) NewKeychain ¶
func (te *TestEnvironment) NewKeychain(count int) *secp256k1fx.Keychain
Create a new keychain with the specified number of test keys.
func (*TestEnvironment) StartPrivateNetwork ¶ added in v1.11.3
func (te *TestEnvironment) StartPrivateNetwork(network *tmpnet.Network)
Create a new private network that is not shared with other tests.