integration

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package integration provides poet-specific RPC testing harness crafting and executing integration tests by driving a poet server instance via the RPC interface.

This package was designed specifically to act as an RPC testing harness. However, the constructs presented are general enough to be adapted to any project wishing to programmatically drive a poet server instance.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Harness

type Harness struct {
	api.PoetServiceClient
	// contains filtered or unexported fields
}

Harness fully encapsulates an active poet server process to provide a unified platform to programmatically drive a poet server instance, whether for creating rpc driven integration tests, or for any other usage.

func NewHarness

func NewHarness(ctx context.Context, cfg *ServerConfig) (*Harness, error)

NewHarness creates and initializes a new instance of Harness.

func (*Harness) ProcessErrors

func (h *Harness) ProcessErrors() <-chan error

ProcessErrors returns a channel used for reporting any fatal process errors.

func (*Harness) RESTListen

func (h *Harness) RESTListen() string

RESTListen returns the configured interface/port/socket for REST connections.

func (*Harness) StderrPipe added in v0.2.0

func (h *Harness) StderrPipe() io.Reader

StderrPipe returns an stderr reader for the server process.

func (*Harness) StdoutPipe added in v0.2.0

func (h *Harness) StdoutPipe() io.Reader

StdoutPipe returns an stdout reader for the server process.

func (*Harness) TearDown

func (h *Harness) TearDown(cleanup bool) error

TearDown stops the harness running instance. The created process is killed, and the temporary directories are removed.

type ServerConfig

type ServerConfig struct {
	DataDir          string
	Genesis          time.Time
	EpochDuration    time.Duration
	PhaseShift       time.Duration
	CycleGap         time.Duration
	DebugLog         bool
	Reset            bool
	RESTListen       string
	RpcListen        string
	GatewayAddresses []string
	GtwConnTimeout   time.Duration
	// contains filtered or unexported fields
}

ServerConfig contains all the args and data required to launch a poet server instance and connect to it via rpc client.

func DefaultConfig

func DefaultConfig() (*ServerConfig, error)

DefaultConfig returns a newConfig with all default values.

Jump to

Keyboard shortcuts

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