testing

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 47 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Host

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

A Host is an ephemeral host that can be used for testing.

func NewHost

func NewHost(privKey types.PrivateKey, dir string, network *consensus.Network, debugLogging bool) (*Host, error)

NewHost initializes a new test host

func (*Host) AddVolume

func (h *Host) AddVolume(ctx context.Context, path string, size uint64) error

AddVolume adds a new volume to the host

func (*Host) Close

func (h *Host) Close() error

Close shutsdown the host

func (*Host) Contracts

func (h *Host) Contracts() *contracts.ContractManager

Contracts returns the host's contract manager

func (*Host) GatewayAddr

func (h *Host) GatewayAddr() string

GatewayAddr returns the address of the host's gateway.

func (*Host) PublicKey

func (h *Host) PublicKey() types.PublicKey

PublicKey returns the public key of the host

func (*Host) RHPv2Addr

func (h *Host) RHPv2Addr() string

RHPv2Addr returns the address of the RHPv2 listener

func (*Host) RHPv2Settings

func (h *Host) RHPv2Settings() (crhpv2.HostSettings, error)

RHPv2Settings returns the host's current RHPv2 settings

func (*Host) RHPv3Addr

func (h *Host) RHPv3Addr() string

RHPv3Addr returns the address of the RHPv3 listener

func (*Host) RHPv3PriceTable

func (h *Host) RHPv3PriceTable() (crhpv3.HostPriceTable, error)

RHPv3PriceTable returns the host's current RHPv3 price table

func (*Host) UpdateSettings

func (h *Host) UpdateSettings(settings settings.Settings) error

UpdateSettings updates the host's configuration

func (*Host) WalletAddress

func (h *Host) WalletAddress() types.Address

WalletAddress returns the host's wallet address

type TT added in v0.7.0

type TT struct {
	*testing.T
}

func (TT) AssertContains added in v0.7.0

func (t TT) AssertContains(err error, target string)

func (TT) AssertIs added in v0.7.0

func (t TT) AssertIs(err, target error)

func (TT) FailAll added in v0.7.0

func (t TT) FailAll(vs ...interface{})

func (TT) OK added in v0.7.0

func (t TT) OK(err error)

func (TT) OKAll added in v0.7.0

func (t TT) OKAll(vs ...interface{})

func (*TT) Retry added in v0.7.0

func (tt *TT) Retry(tries int, durationBetweenAttempts time.Duration, fn func() error)

Retry will call 'fn' 'tries' times, waiting 'durationBetweenAttempts' between each attempt, returning 'nil' the first time that 'fn' returns nil. If 'nil' is never returned, then the final error returned by 'fn' is returned.

type TestCluster

type TestCluster struct {
	Autopilot *autopilot.Client
	Bus       *bus.Client
	Worker    *worker.Client
	S3        *minio.Client
	S3Core    *minio.Core
	// contains filtered or unexported fields
}

TestCluster is a helper type that allows for easily creating a number of nodes connected to each other and ready for testing.

func (*TestCluster) AddHost

func (c *TestCluster) AddHost(h *Host)

func (*TestCluster) AddHosts

func (c *TestCluster) AddHosts(n int) []*Host

AddHosts adds n hosts to the cluster. These hosts will be funded and announce themselves on the network, ready to form contracts.

func (*TestCluster) AddHostsBlocking

func (c *TestCluster) AddHostsBlocking(n int) []*Host

func (*TestCluster) AutopilotConfig

func (c *TestCluster) AutopilotConfig(ctx context.Context) (api.AutopilotConfig, uint64)

AutopilotConfig returns the autopilot's config and current period.

func (*TestCluster) MineBlocks

func (c *TestCluster) MineBlocks(n int)

MineBlocks uses the bus' miner to mine n blocks.

func (*TestCluster) MineToRenewWindow

func (c *TestCluster) MineToRenewWindow()

MineToRenewWindow is a helper which mines enough blocks for the autopilot to reach its renew window.

func (*TestCluster) NewHost

func (c *TestCluster) NewHost() *Host

func (*TestCluster) Reboot

func (c *TestCluster) Reboot(ctx context.Context) *TestCluster

Reboot simulates a reboot of the cluster by calling Shutdown and creating a new cluster using the same settings as the previous one. NOTE: Simulating a reboot means that the hosts stay active and are not restarted.

func (*TestCluster) RemoveHost

func (c *TestCluster) RemoveHost(host *Host)

func (*TestCluster) Shutdown

func (c *TestCluster) Shutdown()

Shutdown shuts down a TestCluster.

func (*TestCluster) ShutdownAutopilot

func (tc *TestCluster) ShutdownAutopilot(ctx context.Context)

func (*TestCluster) ShutdownBus

func (tc *TestCluster) ShutdownBus(ctx context.Context)

func (*TestCluster) ShutdownS3 added in v0.6.0

func (tc *TestCluster) ShutdownS3(ctx context.Context)

func (*TestCluster) ShutdownWorker

func (tc *TestCluster) ShutdownWorker(ctx context.Context)

func (*TestCluster) Sync

func (c *TestCluster) Sync()

Sync blocks until the whole cluster has reached the same block height.

func (*TestCluster) UpdateAutopilotConfig

func (c *TestCluster) UpdateAutopilotConfig(ctx context.Context, cfg api.AutopilotConfig)

UpdateAutopilotConfig updates the cluster's autopilot with given config.

func (*TestCluster) WaitForAccounts

func (c *TestCluster) WaitForAccounts() []api.Account

func (*TestCluster) WaitForContractSet

func (c *TestCluster) WaitForContractSet(set string, n int)

func (*TestCluster) WaitForContractSetContracts added in v1.0.3

func (c *TestCluster) WaitForContractSetContracts(set string, n int)

func (*TestCluster) WaitForContracts

func (c *TestCluster) WaitForContracts() []api.Contract

Jump to

Keyboard shortcuts

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