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:
@ -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
|
||||
|
Reference in New Issue
Block a user