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
func StartAndWaitForReady ¶ added in v0.5.0
func StartAndWaitForReady(ctx context.Context, manager datatransfer.Manager) error
Types ¶
type TestPeer ¶
type TestPeer struct { ID peer.ID BitswapServer *server.Server BitswapNetwork bsnet.BitSwapNetwork DatatransferServer datatransfer.Manager Host host.Host LinkSystem linking.LinkSystem Cids map[cid.Cid]struct{} // contains filtered or unexported fields }
TestPeer is a test instance of bitswap + dependencies for integration testing
func NewTestBitswapPeer ¶ added in v0.5.0
func NewTestBitswapPeer(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 NewTestGraphsyncPeer ¶ added in v0.5.0
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) BitswapPeers ¶ added in v0.5.0
func (g *TestPeerGenerator) BitswapPeers(n int) []TestPeer
Peers creates N test peers with bitswap + dependencies
func (*TestPeerGenerator) Close ¶
func (g *TestPeerGenerator) Close() error
Close closes the clobal context, shutting down all test peers
func (*TestPeerGenerator) GraphsyncPeers ¶ added in v0.5.0
func (g *TestPeerGenerator) GraphsyncPeers(n int) []TestPeer
Peers creates N test peers with bitswap + dependencies
func (*TestPeerGenerator) NextBitswap ¶ added in v0.5.0
func (g *TestPeerGenerator) NextBitswap() TestPeer
Next generates a new test peer with bitswap + dependencies
func (*TestPeerGenerator) NextGraphsync ¶ added in v0.5.0
func (g *TestPeerGenerator) NextGraphsync() TestPeer
Next generates a new test peer with graphsync + dependencies