Documentation ¶
Index ¶
- type Host
- func (h *Host) AddVolume(ctx context.Context, path string, size uint64) error
- func (h *Host) Close() error
- func (h *Host) Contracts() *contracts.Manager
- func (h *Host) PublicKey() types.PublicKey
- func (h *Host) RHPv2Addr() string
- func (h *Host) RHPv2Settings() (crhpv2.HostSettings, error)
- func (h *Host) RHPv3Addr() string
- func (h *Host) RHPv3PriceTable() (crhpv3.HostPriceTable, error)
- func (h *Host) SyncerAddr() string
- func (h *Host) UpdateSettings(settings settings.Settings) error
- func (h *Host) WalletAddress() types.Address
- type TestCluster
- func (tc *TestCluster) Accounts() []api.Account
- func (c *TestCluster) AddHost(h *Host)
- func (c *TestCluster) AddHosts(n int) []*Host
- func (c *TestCluster) AddHostsBlocking(n int) []*Host
- func (c *TestCluster) AutopilotConfig(ctx context.Context) (api.AutopilotConfig, uint64)
- func (tc *TestCluster) ContractRoots(ctx context.Context, fcid types.FileContractID) ([]types.Hash256, error)
- func (c *TestCluster) MineBlocks(n uint64)
- func (c *TestCluster) MineToRenewWindow()
- func (c *TestCluster) MineTransactions(ctx context.Context) error
- func (c *TestCluster) NewHost() *Host
- func (c *TestCluster) Reboot(t *testing.T) *TestCluster
- func (c *TestCluster) RemoveHost(host *Host)
- func (c *TestCluster) Shutdown()
- func (tc *TestCluster) ShutdownAutopilot(ctx context.Context)
- func (tc *TestCluster) ShutdownBus(ctx context.Context)
- func (tc *TestCluster) ShutdownS3(ctx context.Context)
- func (tc *TestCluster) ShutdownWorker(ctx context.Context)
- func (c *TestCluster) UpdateAutopilotConfig(ctx context.Context, cfg api.AutopilotConfig)
- func (c *TestCluster) WaitForAccounts() []api.Account
- func (c *TestCluster) WaitForContractSet(set string, n int)
- func (c *TestCluster) WaitForContractSetContracts(set string, n int)
- func (c *TestCluster) WaitForContracts() []api.Contract
- func (c *TestCluster) WaitForPeers()
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, genesisBlock types.Block) (*Host, error)
NewHost initializes a new test host.
func (*Host) RHPv2Settings ¶
func (h *Host) RHPv2Settings() (crhpv2.HostSettings, error)
RHPv2Settings returns the host's current RHPv2 settings
func (*Host) RHPv3PriceTable ¶
func (h *Host) RHPv3PriceTable() (crhpv3.HostPriceTable, error)
RHPv3PriceTable returns the host's current RHPv3 price table
func (*Host) SyncerAddr ¶ added in v1.1.0
SyncerAddr returns the address of the host's syncer.
func (*Host) UpdateSettings ¶
UpdateSettings updates the host's configuration
func (*Host) WalletAddress ¶
WalletAddress returns the host's wallet address
type TestCluster ¶
type TestCluster struct { Autopilot *autopilot.Client Bus *bus.Client Worker *worker.Client S3 *s3TestClient // 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) Accounts ¶ added in v1.1.0
func (tc *TestCluster) Accounts() []api.Account
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) ContractRoots ¶ added in v1.1.0
func (tc *TestCluster) ContractRoots(ctx context.Context, fcid types.FileContractID) ([]types.Hash256, error)
func (*TestCluster) MineBlocks ¶
func (c *TestCluster) MineBlocks(n uint64)
MineBlocks mines 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) MineTransactions ¶ added in v1.1.0
func (c *TestCluster) MineTransactions(ctx context.Context) error
MineTransactions tries to mine the transactions in the transaction pool until it is empty.
func (*TestCluster) NewHost ¶
func (c *TestCluster) NewHost() *Host
func (*TestCluster) Reboot ¶
func (c *TestCluster) Reboot(t *testing.T) *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) ShutdownAutopilot ¶
func (tc *TestCluster) ShutdownAutopilot(ctx context.Context)
func (*TestCluster) ShutdownBus ¶
func (tc *TestCluster) ShutdownBus(ctx context.Context)
func (*TestCluster) ShutdownS3 ¶
func (tc *TestCluster) ShutdownS3(ctx context.Context)
func (*TestCluster) ShutdownWorker ¶
func (tc *TestCluster) ShutdownWorker(ctx context.Context)
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 ¶
func (c *TestCluster) WaitForContractSetContracts(set string, n int)
func (*TestCluster) WaitForContracts ¶
func (c *TestCluster) WaitForContracts() []api.Contract
func (*TestCluster) WaitForPeers ¶ added in v1.1.0
func (c *TestCluster) WaitForPeers()