Documentation ¶
Index ¶
- Constants
- Variables
- func AddEphemeralNode(tc tests.TestContext, network *tmpnet.Network, flags tmpnet.FlagsMap) *tmpnet.Node
- func CheckBootstrapIsPossible(tc tests.TestContext, network *tmpnet.Network) *tmpnet.Node
- 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 InitSharedTestEnvironment(t require.TestingT, envBytes []byte)
- func NewPChainFeeCalculatorFromContext(context *builder.Context) fee.Calculator
- func NewPrivateKey(tc tests.TestContext) *secp256k1.PrivateKey
- func NewWallet(tc tests.TestContext, keychain *secp256k1fx.Keychain, nodeURI tmpnet.NodeURI) primary.Wallet
- func StartNetwork(tc tests.TestContext, network *tmpnet.Network, avalancheGoExecPath string, ...)
- func WaitForHealthy(t require.TestingT, node *tmpnet.Node)
- type FlagVars
- func (v *FlagVars) ActivateEtna() bool
- func (v *FlagVars) AvalancheGoExecPath() string
- func (v *FlagVars) NetworkDir() string
- func (v *FlagVars) NetworkShutdownDelay() time.Duration
- func (v *FlagVars) NodeCount() int
- func (v *FlagVars) PluginDir() string
- func (v *FlagVars) RestartNetwork() bool
- func (v *FlagVars) ReuseNetwork() bool
- func (v *FlagVars) StopNetwork() bool
- type GinkgoTestContext
- func (*GinkgoTestContext) By(text string, callback ...func())
- func (*GinkgoTestContext) Cleanup()
- func (tc *GinkgoTestContext) ContextWithTimeout(duration time.Duration) context.Context
- func (tc *GinkgoTestContext) DefaultContext() context.Context
- func (*GinkgoTestContext) DeferCleanup(cleanup func())
- func (*GinkgoTestContext) Errorf(format string, args ...interface{})
- func (*GinkgoTestContext) Eventually(condition func() bool, waitFor time.Duration, tick time.Duration, msg string)
- func (*GinkgoTestContext) FailNow()
- func (*GinkgoTestContext) GetWriter() io.Writer
- func (*GinkgoTestContext) Outf(format string, args ...interface{})
- func (tc *GinkgoTestContext) WithDefaultContext() common.Option
- type TestEnvironment
Constants ¶
const ( DefaultTimeout = tests.DefaultTimeout 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 ¶
var EmitMetricsLink bool
Whether a spec-scoped metrics link should be emitted after the current spec finishes executing.
Functions ¶
func AddEphemeralNode ¶
func AddEphemeralNode(tc tests.TestContext, network *tmpnet.Network, flags tmpnet.FlagsMap) *tmpnet.Node
Adds an ephemeral node intended to be used by a single test.
func CheckBootstrapIsPossible ¶
Verify that a new node can bootstrap into the network. If the check wasn't skipped, the node will be returned to the caller.
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 NewPChainFeeCalculatorFromContext ¶
func NewPChainFeeCalculatorFromContext(context *builder.Context) fee.Calculator
NewPChainFeeCalculatorFromContext returns either a static or dynamic fee calculator depending on the provided context.
func NewPrivateKey ¶
func NewPrivateKey(tc tests.TestContext) *secp256k1.PrivateKey
NewPrivateKey returns a new private key.
func NewWallet ¶
func NewWallet(tc tests.TestContext, keychain *secp256k1fx.Keychain, nodeURI tmpnet.NodeURI) primary.Wallet
Create a new wallet for the provided keychain against the specified node URI.
Types ¶
type FlagVars ¶
type FlagVars struct {
// contains filtered or unexported fields
}
func RegisterFlags ¶
func RegisterFlags() *FlagVars
func (*FlagVars) ActivateEtna ¶
func (*FlagVars) AvalancheGoExecPath ¶
func (*FlagVars) NetworkDir ¶
func (*FlagVars) NetworkShutdownDelay ¶
func (*FlagVars) RestartNetwork ¶
func (*FlagVars) ReuseNetwork ¶
func (*FlagVars) StopNetwork ¶
type GinkgoTestContext ¶
type GinkgoTestContext struct{}
func NewTestContext ¶
func NewTestContext() *GinkgoTestContext
func (*GinkgoTestContext) By ¶
func (*GinkgoTestContext) By(text string, callback ...func())
func (*GinkgoTestContext) Cleanup ¶
func (*GinkgoTestContext) Cleanup()
func (*GinkgoTestContext) ContextWithTimeout ¶
func (tc *GinkgoTestContext) ContextWithTimeout(duration time.Duration) context.Context
Helper simplifying use of a timed context by canceling the context on ginkgo teardown.
func (*GinkgoTestContext) DefaultContext ¶
func (tc *GinkgoTestContext) DefaultContext() context.Context
Helper simplifying use of a timed context configured with the default timeout.
func (*GinkgoTestContext) DeferCleanup ¶
func (*GinkgoTestContext) DeferCleanup(cleanup func())
func (*GinkgoTestContext) Errorf ¶
func (*GinkgoTestContext) Errorf(format string, args ...interface{})
func (*GinkgoTestContext) Eventually ¶
func (*GinkgoTestContext) Eventually(condition func() bool, waitFor time.Duration, tick time.Duration, msg string)
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 (*GinkgoTestContext) FailNow ¶
func (*GinkgoTestContext) FailNow()
func (*GinkgoTestContext) GetWriter ¶
func (*GinkgoTestContext) GetWriter() io.Writer
func (*GinkgoTestContext) Outf ¶
func (*GinkgoTestContext) Outf(format string, args ...interface{})
Outputs to stdout.
Examples:
- Out("{{green}}{{bold}}hi there %q{{/}}", "aa")
- Out("{{magenta}}{{bold}}hi therea{{/}} {{cyan}}{{underline}}b{{/}}")
See https://github.com/onsi/ginkgo/blob/v2.0.0/formatter/formatter.go#L52-L73 for an exhaustive list of color options.
func (*GinkgoTestContext) WithDefaultContext ¶
func (tc *GinkgoTestContext) WithDefaultContext() common.Option
Helper simplifying use via an option of a timed context configured with the default timeout.
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 // Pre-funded key for this ginkgo process PreFundedKey *secp256k1.PrivateKey // 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 }
func GetEnv ¶
func GetEnv(tc tests.TestContext) *TestEnvironment
Retrieve the test environment configured with the provided test context.
func NewTestEnvironment ¶
func NewTestEnvironment(tc tests.TestContext, flagVars *FlagVars, desiredNetwork *tmpnet.Network) *TestEnvironment
Initialize a new test environment with a shared network (either pre-existing or newly created).
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() *secp256k1fx.Keychain
Create a new keychain with the process's pre-funded key.
func (*TestEnvironment) StartPrivateNetwork ¶
func (te *TestEnvironment) StartPrivateNetwork(network *tmpnet.Network)
Create a new private network that is not shared with other tests.