Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: quic go-routine leak in tests #56

Merged
merged 3 commits into from
Oct 6, 2023
Merged
Changes from 1 commit
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
11 changes: 9 additions & 2 deletions topology_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import (
"github.com/libp2p/go-libp2p"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/p2p/net/swarm"
"github.com/libp2p/go-libp2p/p2p/transport/tcp"
"github.com/stretchr/testify/require"

"github.com/plprobelab/zikade/internal/coord"
"github.com/plprobelab/zikade/kadt"
"github.com/stretchr/testify/require"
)

// A Topology is an arrangement of DHTs intended to simulate a network
Expand Down Expand Up @@ -128,7 +130,12 @@ func (t *Topology) hostOpts() []libp2p.Option {
dialTimeout := 100 * time.Millisecond
swarmOpts := libp2p.SwarmOpts(swarm.WithDialTimeout(dialTimeout))

return []libp2p.Option{swarmOpts}
// The QUIC transport leaks go-routines, so we're only enabling the TCP
// transport for our tests. Remove after:
// https://github.com/libp2p/go-libp2p/issues/2514 was fixed
tcpTransport := libp2p.Transport(tcp.NewTCPTransport)

return []libp2p.Option{swarmOpts, tcpTransport}
}

func (t *Topology) makeid(d *DHT) string {
Expand Down