mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-23 11:27:42 +08:00
- Modified Godeps/Godeps.json by hand - [TEST] Updated welcome docs hash to sharness - [TEST] Updated contact doc - [TEST] disabled breaking test (t0080-repo refs local)
29 lines
692 B
Go
29 lines
692 B
Go
package blockservice
|
|
|
|
import (
|
|
"testing"
|
|
|
|
bitswap "github.com/ipfs/go-ipfs/exchange/bitswap"
|
|
tn "github.com/ipfs/go-ipfs/exchange/bitswap/testnet"
|
|
mockrouting "github.com/ipfs/go-ipfs/routing/mock"
|
|
delay "github.com/ipfs/go-ipfs/thirdparty/delay"
|
|
)
|
|
|
|
// Mocks returns |n| connected mock Blockservices
|
|
func Mocks(t *testing.T, n int) []*BlockService {
|
|
net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(0))
|
|
sg := bitswap.NewTestSessionGenerator(net)
|
|
|
|
instances := sg.Instances(n)
|
|
|
|
var servs []*BlockService
|
|
for _, i := range instances {
|
|
bserv, err := New(i.Blockstore(), i.Exchange)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
servs = append(servs, bserv)
|
|
}
|
|
return servs
|
|
}
|