Commit 15615ccd authored by Brian Tiger Chow's avatar Brian Tiger Chow

style(testutil) rename testutil.Peer -> testutil.Identity

cc @jbenet
parent d7ff47d8
......@@ -61,7 +61,7 @@ func TestProviderForKeyButNetworkCannotFind(t *testing.T) { // TODO revisit this
defer g.Close()
block := blocks.NewBlock([]byte("block"))
pinfo := testutil.RandPeerOrFatal(t)
pinfo := testutil.RandIdentityOrFatal(t)
rs.Client(pinfo).Provide(context.Background(), block.Key()) // but not on network
solo := g.Next()
......
......@@ -7,7 +7,7 @@ import (
)
type Network interface {
Adapter(testutil.Peer) bsnet.BitSwapNetwork
Adapter(testutil.Identity) bsnet.BitSwapNetwork
HasPeer(peer.ID) bool
}
......@@ -17,11 +17,11 @@ import (
func TestSendRequestToCooperativePeer(t *testing.T) {
net := VirtualNetwork(mockrouting.NewServer(), delay.Fixed(0))
recipientPeer := testutil.RandPeerOrFatal(t)
recipientPeer := testutil.RandIdentityOrFatal(t)
t.Log("Get two network adapters")
initiator := net.Adapter(testutil.RandPeerOrFatal(t))
initiator := net.Adapter(testutil.RandIdentityOrFatal(t))
recipient := net.Adapter(recipientPeer)
expectedStr := "response from recipient"
......@@ -67,8 +67,8 @@ func TestSendRequestToCooperativePeer(t *testing.T) {
func TestSendMessageAsyncButWaitForResponse(t *testing.T) {
net := VirtualNetwork(mockrouting.NewServer(), delay.Fixed(0))
responderPeer := testutil.RandPeerOrFatal(t)
waiter := net.Adapter(testutil.RandPeerOrFatal(t))
responderPeer := testutil.RandIdentityOrFatal(t)
waiter := net.Adapter(testutil.RandIdentityOrFatal(t))
responder := net.Adapter(responderPeer)
var wg sync.WaitGroup
......
......@@ -19,7 +19,7 @@ func StreamNet(ctx context.Context, net mockpeernet.Mocknet, rs mockrouting.Serv
return &peernet{net, rs}, nil
}
func (pn *peernet) Adapter(p testutil.Peer) bsnet.BitSwapNetwork {
func (pn *peernet) Adapter(p testutil.Identity) bsnet.BitSwapNetwork {
client, err := pn.Mocknet.AddPeer(p.PrivateKey(), p.Address())
if err != nil {
panic(err.Error())
......
......@@ -29,7 +29,7 @@ type network struct {
delay delay.D
}
func (n *network) Adapter(p testutil.Peer) bsnet.BitSwapNetwork {
func (n *network) Adapter(p testutil.Identity) bsnet.BitSwapNetwork {
client := &networkClient{
local: p.ID(),
network: n,
......
......@@ -41,7 +41,7 @@ func (g *SessionGenerator) Close() error {
func (g *SessionGenerator) Next() Instance {
g.seq++
p, err := testutil.RandPeer()
p, err := testutil.RandIdentity()
if err != nil {
panic("FIXME") // TODO change signature
}
......@@ -78,7 +78,7 @@ func (i *Instance) SetBlockstoreLatency(t time.Duration) time.Duration {
// NB: It's easy make mistakes by providing the same peer ID to two different
// sessions. To safeguard, use the SessionGenerator to generate sessions. It's
// just a much better idea.
func session(ctx context.Context, net tn.Network, p testutil.Peer) Instance {
func session(ctx context.Context, net tn.Network, p testutil.Identity) Instance {
bsdelay := delay.Fixed(0)
const kWriteCacheElems = 100
......
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