1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-29 01:12:24 +08:00

add RandPeerOrFatal test helper

This commit is contained in:
Brian Tiger Chow
2014-12-23 18:18:45 -05:00
parent b551e45ae9
commit 12b92f03f1

View File

@ -1,6 +1,8 @@
package testutil
import (
"testing"
ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
ci "github.com/jbenet/go-ipfs/crypto"
peer "github.com/jbenet/go-ipfs/peer"
@ -21,6 +23,14 @@ func RandPeer() (Peer, error) {
return &testpeer{*p}, nil
}
func RandPeerOrFatal(t *testing.T) Peer {
p, err := RandPeerNetParams()
if err != nil {
t.Fatal(err)
}
return &testpeer{*p}
}
// peer is a temporary shim to delay binding of PeerNetParams.
type testpeer struct {
PeerNetParams