e2e

package
v1.9.3-rc.4 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: BSD-3-Clause Imports: 13 Imported by: 4

README

Avalanche e2e test suites

  • Works for any environments (e.g., local, test network).
  • Compiles to a single binary with customizable configurations.

Running tests

go install -v github.com/onsi/ginkgo/v2/ginkgo@v2.0.0
ACK_GINKGO_RC=true ginkgo build ./tests/e2e
./tests/e2e/e2e.test --help

./tests/e2e/e2e.test \
--network-runner-grpc-endpoint="0.0.0.0:12340" \
--avalanchego-path=./build/avalanchego

See tests.e2e.sh for an example.

Adding tests

Define any flags/configurations in e2e.go.

Create a new package to implement feature-specific tests, or add tests to an existing package. For example:

.
└── e2e
    ├── README.md
    ├── e2e.go
    ├── e2e_test.go
    └── ping
        └── suites.go

e2e.go defines common configurations (e.g., network-runner client) for other test packages. ping/suites.go defines ping tests, annotated by [Ping], which can be selected by ./tests/e2e/e2e.test --ginkgo.focus "\[Local\] \[Ping\]".

Documentation

Overview

e2e implements the e2e tests.

Index

Constants

View Source
const (
	Unknown ClusterType = iota
	StandAlone
	PreExisting

	// Enough for primary.NewWallet to fetch initial UTXOs.
	DefaultWalletCreationTimeout = 5 * time.Second

	// Defines default tx confirmation timeout.
	// Enough for test/custom networks.
	DefaultConfirmTxTimeout = 20 * time.Second

	DefaultShutdownTimeout = 2 * time.Minute
)

Variables

View Source
var Env = &TestEnvinronment{
	testEnvironmentConfig: &testEnvironmentConfig{
		clusterType: Unknown,
	},
}

Env is the global struct containing all we need to test

Functions

func DescribePChain added in v1.7.17

func DescribePChain(text string, body func()) bool

DescribePChain annotates the tests for P-Chain. Can run with any type of cluster (e.g., local, fuji, mainnet).

func DescribeXChain

func DescribeXChain(text string, body func()) bool

DescribeXChain annotates the tests for X-Chain. Can run with any type of cluster (e.g., local, fuji, mainnet).

Types

type ClusterType added in v1.9.0

type ClusterType byte

type TestEnvinronment added in v1.9.0

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

func (*TestEnvinronment) ConfigCluster added in v1.9.0

func (te *TestEnvinronment) ConfigCluster(
	logLevel string,
	networkRunnerGRPCEp string,
	avalancheGoExecPath string,
	avalancheGoLogLevel string,
	uris string,
	testKeysFile string,
) error

should be called only once must be called before StartCluster Note that either networkRunnerGRPCEp or uris must be specified

func (*TestEnvinronment) GetRunnerClient added in v1.9.0

func (te *TestEnvinronment) GetRunnerClient() (cli runner_sdk.Client)

func (*TestEnvinronment) GetRunnerGRPCEndpoint added in v1.9.0

func (te *TestEnvinronment) GetRunnerGRPCEndpoint() (ep string)

func (*TestEnvinronment) GetTestKeys added in v1.9.0

func (*TestEnvinronment) GetURIs added in v1.9.0

func (te *TestEnvinronment) GetURIs() []string

func (*TestEnvinronment) LoadKeys added in v1.9.0

func (te *TestEnvinronment) LoadKeys() error

func (*TestEnvinronment) RestoreInitialState added in v1.9.0

func (te *TestEnvinronment) RestoreInitialState(switchOffNetworkFirst bool) error

func (*TestEnvinronment) ShutdownCluster added in v1.9.0

func (te *TestEnvinronment) ShutdownCluster() error

func (*TestEnvinronment) SnapInitialState added in v1.9.0

func (te *TestEnvinronment) SnapInitialState() error

func (*TestEnvinronment) StartCluster added in v1.9.0

func (te *TestEnvinronment) StartCluster() error

Directories

Path Synopsis
Implements tests for the banff network upgrade.
Implements tests for the banff network upgrade.
p
Implements ping tests, requires network-runner cluster.
Implements ping tests, requires network-runner cluster.
Implements static handlers tests for avm and platformvm
Implements static handlers tests for avm and platformvm
x
transfer
Implements X-chain transfer tests.
Implements X-chain transfer tests.
whitelist-vtx
Implements X-Chain whitelist vtx (stop vertex) tests.
Implements X-Chain whitelist vtx (stop vertex) tests.

Jump to

Keyboard shortcuts

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