Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectPeers ¶
func ConnectPeers(instances []TestPeer)
ConnectPeers connects the given peers to each other
Types ¶
type TestPeer ¶
type TestPeer struct { ID peer.ID BitswapServer *server.Server Host host.Host // contains filtered or unexported fields }
TestPeer is a test instance of bitswap + dependencies for integration testing
func NewTestPeer ¶
func NewTestPeer(ctx context.Context, mn mocknet.Mocknet, p tnet.Identity, netOptions []bsnet.NetOpt, bsOptions []server.Option) (TestPeer, error)
NewTestPeer creates a test peer 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 (*TestPeer) Blockstore ¶
func (i *TestPeer) Blockstore() blockstore.Blockstore
Blockstore returns the block store for this test instance
type TestPeerGenerator ¶
type TestPeerGenerator struct {
// contains filtered or unexported fields
}
TestPeerGenerator generates new test peers bitswap+dependencies TODO: add graphsync/markets stack, make protocols choosable
func NewTestPeerGenerator ¶
func NewTestPeerGenerator(ctx context.Context, t *testing.T, mn mocknet.Mocknet, netOptions []bsnet.NetOpt, bsOptions []server.Option) TestPeerGenerator
NewTestPeerGenerator generates a new TestPeerGenerator for the given mocknet
func (*TestPeerGenerator) Close ¶
func (g *TestPeerGenerator) Close() error
Close closes the clobal context, shutting down all test peers
func (*TestPeerGenerator) Next ¶
func (g *TestPeerGenerator) Next() TestPeer
Next generates a new test peer with bitswap + dependencies
func (*TestPeerGenerator) Peers ¶
func (g *TestPeerGenerator) Peers(n int) []TestPeer
Peers creates N test peers with bitswap + dependencies