testing

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: May 22, 2025 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTotal int = 100
	BatchSize    int = 10
)
View Source
const (
	// Address of a mock StakeWise vault for testing
	StakeWiseVaultString string = "0x57ace215eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
)

Variables

View Source
var (
	// Code 503 - returned when the server is busy loading private keys or doing lookback scans
	ErrorUnavailable error = fmt.Errorf("server is currently unavailable to handle the request")

	// Code 429 - returned when there's an active request being processed already, since only one can run at a time
	ErrorTooManyRequests error = fmt.Errorf("too many requests, please try again later")
)

Functions

This section is empty.

Types

type OperatorMock added in v1.2.0

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

Mocks the StakeWise operator for stimulating the relay

func NewOperatorMock added in v1.2.0

func NewOperatorMock(relayEndpoint string, res *swconfig.MergedResources, startIndex int) (*OperatorMock, error)

Creates a new operator mock

func (*OperatorMock) SetStartIndex added in v1.2.0

func (m *OperatorMock) SetStartIndex(startIndex int)

Set the start index provided in requests

func (*OperatorMock) SetTotal added in v1.2.0

func (m *OperatorMock) SetTotal(total int)

Set the total number of validators in requests

func (*OperatorMock) SubmitValidatorsRequest added in v1.2.0

func (m *OperatorMock) SubmitValidatorsRequest() (*relay.ValidatorsResponse, error)

Simulate the relay request to create validators and return the response

type StakeWiseNode added in v1.1.0

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

A complete StakeWise node instance

func (*StakeWiseNode) Close added in v1.1.0

func (n *StakeWiseNode) Close() error

Closes the StakeWise node. The caller is responsible for stopping the Hyperdrive daemon owning this module.

func (*StakeWiseNode) CreateSubNode added in v1.1.0

func (n *StakeWiseNode) CreateSubNode(hdNode *hdtesting.HyperdriveNode, address string, port uint16) (*StakeWiseNode, error)

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

func (*StakeWiseNode) GetApiClient added in v1.1.0

func (n *StakeWiseNode) GetApiClient() *swclient.ApiClient

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

func (*StakeWiseNode) GetHyperdriveNode added in v1.1.0

func (n *StakeWiseNode) GetHyperdriveNode() *hdtesting.HyperdriveNode

Get the Hyperdrive node for this StakeWise module

func (*StakeWiseNode) GetRelayServer added in v1.2.0

func (n *StakeWiseNode) GetRelayServer() *relay.RelayServer

Get the HTTP Relay server for the node's daemon

func (*StakeWiseNode) GetServerManager added in v1.1.0

func (n *StakeWiseNode) GetServerManager() *swserver.ServerManager

Get the HTTP API server for the node's daemon

func (*StakeWiseNode) GetServiceProvider added in v1.1.0

func (n *StakeWiseNode) GetServiceProvider() swcommon.IStakeWiseServiceProvider

Get the daemon's service provider

type StakeWiseTestManager

type StakeWiseTestManager struct {
	*hdtesting.HyperdriveTestManager
	// contains filtered or unexported fields
}

StakeWiseTestManager for managing testing resources and services

func NewStakeWiseTestManager

func NewStakeWiseTestManager() (*StakeWiseTestManager, error)

Creates a new TestManager instance

func (*StakeWiseTestManager) CloseModule added in v1.2.0

func (m *StakeWiseTestManager) CloseModule() error

Closes the test manager, shutting down the nodeset mock server and all other resources

func (*StakeWiseTestManager) DependsOnStakeWiseBaseline added in v1.2.0

func (m *StakeWiseTestManager) DependsOnStakeWiseBaseline() error

Reverts the service states to the baseline snapshot

func (*StakeWiseTestManager) GetModuleName added in v1.2.0

func (m *StakeWiseTestManager) GetModuleName() string

func (*StakeWiseTestManager) GetNode added in v1.1.0

func (m *StakeWiseTestManager) GetNode() *StakeWiseNode

Get the node handle

func (*StakeWiseTestManager) GetOperatorMock added in v1.2.0

func (m *StakeWiseTestManager) GetOperatorMock() *OperatorMock

Get the operator mock handle

func (*StakeWiseTestManager) RevertModuleToSnapshot added in v1.2.0

func (m *StakeWiseTestManager) RevertModuleToSnapshot(moduleState any) error

func (*StakeWiseTestManager) TakeModuleSnapshot added in v1.2.0

func (m *StakeWiseTestManager) TakeModuleSnapshot() (any, error)

Takes a snapshot of the service states

Jump to

Keyboard shortcuts

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