Documentation ¶
Overview ¶
Package session defines types for doing system tests.
It facilitates launching a network of nodes each in a separate process and run tests against them via the API.
Index ¶
- Constants
- func BenchmarkCfg() cfg.ConfigSet
- func NewMultiErr(errs []error) error
- func PerCPU(fn func(int), n int)
- func Run(ctx context.Context, dir string, numNodes int, config cfg.ConfigSet, fn Tester) error
- func RunWithConfigs(ctx context.Context, dir string, numNodes int, configs []cfg.ConfigSet, ...) error
- func SystemCfg() cfg.ConfigSet
- func WithServices(config cfg.ConfigSet, services ...string) cfg.ConfigSet
- type MultiErr
- type TestNode
- type TestNodeSet
- type Tester
Constants ¶
const NumSeeds = 5
NumSeeds is the number of seeds in a bootstrap list.
Variables ¶
This section is empty.
Functions ¶
func BenchmarkCfg ¶
BenchmarkCfg returns a base configuration for benchmarking.
func NewMultiErr ¶
NewMultiErr creates a multierror from a slice of errors.
Only non-nil error will be added. If there are no non-nil errors, it returns nil.
func Run ¶
Run launches a test network and calls a user defined function that can interact with the nodes via API clients.
The configuration files, data files, and logs will be saved in a directory within the given directory.
func RunWithConfigs ¶
func RunWithConfigs(ctx context.Context, dir string, numNodes int, configs []cfg.ConfigSet, fn Tester) error
RunWithConfigs launches a test network and calls a user defined function that can interact with the nodes via API clients. Each node has a specific config.
The configuration files, data files, and logs will be saved in a directory within the given directory.
Types ¶
type MultiErr ¶
type MultiErr []error
MultiErr represents multiple errors as a single error.
type TestNode ¶
type TestNode struct {
// contains filtered or unexported fields
}
TestNode represents a test node.
func NewTestNode ¶
NewTestNode creates a new test node.
func (*TestNode) FullAddress ¶
FullAddress returns the full address to connect to the node.
func (*TestNode) Up ¶
Up launches the node. It blocks until the process exits or the context is done.
func (*TestNode) WaitForAPI ¶
WaitForAPI waits for the API to be available.
type TestNodeSet ¶
type TestNodeSet []*TestNode
TestNodeSet represents a set of test nodes.
func NewTestNodeSet ¶
NewTestNodeSet creates a new set of test nodes.
func NewTestNodeSetWithConfigs ¶
NewTestNodeSetWithConfigs creates a new set of test nodes with different configs.
func (TestNodeSet) Connect ¶
func (s TestNodeSet) Connect(ctx context.Context) ([]*grpc.ClientConn, error)
Connect returns an API client for each node in the set.
type Tester ¶
type Tester func(context.Context, TestNodeSet, []*grpc.ClientConn)
Tester represents a function used to interact with a test network during a session.