testing

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: AGPL-3.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// ETH network name to use for test networks
	TestNetworkEthName string = "hardhat"

	// Serialized nodeset.io deployment dummy encryption ID
	EncryptionIdentityString string = "AGE-SECRET-KEY-19N32FTRU5JJ66DNTVE8NTTE04CUQC3R3FC5QD9QKA97AZWCUW74ST78LD3"
)

Variables

View Source
var (
	// Nodeset.io deployment dummy encryption ID
	EncryptionIdentity, _ = age.ParseX25519Identity(EncryptionIdentityString)
)

Functions

func GetDefaultTestNetworkSettings added in v1.1.0

func GetDefaultTestNetworkSettings(beaconConfig *db.Config) *config.NetworkSettings

Creates a new set of network settings designed for usage in local testing with Hardat. The settings are incomplete; things like the multicall address and balance batcher address should be set by the user if needed.

Types

type HyperdriveNode added in v1.1.0

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

A complete Hyperdrive node instance

func (*HyperdriveNode) Close added in v1.1.0

func (n *HyperdriveNode) Close() error

Closes the Constellation node and its Hyperdrive parent.

func (*HyperdriveNode) CreateSubNode added in v1.1.0

func (n *HyperdriveNode) CreateSubNode(folder string, address string, port uint16) (*HyperdriveNode, error)

Create a new Hyperdrive node based on this one's configuration, but with a custom folder, address, and port.

func (*HyperdriveNode) GetApiClient added in v1.1.0

func (n *HyperdriveNode) GetApiClient() *client.ApiClient

Get the HTTP API client for interacting with the node's daemon server

func (*HyperdriveNode) GetServerManager added in v1.1.0

func (n *HyperdriveNode) GetServerManager() *server.ServerManager

Get the HTTP API server for the node's daemon

func (*HyperdriveNode) GetServiceProvider added in v1.1.0

func (n *HyperdriveNode) GetServiceProvider() common.IHyperdriveServiceProvider

Get the daemon's service provider

type HyperdriveTestManager

type HyperdriveTestManager struct {
	*osha.TestManager
	// contains filtered or unexported fields
}

HyperdriveTestManager provides bootstrapping and a test service provider, useful for testing

func NewHyperdriveTestManager

func NewHyperdriveTestManager(address string, port uint, cfg *hdconfig.HyperdriveConfig, resources *hdconfig.MergedResources, nsServer *nsserver.NodeSetMockServer) (*HyperdriveTestManager, error)

Creates a new HyperdriveTestManager instance. Requires management of your own nodeset.io server mock. `address` is the address to bind the Hyperdrive daemon to.

func NewHyperdriveTestManagerWithDefaults

func NewHyperdriveTestManagerWithDefaults(netSettingsProvisioner NetworkSettingsProvisioner) (*HyperdriveTestManager, error)

Creates a new HyperdriveTestManager instance with default test artifacts.

func (*HyperdriveTestManager) Close

func (m *HyperdriveTestManager) Close() error

Closes the Hyperdrive test manager, shutting down the daemon

func (*HyperdriveTestManager) CreateCustomSnapshot added in v1.1.0

func (m *HyperdriveTestManager) CreateCustomSnapshot(services Service) (string, error)

Takes a snapshot of the service states

func (*HyperdriveTestManager) GetNode added in v1.1.0

func (m *HyperdriveTestManager) GetNode() *HyperdriveNode

Get the Hyperdrive node

func (*HyperdriveTestManager) GetNodeSetMockServer added in v1.1.0

func (m *HyperdriveTestManager) GetNodeSetMockServer() *nsserver.NodeSetMockServer

Get the nodeset.io mock server

func (*HyperdriveTestManager) RevertToBaseline added in v1.1.0

func (m *HyperdriveTestManager) RevertToBaseline() error

Reverts the services to the baseline snapshot

func (*HyperdriveTestManager) RevertToCustomSnapshot added in v1.1.0

func (m *HyperdriveTestManager) RevertToCustomSnapshot(snapshotID string) error

Revert the services to a snapshot state

type NetworkSettingsProvisioner added in v1.1.0

type NetworkSettingsProvisioner func(*config.NetworkSettings) *config.NetworkSettings

A custom provisioning function that can alter or update the network settings used by the test manager prior to starting the Hyperdrive daemon

type Service added in v1.1.0

type Service int

Service represents a service provided by OSHA

const (
	// Represents the Execution client and Beacon node services
	Service_EthClients Service = 1 << iota

	// Represents the Docker client and compose services
	Service_Docker

	// Represents the underlying filesystem
	Service_Filesystem

	// Represents the nodeset.io service
	Service_NodeSet

	// Represents all of the services provided by OSHA
	Service_All Service = Service_EthClients | Service_Docker | Service_Filesystem | Service_NodeSet
)

func (Service) Contains added in v1.1.0

func (s Service) Contains(service Service) bool

Check if a service value contains a specific service flag

Jump to

Keyboard shortcuts

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