mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-24 11:57:44 +08:00
I think it's time to move a lot of the peer-to-peer networking but-not-ipfs-specific things into its own package: p2p. This could in the future be split off into its own library. The first thing to go is the peer.
24 lines
518 B
Go
24 lines
518 B
Go
package dht
|
|
|
|
import (
|
|
"testing"
|
|
|
|
peer "github.com/jbenet/go-ipfs/p2p/peer"
|
|
u "github.com/jbenet/go-ipfs/util"
|
|
|
|
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
|
|
)
|
|
|
|
func TestProviderManager(t *testing.T) {
|
|
ctx := context.Background()
|
|
mid := peer.ID("testing")
|
|
p := NewProviderManager(ctx, mid)
|
|
a := u.Key("test")
|
|
p.AddProvider(a, peer.ID("testingprovider"))
|
|
resp := p.GetProviders(ctx, a)
|
|
if len(resp) != 1 {
|
|
t.Fatal("Could not retrieve provider.")
|
|
}
|
|
p.Close()
|
|
}
|