providers_test.go 386 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
package dht

import (
	"testing"

	"github.com/jbenet/go-ipfs/peer"
	u "github.com/jbenet/go-ipfs/util"
)

func TestProviderManager(t *testing.T) {
	mid := peer.ID("testing")
	p := NewProviderManager(mid)
	a := u.Key("test")
14
	p.AddProvider(a, peer.WithIDString("testingprovider"))
15 16 17 18 19 20
	resp := p.GetProviders(a)
	if len(resp) != 1 {
		t.Fatal("Could not retrieve provider.")
	}
	p.Halt()
}