Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

feat: plumb peerstore contexts changes through #75

Merged
merged 1 commit into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions backoffcache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ func TestBackoffDiscoverySingleBackoff(t *testing.T) {

discServer := newDiscoveryServer()

h1 := bhost.NewBlankHost(swarmt.GenSwarm(t, ctx))
h2 := bhost.NewBlankHost(swarmt.GenSwarm(t, ctx))
h1 := bhost.NewBlankHost(swarmt.GenSwarm(t))
defer h1.Close()
h2 := bhost.NewBlankHost(swarmt.GenSwarm(t))
defer h2.Close()
d1 := &mockDiscoveryClient{h1, discServer}
d2 := &mockDiscoveryClient{h2, discServer}

Expand Down Expand Up @@ -100,8 +102,10 @@ func TestBackoffDiscoveryMultipleBackoff(t *testing.T) {

discServer := newDiscoveryServer()

h1 := bhost.NewBlankHost(swarmt.GenSwarm(t, ctx))
h2 := bhost.NewBlankHost(swarmt.GenSwarm(t, ctx))
h1 := bhost.NewBlankHost(swarmt.GenSwarm(t))
defer h1.Close()
h2 := bhost.NewBlankHost(swarmt.GenSwarm(t))
defer h2.Close()
d1 := &mockDiscoveryClient{h1, discServer}
d2 := &mockDiscoveryClient{h2, discServer}

Expand Down Expand Up @@ -152,7 +156,8 @@ func TestBackoffDiscoverySimultaneousQuery(t *testing.T) {
advertisers := make([]discovery.Discovery, n)

for i := 0; i < n; i++ {
h := bhost.NewBlankHost(swarmt.GenSwarm(t, ctx))
h := bhost.NewBlankHost(swarmt.GenSwarm(t))
defer h.Close()
advertisers[i] = &mockDiscoveryClient{h, discServer}
}

Expand Down Expand Up @@ -210,11 +215,12 @@ func TestBackoffDiscoveryCacheCapacity(t *testing.T) {
advertisers := make([]discovery.Discovery, n)

for i := 0; i < n; i++ {
h := bhost.NewBlankHost(swarmt.GenSwarm(t, ctx))
h := bhost.NewBlankHost(swarmt.GenSwarm(t))
defer h.Close()
advertisers[i] = &mockDiscoveryClient{h, discServer}
}

h1 := bhost.NewBlankHost(swarmt.GenSwarm(t, ctx))
h1 := bhost.NewBlankHost(swarmt.GenSwarm(t))
d1 := &mockDiscoveryClient{h1, discServer}

const discoveryInterval = time.Millisecond * 100
Expand Down
3 changes: 2 additions & 1 deletion backoffconnector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ func getNetHosts(t *testing.T, ctx context.Context, n int) []host.Host {
var out []host.Host

for i := 0; i < n; i++ {
netw := swarmt.GenSwarm(t, ctx)
netw := swarmt.GenSwarm(t)
h := bhost.NewBlankHost(netw)
t.Cleanup(func() { h.Close() })
out = append(out, h)
}

Expand Down
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ module github.com/libp2p/go-libp2p-discovery

require (
github.com/hashicorp/golang-lru v0.5.4
github.com/ipfs/go-cid v0.0.6
github.com/ipfs/go-log v1.0.4
github.com/ipfs/go-cid v0.0.7
github.com/ipfs/go-log v1.0.5
github.com/libp2p/go-libp2p-blankhost v0.2.0
github.com/libp2p/go-libp2p-core v0.6.0
github.com/libp2p/go-libp2p-peerstore v0.2.6
github.com/libp2p/go-libp2p-swarm v0.2.8
github.com/multiformats/go-multihash v0.0.13
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a
github.com/libp2p/go-libp2p-core v0.11.0
github.com/libp2p/go-libp2p-peerstore v0.4.0
github.com/libp2p/go-libp2p-swarm v0.8.0
github.com/multiformats/go-multihash v0.0.15
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
)

go 1.15
Loading