Commit 6bb28d6a authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

transition dht to mock2

parent 15c6bc15
...@@ -7,15 +7,15 @@ import ( ...@@ -7,15 +7,15 @@ import (
crand "crypto/rand" crand "crypto/rand"
inet "github.com/jbenet/go-ipfs/net" inet "github.com/jbenet/go-ipfs/net"
mocknet "github.com/jbenet/go-ipfs/net/mock" mocknet "github.com/jbenet/go-ipfs/net/mock2"
peer "github.com/jbenet/go-ipfs/peer" peer "github.com/jbenet/go-ipfs/peer"
routing "github.com/jbenet/go-ipfs/routing" routing "github.com/jbenet/go-ipfs/routing"
pb "github.com/jbenet/go-ipfs/routing/dht/pb" pb "github.com/jbenet/go-ipfs/routing/dht/pb"
u "github.com/jbenet/go-ipfs/util" u "github.com/jbenet/go-ipfs/util"
testutil "github.com/jbenet/go-ipfs/util/testutil" testutil "github.com/jbenet/go-ipfs/util/testutil"
ggio "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/gogoprotobuf/io"
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context" context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
ggio "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/gogoprotobuf/io"
ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore" ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
"time" "time"
...@@ -27,16 +27,15 @@ func TestGetFailures(t *testing.T) { ...@@ -27,16 +27,15 @@ func TestGetFailures(t *testing.T) {
} }
ctx := context.Background() ctx := context.Background()
peerstore := peer.NewPeerstore() mn, err := mocknet.FullMeshConnected(ctx, 2)
local := makePeerString(t, "")
peers := []peer.Peer{local, testutil.RandPeer()}
nets, err := mocknet.MakeNetworks(ctx, peers)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
nets := mn.Nets()
peers := mn.Peers()
d := NewDHT(ctx, peers[0], peerstore, nets[0], ds.NewMapDatastore()) ps := peer.NewPeerstore()
d := NewDHT(ctx, peers[0], ps, nets[0], ds.NewMapDatastore())
d.Update(ctx, peers[1]) d.Update(ctx, peers[1])
// This one should time out // This one should time out
...@@ -141,17 +140,13 @@ func TestNotFound(t *testing.T) { ...@@ -141,17 +140,13 @@ func TestNotFound(t *testing.T) {
} }
ctx := context.Background() ctx := context.Background()
peerstore := peer.NewPeerstore() mn, err := mocknet.FullMeshConnected(ctx, 16)
var peers []peer.Peer
for i := 0; i < 16; i++ {
peers = append(peers, testutil.RandPeer())
}
nets, err := mocknet.MakeNetworks(ctx, peers)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
nets := mn.Nets()
peers := mn.Peers()
peerstore := peer.NewPeerstore()
d := NewDHT(ctx, peers[0], peerstore, nets[0], ds.NewMapDatastore()) d := NewDHT(ctx, peers[0], peerstore, nets[0], ds.NewMapDatastore())
...@@ -215,17 +210,13 @@ func TestLessThanKResponses(t *testing.T) { ...@@ -215,17 +210,13 @@ func TestLessThanKResponses(t *testing.T) {
// t.Skip("skipping test because it makes a lot of output") // t.Skip("skipping test because it makes a lot of output")
ctx := context.Background() ctx := context.Background()
peerstore := peer.NewPeerstore() mn, err := mocknet.FullMeshConnected(ctx, 6)
var peers []peer.Peer
for i := 0; i < 6; i++ {
peers = append(peers, testutil.RandPeer())
}
nets, err := mocknet.MakeNetworks(ctx, peers)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
nets := mn.Nets()
peers := mn.Peers()
peerstore := peer.NewPeerstore()
d := NewDHT(ctx, peers[0], peerstore, nets[0], ds.NewMapDatastore()) d := NewDHT(ctx, peers[0], peerstore, nets[0], ds.NewMapDatastore())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment