Commit 7b4222ac authored by Jeromy's avatar Jeromy Committed by Brian Tiger Chow

change back to using Client method

parent 616f7760
......@@ -281,8 +281,7 @@ func session(net tn.Network, rs mock.RoutingServer, id peer.ID) instance {
p := &peer.Peer{ID: id}
adapter := net.Adapter(p)
htc := mock.NewMockRouter(p, nil)
htc.SetRoutingServer(rs)
htc := rs.Client(p)
blockstore := bstore.NewBlockstore(ds.NewMapDatastore())
const alwaysSendToPeer = true
......
......@@ -43,12 +43,10 @@ func TestSetAndGet(t *testing.T) {
}
func TestClientFindProviders(t *testing.T) {
peer := &peer.Peer{
ID: []byte("42"),
}
peer := &peer.Peer{ID: []byte("42")}
rs := mock.VirtualRoutingServer()
client := mock.NewMockRouter(peer, nil)
client.SetRoutingServer(rs)
client := rs.Client(peer)
k := u.Key("hello")
err := client.Provide(context.Background(), k)
if err != nil {
......@@ -99,8 +97,9 @@ func TestClientOverMax(t *testing.T) {
}
max := 10
client := mock.NewMockRouter(&peer.Peer{ID: []byte("TODO")}, nil)
client.SetRoutingServer(rs)
peer := &peer.Peer{ID: []byte("TODO")}
client := rs.Client(peer)
providersFromClient := client.FindProvidersAsync(context.Background(), k, max)
i := 0
for _ = range providersFromClient {
......@@ -132,8 +131,7 @@ func TestCanceledContext(t *testing.T) {
}()
local := &peer.Peer{ID: []byte("peer id doesn't matter")}
client := mock.NewMockRouter(local, nil)
client.SetRoutingServer(rs)
client := rs.Client(local)
t.Log("warning: max is finite so this test is non-deterministic")
t.Log("context cancellation could simply take lower priority")
......
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