testsession

package
v0.27.2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: Apache-2.0, MIT Imports: 15 Imported by: 4 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectInstances

func ConnectInstances(instances []Instance)

ConnectInstances connects the given instances to each other

Types

type Instance

type Instance struct {
	Identity   tnet.Identity
	Datastore  ds.Batching
	Exchange   *bitswap.Bitswap
	Blockstore blockstore.Blockstore
	Adapter    bsnet.BitSwapNetwork
	Routing    routing.Routing
	// contains filtered or unexported fields
}

Instance is a test instance of bitswap + dependencies for integration testing

func NewInstance

func NewInstance(ctx context.Context, net tn.Network, router routing.Routing, p tnet.Identity, netOptions []bsnet.NetOpt, bsOptions []bitswap.Option) Instance

NewInstance creates a test bitswap instance.

NB: It's easy make mistakes by providing the same peer ID to two different instances. To safeguard, use the InstanceGenerator to generate instances. It's just a much better idea.

func (*Instance) SetBlockstoreLatency

func (i *Instance) SetBlockstoreLatency(t time.Duration) time.Duration

SetBlockstoreLatency customizes the artificial delay on receiving blocks from a blockstore test instance.

type InstanceGenerator

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

InstanceGenerator generates new test instances of bitswap+dependencies

func NewTestInstanceGenerator

func NewTestInstanceGenerator(net tn.Network, routing mockrouting.Server, netOptions []bsnet.NetOpt, bsOptions []bitswap.Option) InstanceGenerator

NewTestInstanceGenerator generates a new InstanceGenerator for the given testnet

func (*InstanceGenerator) Close

func (g *InstanceGenerator) Close() error

Close closes the clobal context, shutting down all test instances

func (*InstanceGenerator) Instances

func (g *InstanceGenerator) Instances(n int) []Instance

Instances creates N test instances of bitswap + dependencies and connects them to each other

func (*InstanceGenerator) Next

func (g *InstanceGenerator) Next() Instance

Next generates a new instance of bitswap + dependencies

Jump to

Keyboard shortcuts

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